Skip to content
Hub Nexus
Linear Algebra

Linear Algebra, Topic: Computer Algebra Systems

Up for GrabsUpdated 4 min read

Comments and detailsChangesSupport

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.
There are special purpose programs such as LINPACK for this job.
Another 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.

\begin{matrix}{i}_{0} & − & {i}_{1} & − & {i}_{2} & & & & & & & & & = & 0 \\ & & {i}_{1} & & & − & {i}_{3} & & & − & {i}_{5} & & & = & 0 \\ & & & & {i}_{2} & & & − & {i}_{4} & + & {i}_{5} & & & = & 0 \\ & & & & & & {i}_{3} & + & {i}_{4} & & & − & {i}_{6} & = & 0 \\ & & 5 {i}_{1} & & & + & 10 {i}_{3} & & & & & & & = & 10 \\ & & & & 2 {i}_{2} & & & + & 4 {i}_{4} & & & & & = & 10 \\ & & 5 {i}_{1} & − & 2 {i}_{2} & & & & & + & 50 {i}_{5} & & & = & 0\end{matrix}

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.

Problem 1

Use the computer to solve the two problems that opened this
chapter.

  • This is the Statics problem.

\begin{matrix}40 h + 15 c & = 100 \\ 25 c & = 50 + 50 h\end{matrix}

  • This is the Chemistry problem.

\begin{matrix}7 h & = 7 j \\ 8 h + 1 i & = 5 j + 2 k \\ 1 i & = 3 j \\ 3 i & = 6 j + 1 k\end{matrix}

Problem 2

Use the computer to solve these systems from the
first subsection,
or conclude "many solutions" or "no solutions".

  • \begin{matrix}2 x & + & 2 y & = & 5 \\ x & − & 4 y & = & 0\end{matrix}
  • \begin{matrix}− x & + & y & = & 1 \\ x & + & y & = & 2\end{matrix}
  • \begin{matrix}x & − & 3 y & + & z & = & 1 \\ x & + & y & + & 2 z & = & 14\end{matrix}
  • \begin{matrix}− x & − & y & = & 1 \\ − 3 x & − & 3 y & = & 2\end{matrix}
  • \begin{matrix} & & 4 y & + & z & = & 20 \\ 2 x & − & 2 y & + & z & = & 0 \\ x & & & + & z & = & 5 \\ x & + & y & − & z & = & 10\end{matrix}
  • \begin{matrix}2 x & & & + & z & + & w & = & 5 \\ & & y & & & − & w & = & − 1 \\ 3 x & & & − & z & − & w & = & 0 \\ 4 x & + & y & + & 2 z & + & w & = & 9\end{matrix}

Problem 3

Use the computer to solve these systems from the second subsection.

  • \begin{matrix}3 x & + & 6 y & = & 18 \\ x & + & 2 y & = & 6\end{matrix}
  • \begin{matrix}x & + & y & = & 1 \\ x & − & y & = & − 1\end{matrix}
  • \begin{matrix}{x}_{1} & & & + & {x}_{3} & = & 4 \\ {x}_{1} & − & {x}_{2} & + & 2 {x}_{3} & = & 5 \\ 4 {x}_{1} & − & {x}_{2} & + & 5 {x}_{3} & = & 17\end{matrix}
  • \begin{matrix}2 a & + & b & − & c & = & 2 \\ 2 a & & & + & c & = & 3 \\ a & − & b & & & = & 0\end{matrix}
  • \begin{matrix}x & + & 2 y & − & z & & & = & 3 \\ 2 x & + & y & & & + & w & = & 4 \\ x & − & y & + & z & + & w & = & 1\end{matrix}
  • \begin{matrix}x & & & + & z & + & w & = & 4 \\ 2 x & + & y & & & − & w & = & 2 \\ 3 x & + & y & + & z & & & = & 7\end{matrix}

Problem 4

What does the computer give for the solution of the general
{}2 \ × \ 2 system?

\begin{matrix}a x & + & c y & = & p \\ b x & + & d y & = & q\end{matrix}

Solutions

Where this page came from

This page was imported from Wikibooks. From “Linear Algebra” on Wikibooks, by its contributors, under CC BY-SA 4.0. Changed here: set as a page; navigation and edit links left out; each image under its own licence, credited in its caption.

Nobody has written it yet — it is the source material at a new address, which is why search engines are asked to skip it and why no one earns from it. It is up for grabs: take it on, and it is yours to rewrite and to earn from.