@@ -43,18 +43,22 @@ $a=non_zero_random(-8,8,1);
43
43
# If the answer is tested at random values of x and y
44
44
# a student might substitute cos(y)->x/a in the
45
45
# implicit solution and have it marked "incorrect"
46
- # so we'll numerically generate a series of test points along the
47
- # implicit curve and test it on those points.
46
+ # so we'll generate 8 test points along the
47
+ # implicit curve x=a*y*sec(y) and test it on those points.
48
48
49
49
$ans=Formula("-cos(y)*([2*$a*sin(y)+x*(1+sin(y)^2)]/($a+x*sin(y))^3)")->reduce;
50
50
51
- $ans->{test_points} = [ [0,0],
52
- [$a*0.2, 0.19616428118783816 ],[-$a*0.2, -0.19616428118783816 ],
53
- [$a*0.4, 0.37255949583211007], [-$a*0.4, -0.37255949583211007],
54
- [$a*0.6, 0.5205326392380185], [-$a*0.6, -0.5205326392380185],
55
- [$a*0.8, 0.641134282813549], [-$a*0.8, -0.641134282813549],
56
- [$a, 0.7390851332151331 ], [-$a, -0.7390851332151331 ]
57
- ];
51
+ # 8 test points between y=-pi/3 and y=pi/3
52
+
53
+ @test_pts = ();
54
+ $inc = pi/12;
55
+ for ($i=0; $i<9; $i++){
56
+ $y = -pi/3+$i*$inc;
57
+ $x = $a*$y*sec($y);
58
+ push(@test_pts,[$x,$y]);
59
+ }
60
+
61
+ $ans->{test_points} = @test_pts;
58
62
59
63
###################################
60
64
# Main text
0 commit comments