R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > # chex32.r J F Monahan August 2007 > # > # Example 3.2 Solve a general system of linear equations > # > A <- matrix( c(1,.5,0,1, 2,1,2,-1, -1,0,-.5,1.5, 0,1,1.5,0), 4, 4) > # write it out > A [,1] [,2] [,3] [,4] [1,] 1.0 2 -1.0 0.0 [2,] 0.5 1 0.0 1.0 [3,] 0.0 2 -0.5 1.5 [4,] 1.0 -1 1.5 0.0 > b <- c( .5, 1, 1.5, 2) > # write it out > b [1] 0.5 1.0 1.5 2.0 > # solve equations > x <- solve(A,b) > # write it out > x [1] -0.70 2.25 3.30 -0.90 > rm(list=ls()) # clean up >