Linear Algebra/Topic: Computer Algebra Systems/Solutions
Solutions
editAnswers 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.
- This is the Statics problem.
- This is the Chemistry problem.
- Answer
- The commands
> A:=array( [[40,15],
[-50,25]] );
> u:=array([100,50]);
> linsolve(A,u);
yield the answer . Mathematica answerreturns a vector of {1,4} for {c,h}.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}]
- 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:returns {0,0,0,0} for LinearSolve and for the last lineeqns = {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}]
}}
- Problem 2
Use the computer to solve these systems from the first subsection, or conclude "many solutions" or "no solutions".
- 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.
- The answer is and .
- The answer is and .
- 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.
- 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.
- The solutions is .
- There are many solutions. Maple gives .
RowReduceAugmentedMatrix[matrix_] := MatrixForm[RowReduce[matrix]]
- Problem 3
Use the computer to solve these systems from the second subsection.
- Answer
As with the prior question, entering these is easy.
- This system has infinitely many solutions.
In the second subsection we gave the solution set as
- The solution set has only one member
- This system's solution set is infinite
- There is a unique solution
- This system has infinitely many solutions; in the
second subsection we described the solution set with
two parameters
- 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
- returns in about 2 milliseconds.
RowReduce[( { {a, c, p}, {b, d, q} } )] // MatrixForm