In: Advanced Math
Use R to solve:
Find the approximate solution x' to :
0.89x1 + 0.53x2 = 0.36
0.47x1 + 0.28x2 = 0.19
Find the error x'-x* between the computed solution and the true solution.
Compare the size of this error with the size of the residual r=b-Ax'
The R program to find the approximate solution is as follows:-
INPUT:-
#We crarete a 2*2 matrix A which is the augmented matrix of
the system of linear equations and b is the R.H.S of system of
#linear equations,We use ginv() function from MASS library to get
the generalised inverse of A
A <- matrix(c(0.89,0.47,0.53,0.28),2,2)
b <-c(0.36,0.19)
library(MASS)
ginv(A) %*% b
OUTPUT:-
[,1]
[1,] 1
[2,] -1
Hence our approximate solution is x'=(1, -1)T so x1=1 and x2= -1