text: # DESCRIPTION
  # Converting a system of equations to a vector equation.
  # ENDDESCRIPTION
  
  ##\{ textbook_ref_exact("Holt Linear Algebra", "2.1","12") \}
  ## DBsubject(Linear algebra)
  ## DBchapter(Systems of linear equations)
  ## DBsection(Vector equations)
  ## Institution(Saint Louis University)
  ## Author(Mike May)
  ## MLT(ConvertSysToVectEqn)
  ## MLTleader(1)
  ## Level(2)
  ## TitleText1('Linear Algebra')
  ## AuthorText1('Holt')
  ## EditionText1('')
  ## Section1('2.1')
  ## Problem1('12')
  ## KEYWORDS('linear algebra','vectors')
  
  DOCUMENT();
  loadMacros(
    "PGstandard.pl",
    "PGchoicemacros.pl",
    "PGgraphmacros.pl",
    "PGmatrixmacros.pl",
    "PGnumericalmacros.pl",
    "PGmorematrixmacros.pl",
    "MathObjects.pl",
    "freemanMacros.pl",
    "PGasu.pl",
    "PGcourse.pl"
  );
  
  # make sure we're in the context we want
  Context("Numeric");
  $v11=random(1,9,1);
  $v12=random(-9,9,1);
  $v13=random(-9,9,1);
  $v21=random(-9,9,1);
  $v22=random(1,9,1);
  $v23=random(-9,9,1);
  if($v11*$v22==$v12*$v21){$v22=-$v22;}
  $v31=random(1,9,1)*random(-1,1,2);
  $v32=random(-9,9,1);
  $v33=random(1,9,1);
  if($v11*$v22*$v33+$v21*$v32*$v13+$v31*$v12*$v23-$v13*$v22*$v31-$v23*$v32*$v11-$v33*$v12*$v21==0){$v33=-$v33;}
  $v41=random(1,9,1)*random(-1,1,2);
  $v42=random(1,9,1)*random(-1,1,2);
  $v43=random(1,9,1)*random(-1,1,2);
  
  $a1=random(1,9,1);
  $a2=random(1,9,1)*random(-1,1,2);
  $a3=random(1,9,1)*random(-1,1,2);
  
  $a=($v42-$a2*$v22-$a3*$v32)/$a1;
  $b=($v41-$a1*$v11-$a2*$v21)/$a3;
  
  $m[1][1]=$v11;
  $m[1][2]=$v12;
  $m[1][3]=$v13;
  $m[2][1]=$v21;
  $m[2][2]=$v22;
  $m[2][3]=$v23;
  $m[3][1]=$v31;
  $m[3][2]=$v32;
  $m[3][3]=$v33;
  $m[4][1]=$v41;
  $m[4][2]=$v42;
  $m[4][3]=$v43;
  
  
  
  TEXT(beginproblem());
  $showPartialCorrectAnswers = 1;
  BEGIN_TEXT
  \{ textbook_ref_exact("Holt Linear Algebra", "2.1","12") \} 
  $PAR
  Express the following system of linear equations as a vector equation. 
  $PAR
  \[$v11 x_1 + $v21 x_2 + $v31 x_3 = $v41\] 
  $PAR
  \[$v12 x_1 + $v22 x_2 + $v32 x_3 = $v42\] 
  $PAR
  \[$v13 x_1 + $v23 x_2 + $v33 x_3 = $v43\] 
  $PAR
  $PAR
  \{ mbox( 
  display_matrix([[ans_rule(5)],[ans_rule(5)],[ans_rule(5)]]), '\(x_1 +\) ', 
  display_matrix([[ans_rule(5)],[ans_rule(5)],[ans_rule(5)]]), '\(x_2 +\)', 
  display_matrix([[ans_rule(5)],[ans_rule(5)],[ans_rule(5)]]), '\(x_3 =\)', 
  display_matrix([[ans_rule(5)],[ans_rule(5)],[ans_rule(5)]]) 
  ) \}
  $PAR
  END_TEXT
  Context()->normalStrings;
  
  $showPartialCorrectAnswers = 1;
  
  foreach $i (0..3) {
  
     foreach $j (0..2) {
     		ANS(num_cmp($m[$i+1][$j+1])  );
     	}
  }
  
  
  Context()->texStrings;
  SOLUTION(EV3(<<'END_SOLUTION'));
  $PAR 
  SOLUTION 
  $PAR
  
  \[
  \left[\begin{matrix} $v11 \cr $v12 \cr $v13 \cr \end{matrix} \right] x_1+
  \left[\begin{matrix} $v21 \cr $v22 \cr $v23 \cr \end{matrix} \right] x_2+
  \left[\begin{matrix} $v31 \cr $v32 \cr $v33 \cr \end{matrix} \right] x_3=
  \left[\begin{matrix} $v41 \cr $v42 \cr $v43 \cr \end{matrix} \right]
  \]
  
  
  END_SOLUTION
  Context()->normalStrings;
  
  ENDDOCUMENT();
  