Am trying to solve a system of linear equations involving three variables using R
. However, I get an error as shown below:
> A = matrix(data=c(-0.4, 0.4, 0.15, 0.3, -0.55, 0.6, 0.1, 0.15, -0.75), nrow=3, ncol=3, byrow=TRUE)
> A
[,1] [,2] [,3]
[1,] -0.4 0.40 0.15
[2,] 0.3 -0.55 0.60
[3,] 0.1 0.15 -0.75
>
> b = matrix(data=c(0, 0, 0), nrow=3, ncol=1, byrow=TRUE)
> b
[,1]
[1,] 0
[2,] 0
[3,] 0
>
> solve(A, b)
Error in solve.default(A, b) :
system is computationally singular: reciprocal condition number = 1.04615e-17
When I work them out using substitution method, I get the variable values as: 0.456, 0.4027, 0.1413 respectively (not exactly precise values). The sum of all the variables should be 1.
How could I solve such a system?
Background: These equations come from solving a Discrete Time Markov Chain. In reality, there could be around 20 such simultaneous equations on 20 variables.
Best Answer
I suppose you mean the norm of the variables should be 1.
Otherwise: