Linear Algebra/Topic: Computer Algebra Systems/Solutions

Solutions

edit

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.

Other answers will be added for Wolfram Mathematica 13.0

{{TextBox|1=

Problem 1

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

  1. This is the Statics problem.
     
  2. This is the Chemistry problem.
     
Answer
  1. The commands
    > A:=array( [[40,15],
    [-50,25]] );
    > u:=array([100,50]);
    > linsolve(A,u);

    yield the answer  . Mathematica answer
    eqns = {40 h + 15 c == 100, 25 c == 50 + 50 h};
    {b, m} = CoefficientArrays[eqns, {c, h}]
    LinearSolve[m, -b]
    {c, h} /. Solve[eqns, {c, h}]
    
    returns a vector of {1,4} for {c,h}.
  2. Here there is a free variable:
    > A:=array( [[7,0,-7,0],
    [8,1,-5,2],
    [0,1,-3,0],
    [0,3,-6,-1]] );
    > u:=array([0,0,0,0]);
    > linsolve(A,u);

    prompts the reply  . Mathematica code:
    eqns = {7 h == 7 j, 8 h + i == 5 j + 2 k, 1 i == 3 j, 
       3 i == 6 j + 1 k};
    {b, m} = CoefficientArrays[eqns, {h, i, j, k}]
    LinearSolve[m, -b]
    {h, i, j, k} /. Solve[eqns, {h, i, j, k}]
    
    returns {0,0,0,0} for LinearSolve and   for the last line

}}

Problem 2

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

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
Maple Answer

These are easy to type in. For instance, the first


> A:=array( [[2,2],
[1,-4]] );
> u:=array([5,0]);
> linsolve(A,u);

gives the expected answer of  . The others are entered similarly.

  1. The answer is   and  .
  2. The answer is   and  .
  3. This system has infinitely many solutions. In the first subsection, with   as a parameter, we got   and  . Maple responds with  , for some reason preferring   as a parameter.
  4. There is no solution to this system. When the array   and vector   are given to Maple and it is asked to linsolve(A,u), it returns no result at all, that is, it responds with no solutions.
  5. The solutions is  .
  6. There are many solutions. Maple gives  .
Mathematica Answer:
RowReduceAugmentedMatrix[matrix_] := MatrixForm[RowReduce[matrix]]
applying this function for RowReduce in MatrixForm to   yields  .
Problem 3

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

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
Answer

As with the prior question, entering these is easy.

  1. This system has infinitely many solutions. In the second subsection we gave the solution set as
     
    and Maple responds with  .
  2. The solution set has only one member
     
    and Maple has no trouble finding it  .
  3. This system's solution set is infinite
     
    and Maple gives  .
  4. There is a unique solution
     
    and Maple gives  .
  5. This system has infinitely many solutions; in the second subsection we described the solution set with two parameters
     
    as does Maple  .
  6. The solution set is empty and Maple replies to the linsolve(A,u) command with no returned solutions.
Problem 4

What does the computer give for the solution of the general   system?

 
Answer

In response to this prompting


> A:=array( [[a,c],
[b,d]] );
> u:=array([p,q]);
> linsolve(A,u);

Maple thought for perhaps twenty seconds and gave this reply.

 
Mathematica Solution
RowReduce[( {
    {a, c, p},
    {b, d, q}
   } )] // MatrixForm
returns   in about 2 milliseconds.