[npl] / trunk / NationalProblemLibrary / ASU-topics / set119LinearSystems / p24.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/ASU-topics/set119LinearSystems/p24.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 101 - (download) (annotate)
Wed Feb 22 20:38:15 2006 UTC (7 years, 2 months ago) by jjholt
File size: 3487 byte(s)
Tags as of Feb 22, 2006.
--JH

    1 ## DESCRIPTION
    2 ## Systems of Linear Equations
    3 ## ENDDESCRIPTION
    4 
    5 ## KEYWORDS('Algebra' 'Linear Equations' 'Matrix' 'Matrices')
    6 ## Tagged by tda2d
    7 
    8 ## DBsubject('Algebra')
    9 ## DBchapter('Systems of Equations and Inequalities')
   10 ## DBsection('Systems of Linear Equations')
   11 ## Date('')
   12 ## Author('')
   13 ## Institution('ASU')
   14 ## TitleText1('')
   15 ## EditionText1('')
   16 ## AuthorText1('')
   17 ## Section1('')
   18 ## Problem1('')
   19 
   20 DOCUMENT();        # This should be the first executable line in the problem.
   21 
   22 loadMacros(
   23 "PGasu.pl",
   24 "PG.pl",
   25 "PGbasicmacros.pl",
   26 "PGchoicemacros.pl",
   27 "PGanswermacros.pl",
   28 "PGgraphmacros.pl",
   29 "PGauxiliaryFunctions.pl",
   30 "extraAnswerEvaluators.pl"
   31 
   32 );
   33 
   34 TEXT(&beginproblem);
   35 $showPartialCorrectAnswers = 0;
   36 install_problem_grader(~~&std_problem_grader);
   37 
   38 $a11=non_zero_random(-6,6,2);
   39 $a12=non_zero_random(-5,5,1);
   40 $a13=random(-5,5,2);
   41 $a21=random(-5,5,2);
   42 $a22=non_zero_random(-6,6,2);
   43 $a23=non_zero_random(-6,6,2);
   44 $a31=non_zero_random(-6,6,1);
   45 $a32=random(-5,5,2);
   46 $d = $a21*$a32-$a22*$a31;
   47 do {$a33=non_zero_random(-6,6,2);} until
   48 ($a11*($a22*$a33-$a23*$a32)-$a12*($a21*$a33-$a23*$a31)+$a13*$d != 0);
   49 
   50 $x=random(-5,5,1);
   51 $y=random(-5,5,1);
   52 $z=random(-5,5,1);
   53 
   54 $b1 = $a11*$x + $a12*$y + $a13*$z;
   55 $b2 = $a21*$x + $a22*$y + $a23*$z;
   56 $b3 = $a31*$x + $a32*$y + $a33*$z;
   57 
   58 $NO_SPACE = '@{}';
   59 
   60 $ls1 = nicestring([$a11,$a12,$a13],['x','y','z']);
   61 $ls2 = nicestring([$a21,$a22,$a23],['x','y','z']);
   62 $ls3 = nicestring([$a31,$a32,$a33],['x','y','z']);
   63 
   64 $mc = new_multiple_choice();
   65 $mc->qa("How many solutions are there to this system?",
   66 "Exactly 1");
   67 $mc->makeLast("None",
   68 "Exactly 1",
   69 "Exactly 2",
   70 "Exactly 3",
   71 "Infinitely many",
   72 "None of the above");
   73 
   74 BEGIN_TEXT
   75 $PAR
   76 Solve the system using matrices (row operations) $BR
   77 \[ \left\{ "\{"; \}
   78 \begin{array}{r${NO_SPACE}r${NO_SPACE}}
   79                $ls1 &= $b1 \cr
   80           $ls2 &= $b2 \cr
   81                $ls3&= $b3
   82 \end{array}\right. \]
   83 
   84 \{ $mc->print_q() \}
   85         $PAR
   86 \{ $mc->print_a() \}
   87 $BR
   88 END_TEXT
   89 ANS(radio_cmp($mc->correct_ans));
   90 
   91 $ans1 = $inputs_ref->{AnSwEr1};
   92 if(defined($ans1)) {
   93   if($ans1 eq "D") {
   94 TEXT("${BBOLD}Note:$EBOLD
   95 each solution to this system is an ordered triplet with three coordinates.  Together,
   96 the three coordinates make one solution.  Having exactly three solutions is
   97 not possible.");
   98  } elsif($ans1 eq "C") {
   99 TEXT("${BBOLD}Note:$EBOLD
  100 it is not possible for a linear system of equations to ever have exactly 2 solutions.");
  101  }}
  102 
  103 
  104 BEGIN_TEXT
  105 
  106 $HR
  107 
  108 $BR
  109 If there is one solution, give its coordinates in the answer spaces below.
  110 $PAR
  111 If there
  112 are infinitely many solutions, enter ${BITALIC}z$EITALIC in the answer blank for \(z\),
  113 enter a formula for \(y\) in terms of \(z\) in the answer blank for \(y\) and
  114 enter a formula for \(x\) in terms of \(z\) in the answer blank for \(x\).
  115 $PAR
  116 If there are no solutions, leave the answer blanks for \(x\), \(y\) and \(z\) empty.
  117 $BR$BR
  118 \(x = \) \{ans_rule(40) \}
  119 $BR$BR
  120 \(y = \) \{ans_rule(40) \}
  121 $BR$BR
  122 \(z = \) \{ans_rule(40) \}
  123 
  124 END_TEXT
  125 
  126 # we use fun_cmp so it doesn't give a syntax error if they try functions
  127 # it still works since we are comparing to a "constant" function, which
  128 # is the same as comparing to a number
  129 
  130 ANS(fun_cmp("$x",vars=>["z"]));
  131 ANS(fun_cmp("$y",vars=>["z"]));
  132 ANS(fun_cmp("$z",vars=>["z"]));
  133 
  134 # If there were no solutions, we would use
  135 # ANS(auto_right("this answer can be left blank"));
  136 # ANS(auto_right("this answer can be left blank"));
  137 
  138 ENDDOCUMENT();        # This should be the last executable line in the problem.
  139 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9