[npl] / trunk / NationalProblemLibrary / Rochester / setDiffEQ13Systems1stOrder / ur_de_13_10.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/Rochester/setDiffEQ13Systems1stOrder/ur_de_13_10.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 184 - (download) (annotate)
Fri Apr 28 13:46:21 2006 UTC (7 years ago) by jjholt
File size: 2059 byte(s)
Added tags.  --JH

    1 ## DESCRIPTION
    2 ## Calculus
    3 ## ENDDESCRIPTION
    4 
    5 ## KEYWORDS('differential equation' 'first order' 'matrices')
    6 ## Tagged by tda2d
    7 
    8 ## DBsubject('Calculus')
    9 ## DBchapter('Differential Equations')
   10 ## DBsection('Systems of Differential Equations')
   11 ## Date('')
   12 ## Author('')
   13 ## Institution('Rochester')
   14 ## TitleText1('')
   15 ## EditionText1('')
   16 ## AuthorText1('')
   17 ## Section1('')
   18 ## Problem1('')
   19 
   20 
   21 DOCUMENT();        # This should be the first executable line in the problem.
   22 
   23 loadMacros(
   24 "PG.pl",
   25 "PGbasicmacros.pl",
   26 "PGchoicemacros.pl",
   27 "PGanswermacros.pl",
   28 "PGgraphmacros.pl",
   29 "PGmatrixmacros.pl",
   30 "PGnumericalmacros.pl",
   31 "PGauxiliaryFunctions.pl",
   32 "PGmorematrixmacros.pl"
   33 );
   34 
   35 TEXT(beginproblem());
   36 $showPartialCorrectAnswers = 1;
   37 
   38 $v11 = random(1,3,2);
   39 $v21 = random(1,2,1);
   40 $v12 = 3 - $v21;
   41 $v22 = 4 - $v11;
   42 
   43 $S = new Matrix(2,2);
   44 $S -> assign(1,1,$v11);
   45 $S -> assign(1,2,$v12);
   46 $S -> assign(2,1,$v21);
   47 $S -> assign(2,2,$v22);
   48 
   49 $Sinv = new Matrix(2,2);
   50 $Sinv -> assign(1,1, $v22);
   51 $Sinv -> assign(1,2, - $v12);
   52 $Sinv -> assign(2,1, - $v21);
   53 $Sinv -> assign(2,2, $v11);
   54 
   55 $eig1 = random(2,5,1) * random(-1,1,2);
   56 $eig2 = random(2,5,1) * random(-1,1,2);
   57 if ($eig2 == $eig1) { $eig2 = - $eig2; }
   58 
   59 $e = new Matrix(2,2);
   60 $e -> assign(1,1,$eig1);
   61 $e -> assign(1,2,0);
   62 $e -> assign(2,1,0);
   63 $e -> assign(2,2,$eig2);
   64 
   65 $c1 = non_zero_random(-5,5,1);
   66 $c2 = non_zero_random(-5,5,1);
   67 
   68 $M = new Matrix(2,2);
   69 $M = $S * $e * $Sinv;
   70 
   71 $rhs = new Matrix(2,1);
   72 $rhs -> assign(1,1, $c1*$v11 + $c2*$v12);
   73 $rhs -> assign(2,1, $c1*$v21 + $c2*$v22);
   74 
   75 
   76 BEGIN_TEXT
   77 
   78 Solve the system
   79 $BR
   80 \{ mbox( "\( \displaystyle \frac{dx}{dt} = \)", display_matrix($M), "\(x\)" ) \}
   81 $BR
   82 with the initial value \{ mbox( "\( x(0) = \)", display_matrix($rhs), "." ) \}
   83 $BR
   84 \{ mbox( "\( x(t) = \)", answer_matrix(2,1,40), "." ) \}
   85 
   86 END_TEXT
   87 
   88 $ans1 = "$c1*e^($eig1*t)*$v11 + $c2*e^($eig2*t)*$v12";
   89 $ans2 = "$c1*e^($eig1*t)*$v21 + $c2*e^($eig2*t)*$v22";
   90 
   91 ANS(fun_cmp($ans1, vars => 't'));
   92 ANS(fun_cmp($ans2, vars => 't'));
   93 
   94 ENDDOCUMENT();       # This should be the last executable line in the problem.
   95 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9