Skip to content

Commit 631f5c3

Browse files
committed
Fix bug 4675
1 parent 573adf9 commit 631f5c3

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

OpenProblemLibrary/NAU/setActuarial/setExamFM10.pg

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
## Institution(NAU)
66
## Author(Michael Ratliff)
77
## Level(4)
8+
## MO(1)
89
## KEYWORDS('force of interest')
910
##ENDDESCRIPTION
1011

@@ -14,29 +15,49 @@ DOCUMENT();
1415

1516
loadMacros(
1617
"PGstandard.pl",
17-
"PGchoicemacros.pl",
18+
"MathObjects.pl",
1819
"PGasu.pl",
1920
"PGcourse.pl"
2021
);
2122

22-
TEXT(&beginproblem);
23+
TEXT(beginproblem());
24+
25+
Context("Numeric");
2326

2427
$a = random(2,5,1);
2528
$b = $a + random(1,3,1);
2629

27-
$pre = 1000*(2.71828**((2*$a+$b)/100));
28-
$ans=round(100*$pre)/100;
30+
# Let V(t)=value of investment at time t, where t is
31+
# measured in years from Jan. 1, 2004. The force of interest is
32+
# delta_t = ($a + $b*t)/50 = (d/dt)ln(V(t))
33+
# so ln(V(t))-ln(V(t0)) = $a*(t-t0)/50 + $b*(t^2-t0^2)/100 and
34+
# V(t)/V(t0) = exp( $a*(t-t0)/50 + $b*(t^2-t0^2)/100 )
35+
# 2004 is a leap year: Jan. 1 - June 30 is 181 days out of 366
36+
# so t0 = 181/366 on July 1, 2004 and t = 1 on Jan. 1 2005
37+
# V(t0) = 1000 so the answer is
38+
# V(1)=1000*exp($a*(1-t0)/50 + $b*(1^2-t0^2)/100 )
39+
40+
$t0 = 181/366;
41+
$V = 1000*exp( $a*(1-$t0)/50 + $b*(1**2-$t0**2)/100 ) ;
42+
43+
# round answer to nearest cent
2944

45+
$ans = Real( round(100*$V)/100 );
3046

3147

32-
TEXT(EV2(<<EOT));
48+
#$pre = 1000*(2.71828**((2*$a+$b)/100));
49+
#$ans=round(100*$pre)/100;
3350

34-
On July 1, 2004, a person invested $DOLLAR 1,000 in a fund for which the force of interest at time \(t\) is given by \( \delta_t = \frac{$a + $b t}{50}\), where \(t\) is the number of years since January 1, 2004. Determine the accumulated value of the investment on January 1, 2005.
51+
52+
Context()->texStrings;
53+
BEGIN_TEXT
54+
55+
On July 1, 2004, a person invested ${DOLLAR}1,000 in a fund for which the force of interest at time \(t\) is given by \( \delta_t = \frac{$a + $b t}{50}\), where \(t\) is the number of years since January 1, 2004. Determine the accumulated value of the investment on January 1, 2005.
3556

3657
$BR
3758
Accumulated value of the investment = $DOLLAR \{ans_rule(20)\}
38-
EOT
39-
40-
&ANS(num_cmp($ans));
59+
END_TEXT
60+
Context()->normalStrings;
4161

62+
ANS($ans->cmp(tolerance=>2, tolType=>'absolute'));
4263
ENDDOCUMENT();

0 commit comments

Comments
 (0)