[npl] / trunk / NationalProblemLibrary / Rochester / setDiffEQ7Exact / ur_de_7_6.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/Rochester/setDiffEQ7Exact/ur_de_7_6.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2977 - (download) (annotate)
Wed May 9 16:59:19 2012 UTC (12 months, 1 week ago) by jj
File size: 2016 byte(s)
Fixed bug 2351

    1 ## DESCRIPTION
    2 ## Calculus
    3 ## ENDDESCRIPTION
    4 
    5 ## KEYWORDS('differential equation' 'exact')
    6 ## Tagged by tda2d
    7 
    8 ## DBsubject('Calculus')
    9 ## DBchapter('Differential Equations')
   10 ## DBsection('Exact Equations')
   11 ## Date('')
   12 ## Author('')
   13 ## Institution('Rochester')
   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 "PG.pl",
   24 "PGbasicmacros.pl",
   25 "PGanswermacros.pl",
   26 "MathObjects.pl",
   27 ) ;
   28 
   29 TEXT(beginproblem()) ;
   30 $showPartialCorrectAnswers = 1 ;
   31 
   32 Context('Numeric')->variables->add(y=>'Real');
   33 
   34 BEGIN_TEXT
   35 
   36 Check that the equation below is not exact but becomes exact when multiplied by the
   37 integrating factor.
   38 $BR
   39 \[x^2y^3+x(1+y^2)y'=0 \]
   40 Integrating factor: \(\mu(x,y) = 1/(xy^3)  \).
   41 $BR
   42 $BR
   43 Solve the differential equation.
   44 You can define the solution curve implicitly by a function in the form
   45 \(F(x,y) = G(x) + H(y) =K \) for some constant \(K\).
   46 $BR$BR
   47 \(F(x,y) = \) \{ ans_rule(30) \}
   48 
   49 END_TEXT
   50 
   51 # Can input a root, which defaults to [0,0], and another point
   52 #  which defaults to [2,1]
   53 sub lcc {
   54   my ( $correct, $student, $anshash) = @_;
   55   my %ah = %{ $anshash };
   56   my $root = $ah{root};
   57   $root = [0,0] unless defined($root);
   58   my $other = $ah{other};
   59   $other = [2,1] unless defined($other);
   60   my $const = $student->eval(x=>$root->[0], y=>$root->[1]);
   61   $student = $student-$const;
   62   if($student== 0) {
   63     Value::Error("The function cannot be constant");
   64     return 0;
   65   }
   66   my $c1 = $student->eval(x=>$other->[0], y=>$other->[1])/
   67     $correct->eval(x=>$other->[0], y=>$other->[1]);
   68   return 0 if $c1 == 0;
   69   $student = $student/$c1;
   70   return $correct == $student;
   71 }
   72 
   73 
   74 
   75 ANS(Compute("x^2/2-y^(-2)/2 + ln(y)")->cmp(checker=>~~&lcc,
   76   root=>[1,1], other=>[2,1]));
   77 
   78 #ANS(level_curve_check(
   79 #  FEQ("-(y^3*x)/(1+y^2)"),
   80 #  FEQ("x^2/2-y^(-2)/2 + ln(y)"),initial_t=>1,initial_y=>1,tol=>.0001) );
   81 
   82 
   83 ENDDOCUMENT() ;        # This should be the last executable line in the problem.
   84 
   85 
   86 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9