DOCUMENT() ; loadMacros( "PGstandard.pl", "MathObjects.pl", "PGML.pl" ); Context("Numeric"); Context()->variables->add(a => 'Parameter'); Context()->variables->add(b => 'Parameter'); Context()->variables->add(t => 'Real'); # roots of the characteristic equation $r1 = -1; $r2 = -3; $a = -($r1+$r2); $b = $r1*$r2; # elements of the target function $c = -19; $d = 4; # Looking for this particular solution: # (-0.542857*t+0.186122)*e^(4*t) $den = ($d)**2 + $d*$a + $b; $A = $c/$den; $B = -($A * (2*$d + $a))/ $den; $yh = Formula("a*e^($r1*t) + b*e^($r2*t)")->reduce; $yp = Formula("($A * t + $B) * e^($d*t) "); $ans = $yp+$yh; # Using this line, correct answer $yp is rejected. TEXT(beginproblem()) ; BEGIN_PGML DEBUG: r1=[$r1], r2=[$r2], c=[$c], d=[$d]. Find a particular solution to [``\qquad y'' + [$a]y' + [$b]y = [$c]t e^{[$d]t} . ``] ANSWER: [`\quad y_{p}(t) =\ `][__________________________________________________]{$ans} END_PGML ENDDOCUMENT() ;