Skip to content

Linear system

4 messages · Jim Gustafsson, Uwe Ligges, Sundar Dorai-Raj +1 more

#
Jim Gustafsson wrote:

            
>
You already said it yourself ("solve"):


A <- rbind(c(353, 45, 29), c(45, 29, 3), c(29, 3, 4))
solve(A, c(79, 5, 8))
# [1]  0.1784625 -0.1924954  0.8505186

Uwe Ligges
#
Jim Gustafsson wrote:
Use ?solve:

X <- matrix(c(353, 45, 29,
                45, 29,  3,
                29,  3,  4), 3, 3, byrow = TRUE)
y <- c(79, 5, 8)
b <- solve(X, y)

Have you read the posting guide? In particular, have you tried simple 
queries using help.search or the R archives? This question has been 
answered many times.

HTH,

--sundar
#
On Wednesday 25 May 2005 14:30, Jim Gustafsson wrote:
You can write this equation system in matrix form:
M * x = y

with 
x = ( a, b, c )
M = ( 353, 45, 29,
       45, 29,  3,
       29,  3,  4 )
y = ( 79, 5, 8 )

you can solve the system by 
x = M^(-1) * y

In R you can do this by
R> M = matrix( c( 353, 45, 29, 45, 29,  3, 29,  3,  4 ), 
   ncol = 3, byrow = TRUE )
R> y <- c( 79, 5, 8 )
R> x <- solve( M ) %*% y 
or
R> x <- solve( M, y )

Please read a basic book about linear algebra.

Arne