Linear Algebra/Topic: Computer Algebra Systems
Template:Navigation The linear systems in this chapter are small enough that their solution by hand is easy. But large systems are easiest, and safest, to do on a computer. Template:AnchorThere are special purpose programs such as LINPACK for this job. Template:AnchorAnother popular tool is a general purpose computer algebra system, including both commercial packages such as Maple, Mathematica, or MATLAB, or free packages such as SciLab, Sage, or Octave.
For example, in the Topic on Networks, we need to solve this.
It can be done by hand, but it would take a while and be error-prone. Using a computer is better.
We illustrate by solving that system under Maple (for another system, a user's manual would obviously detail the exact syntax needed). The array of coefficients can be entered in this way
> A:=array( [[1,-1,-1,0,0,0,0], [0,1,0,-1,0,-1,0], [0,0,1,0,-1,1,0], [0,0,0,1,1,0,-1], [0,5,0,10,0,0,0], [0,0,2,0,4,0,0], [0,5,-2,0,0,50,0]] );
(putting the rows on separate lines is not necessary,
but is done for clarity).
The vector of constants is entered similarly.
> u:=array( [0,0,0,0,10,10,0] );
Then the system is solved, like magic.
> linsolve(A,u); 7 2 5 2 5 7 [ -, -, -, -, -, 0, - ] 3 3 3 3 3 3
Mathematica can solve this with
RowReduce[({{1, -1, -1, 0, 0, 0, 0, 0}, {0, 1, 0, -1, 0, -1, 0,
0}, {0, 0, 1, 0, -1, 1, 0, 0}, {0, 0, 0, 1, 1, 0, -1, 0}, {0, 5,
0, 10, 0, 0, 0, 10}, {0, 0, 2, 0, 4, 0, 0, 10}, {0, 5, -2, 0, 0,
50, 0, 0}})]
This returns the following output:
{{1, 0, 0, 0, 0, 0, 0, 7/3}, {0, 1, 0, 0, 0, 0, 0, 2/3}, {0, 0, 1, 0,
0, 0, 0, 5/3}, {0, 0, 0, 1, 0, 0, 0, 2/3}, {0, 0, 0, 0, 1, 0, 0, 5/
3}, {0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 1, 7/3}}
Systems with infinitely many solutions are solved in the same
way— the computer simply returns a parametrization.
Exercises
Answers for this Topic use Maple as the computer algebra system. In particular, all of these were tested on Maple V running under MS-DOS NT version 4.0. (On all of them, the preliminary command to load the linear algebra package along with Maple's responses to the Enter key, have been omitted.) Other systems have similar commands. Template:TextBox Template:TextBox Template:TextBox Template:TextBox