Skip to content

Commit 1e4a78e

Browse files
committed
Fix bug 4672
1 parent 4329411 commit 1e4a78e

File tree

1 file changed

+38
-27
lines changed
  • OpenProblemLibrary/Michigan/Chap17Sec1

1 file changed

+38
-27
lines changed

OpenProblemLibrary/Michigan/Chap17Sec1/Q27.pg

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,16 @@ loadMacros(
4545
);
4646

4747
Context("Numeric");
48-
Context()->variables->are( t=>'Real' );
48+
Context()->variables->add( t=>'Real' );
4949
$showPartialCorrectAnswers = 1;
5050

5151
$a = random(1,9,1);
5252
$b = non_zero_random(-5,5,1);
5353
$r = list_random(3,4);
5454
$z0 = non_zero_random(-5,5,1);
5555
$t0 = random(-3,3,1);
56-
$ycurve = ( $b < 0 ) ? "$a $b x^{$r}" : "$a + $b x^{$r}";
56+
#$ycurve = ( $b < 0 ) ? "$a $b x^{$r}" : "$a + $b x^{$r}";
57+
$ycurve = Formula("$a + $b x^{$r}")->reduce;
5758

5859
$pchk = MultiAnswer( Compute( "t-$t0" ), Compute( "$a + $b*(t-($t0))^{$r}" ),
5960
Compute( "$z0" ) )->with(
@@ -62,31 +63,41 @@ $pchk = MultiAnswer( Compute( "t-$t0" ), Compute( "$a + $b*(t-($t0))^{$r}" ),
6263
my ( $c, $s, $ans ) = @_;
6364
my ($xs, $ys, $zs) = @{$s};
6465

65-
my @ret = (0,0,0);
66-
$ret[2] = ( $c->[2] == $zs ) ? 1 : 0;
66+
if ( Formula($xs)->eval(t=>$t0) != Formula(0) or
67+
Formula($ys)->eval(t=>$t0) != Formula($a) or
68+
Formula($zs)->eval(t=>$t0) != Formula($zs) )
69+
{ $ans->setMessage(1,"Check that your parametrization passes ".
70+
"through \( (0, $a , $z0) \) when \(t = $t0\).");
71+
return (0,0,0);
72+
}
73+
if ( $xs->D(t)->eval(t=>$t0) == Formula(0) )
74+
{
75+
$ans->setMessage(1,"Check that \(x'($t0)\neq 0\)");
76+
return (0,0,0);
77+
}
78+
if ( $c->[2] != $zs )
79+
{
80+
$ans->setMessage(3,"Is your curve parallel to the \(x,y\)-plane?");
81+
return (0,0,0);
82+
}
83+
if (Compute( "$a + $b*$xs^{$r}" )!=$ys) {
84+
$ans->setMessage(2,"Your curve doesn't follow the right path.");
85+
return (1,0,1);
86+
}
87+
else { return (1,1,1);}
88+
} );
6789

68-
my $ycheck = Compute( "$a + $b*$xs^{$r}" );
6990

70-
if ( $ycheck == $ys && $xs->eval(t=>$t0) == 0 &&
71-
$ys->eval(t=>$t0) == $a ) {
72-
$ret[0] = 1;
73-
$ret[1] = 1;
74-
} elsif ( $ycheck == $ys ) {
75-
$ans->setMessage(1, 'Check that your parameterization ' .
76-
'passes through the indicated point.');
77-
}
78-
return [ @ret ];
79-
} );
8091

8192
Context()->texStrings;
8293
TEXT(beginproblem());
8394
BEGIN_TEXT
8495

85-
Find a parameterization for the
96+
Find a parameterization \( (x(t),y(t),z(t)) \) for the
8697
curve
87-
\( y = $ycurve \) that passes through the point
88-
\( (0, $a , $z0) \) when \(t = $t0\) and is parallel to
89-
the \( xy \)-plane.
98+
\( y = $ycurve \) that is parallel to
99+
the \( xy \)-plane. Your parametrized curve should pass through the point
100+
\( (0, $a , $z0) \) when \(t = $t0\), and have \(x'($t0)\neq 0\).
90101

91102
$PAR
92103
\( x(t) = \) \{ $pchk->ans_rule(35) \}, $BR
@@ -98,21 +109,21 @@ Context()->normalStrings;
98109

99110
ANS($pchk->cmp() );
100111

101-
$targ = ( $t0 == 0 ) ? "t" : Compute("t - $t0")->reduce();
102-
$s = ( $b < 0 ) ? '-' : '+';
103-
$bd = abs($b);
112+
$xtarg = Compute("t-$t0")->reduce;
113+
$ytarg = Compute("$a+$b($xtarg)^{$r}")->reduce;
114+
#$s = ( $b < 0 ) ? '-' : '+';
115+
#$bd = abs($b);
104116

105117
Context()->texStrings;
106118
SOLUTION(EV3(<<'END_SOLUTION'));
107119
$PAR SOLUTION $PAR
108-
109-
Since the curve is parallel to the \(xy\)-plane, \(z\) is constant, and
110-
since it passes through \((0,$a,$z0)\), we have \(z=$z0\). One possible answer
120+
\(z\) is constant since the curve is parallel to the \(xy\)-plane, so \(z=$z0\)
121+
since it passes through \((0,$a,$z0)\). One possible answer
111122
is
112123
\[
113-
x = $targ, \quad y = $a $s $bd ($targ)^{$r}, \quad z=$z0,
124+
x = $xtarg, \quad y = $ytarg, \quad z=$z0,
114125
\]
115-
which passes through the indicated point when \(t = $t0\).
126+
which passes through the indicated point, with \(x'($t0)=1\).
116127

117128
END_SOLUTION
118129
Context()->normalStrings;

0 commit comments

Comments
 (0)