Linear Algebra/Topic: Computer Algebra Systems/Solutions

From testwiki
Jump to navigation Jump to search

Solutions

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.
    40h+15c=10025c=50+50h
  2. This is the Chemistry problem.
    7h=7j8h+1i=5j+2k1i=3j3i=6j+1k
Answer
  1. The commands
    > A:=array( [[40,15],
    [-50,25]] );
    > u:=array([100,50]);
    > linsolve(A,u);

    yield the answer [1,4]. 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 [_t1,3_t1,_t1,3_t1]. 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 {{h,3h,3h,3h}} for the last line

}} Template:TextBox Template:TextBox Template:TextBox

Template:BookCat