-
-
Notifications
You must be signed in to change notification settings - Fork 436
Expand file tree
/
Copy pathjj2.pg
More file actions
138 lines (114 loc) · 4.04 KB
/
Copy pathjj2.pg
File metadata and controls
138 lines (114 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
## DESCRIPTION
## Precalculus: Exponential and Logarithm Functions
## ENDDESCRIPTION
## Tagged by cmd6a 3/12/06
## DBsubject(Financial mathematics)
## DBchapter(Interest)
## DBsection(Compound interest)
## Institution(ASU)
## Level(4)
#
# First comes some stuff that appears at the beginning of every problem
#
DOCUMENT(); # This should be the first executable line in the problem.
loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"PGasu.pl",
"PGgraphmacros.pl",
"PGcourse.pl"
);
TEXT(beginproblem());
#
# Now we do the randomization of variables, and other computations
# as needed for this problem. Sometimes we compute the answers here.
#
$a = random(3000,6000,1000);
$rt = random(6,9);
$b = random(0,1);
if($b) {
($tword, $t) = ("semiannually", 2);
} else {
($tword, $t) = ("quarterly", 4);
}
$targ = random(15, 40, 5);
$ans3 = ln($targ*1000/$a)/(ln(1+$rt/(100*$t))*$t);
$xd = 1.1*$ans3+10;
$xd = int($xd/10)+1;
$xd *= 10;
$xdl = -0.05*$ans3;
$ydl = -30*$targ;
$gr = init_graph($xdl, $ydl, $xd, $targ*1200, 'axes'=>[0,0]);
$gr2 = init_graph($xdl, $ydl, $xd, $targ*1200, 'axes'=>[0,0]);
$gr3 = init_graph($xdl, $ydl, $xd, $targ*1200, 'axes'=>[0,0]);
$gr4 = init_graph($xdl, $ydl, $xd, $targ*1200, 'axes'=>[0,0]);
$corrans = "$a*(1+$rt/(100*$t))^($t* x)";
$inc1 = "($a)*(1+$rt/(100*$t))^($t* x)-$a";
$inc2 = "$a*(1+$rt/(100*$t))^(-$t* x)";
$inc3 = "$a*(1+$rt/(100*$t))^($t* x*2)";
$f1 = FEQ("$corrans for x in <$xdl, $xd> using color:blue and weight:2");
($fig1) = plot_functions($gr, $f1);
($fig1) = plot_functions($gr2,
FEQ("$inc1 for x in <$xdl, $xd> using color:blue and weight:2")
);
($fig1) = plot_functions($gr3,
FEQ("$inc2 for x in <$xdl, $xd> using color:blue and weight:2")
);
($fig1) = plot_functions($gr4,
FEQ("$inc3 for x in <$xdl, $xd> using color:blue and weight:2")
);
$lab = new Label(0, $a, "$a",'black','left');
$gr->lb($lab);
$gr2->lb($lab);
$gr3->lb($lab);
$gr4->lb($lab);
$mc = new_multiple_choice();
$mc->qa("Make a graph of \(A(t)\). Which graph most closely resembles the graph of \(A(t)\)?".
"$BR $BBOLD Note:$EBOLD you can click on the graphs to get a larger view.$BR$BR".
"Each graph goes to $xd on the \(x\)-axis and ".($targ*1200)." on the \(y\)-axis.$BR$BR",
image(insertGraph($gr),
alt=>"Graph of exponential growth starting at y = $a, curving upward with increasing steepness as x approaches $xd."
));
$mc->extra(image(insertGraph($gr2),
alt=>"Exponential growth curve starting at y = $a, increasing and concave up as x increases to $xd."
),
image(insertGraph($gr3),
alt=>"Graph of exponential growth function A(t) starting at initial value and increasing with upward concavity over time."
),
image(insertGraph($gr4),
alt=>"Exponential growth curve starting at initial value, increasing and concave up, representing compound interest over time."
));
#
# Now the problem text itself, with ans_rule's to indicate where the
# answers go. You can stop entering text, do more computations, and then
# start up again if you want.
#
BEGIN_TEXT
An amount of ${DOLLAR}$a is invested at an interest rate of $rt$PERCENT per
year, compounded $tword.
$BR$BR
Find the value \(A(t)\) of the investment after \(t\) years.
$BR$BR
\(A(t) = \) \{ans_rule(40)\} dollars
$BR$BR
$BBOLD Note:$EBOLD remember to express your function in the variable \(t\).
$BR$BR
\{ $mc->print_q() \}
\{ $mc->print_a() \}
$BR$BR
Use $BITALIC your$EITALIC graph of \(A(t)\) to determine when this investment
will amount to ${DOLLAR}$targ,000. Give your answer in years, correct to the nearest
hundredth. You will have to zoom on your graph to determine the answer.
$BR$BR
\{ans_rule(40)\} years
END_TEXT
#
# Tell WeBWork how to test if answers are right. These should come in the
# same order as the answer blanks above. You tell WeBWork both the type of
# "answer evaluator" to use, and the correct answer.
#
ANS(fun_cmp("$a*(1+$rt/(100*$t))^($t* t)", var=>['t']));
ANS(radio_cmp($mc->correct_ans));
ANS(num_cmp("ln($targ*1000/$a)/(ln(1+$rt/(100*$t))*$t)", tolType=>'absolute',
tol=>'0.0051'));
ENDDOCUMENT(); # This should be the last executable line in the problem.