# Connor Fields and John Choate
# Related Rates: Filling a Cone
# Math 151 Honors Texas A&M University
# Fall 2011
# Instructor: Dr. Phillip Yasskin
restart:
with(Maplets[Tools]): with(Maplets[Elements]): with(plots): with(plottools):
StartEngine();
randomize():
randR:=rand(2..6):
randHscale:=rand(1..3):
hfracs:=[1/2, 1/3,2/3,3/4,2/5,3/5,4/5]:
randhfrac:=rand(1..7):
randDV:=rand(2..5):
NewProblem:=proc()
global r1,V1,DV1,Dh1;
local R,H,h0,DV, r0,Cbig,i,t,Clittle,Tlittle,p,ConeMovie;
R:=randR();
H:=randHscale()*R;
h0:=hfracs[randhfrac()]*H;
DV:=randDV();
Set(TBProb=sprintf("Water is poured at a rate of\n dV/dt = %a cm^3/sec\ninto a cone with vertex is at the bottom whose\n height is H = %a cm\nand\n radius is R = %a cm.\nWhat is the rate of change in water level when the\n depth is h = %a cm?", DV, H, R, h0));
r1:=R/H*h;
V1:=1/3*Pi*r1^2*h;
DV1:=diff(V1,h)*dh/dt;
Dh1:=DV/eval(diff(V1,h),h=h0);
r0:=R/H*h0;
Cbig:=cone([0, 0, 0], R, H, color = "Tan", transparency=.5, grid=[25,2]):
for i from 1 to 10 do
t:=i/10; (* H/R* *)
Clittle:=cone([0, 0, 0], t*r0, t*h0, color = "Aqua", transparency=.5, grid=[25,2]):
Tlittle:=cone([0, 0, t*h0], t*r0, t*h0/100, color = "Aqua", transparency=.5, grid=[25,2]):
p[i]:=display([Cbig,Clittle,Tlittle], orientation=[45,80], axes=normal,
tickmarks=[[-R,R],[-R,R],[0,H]]);
end do:
ConeMovie:=display([seq(p[i],i=1..10)], insequence=true);
Set(PCone=ConeMovie);
Set(TFr=" ");
Set(TFV=" ");
Set(TFDV=" ");
Set(TFDh=" ");
Set(replyr=" ", replyr(background)=white);
Set(replyV=" ", replyV(background)=white);
Set(replyDV=" ", replyDV(background)=white);
Set(replyDh=" ", replyDh(background)=white);
Set(reply=" ", reply(background)=white);
end proc:
Hintr:=proc()
Set(reply="Use similar triangles and ratios to find r in terms of R, H and h. Do not plug in numbers.",
reply(background)="Orange", reply(foreground)=black);
end proc:
HintV:=proc()
Set(reply="Plug r in terms of h into the volume of the cone to get a formula in terms of only h.",
reply(background)="Orange", reply(foreground)=black):
end proc:
HintDV:=proc()
Set(reply="Take the derivative of the volume equation previously determined above. Remember to use the chain rule.",
reply(background)="Orange", reply(foreground)=black):
end proc:
HintDh:=proc()
Set(reply="Solve the equation determined above for dh/dt and evaluate using the given numbers.",
reply(background)="Orange", reply(foreground)=black):
end proc:
Checkr:=proc()
global R,H,h0,DV,r1,V1,DV1,Dh1;
local user_r;
user_r:=Get(TFr::algebraic, corrections=true, update=true):
if user_r=r1 then
Set(replyr="Correct",
replyr(background)=green, replyr(foreground)=black);
Set(reply="Great Job! You rock!",
reply(background)=green, reply(foreground)=black);
else
Set(replyr="Incorrect",
replyr(background)=red, replyr(foreground)=white);
Set(reply="I'm sorry. You're not correct. Click hint to get a tip on completing this problem.",
reply(background)=red, reply(foreground)=white);
end if;
end proc:
CheckV:=proc()
global R,H,h0,DV,r1,V1,DV1,Dh1;
local user_V;
user_V:=Get(TFV::algebraic, corrections=true, update=true):
if user_V=V1 then
Set(replyV="Correct",
replyV(background)=green, replyV(foreground)=black);
Set(reply="Great Job! You rock!",
reply(background)=green, reply(foreground)=black);
else
Set(replyV="Incorrect",
replyV(background)=red, replyV(foreground)=white);
Set(reply="I'm sorry. You're not correct. Click hint to get a tip on completing this problem.",
reply(background)=red, reply(foreground)=white);
end if;
end proc:
CheckDV:=proc()
global R,H,h0,DV,r1,V1,DV1,Dh1;
local user_DV;
user_DV:=Get(TFDV::algebraic, corrections=true, update=true):
if user_DV=DV1 then
Set(replyDV="Correct",
replyDV(background)=green, replyDV(foreground)=black);
Set(reply="Great Job! You rock!",
reply(background)=green, reply(foreground)=black);
elif user_DV*dh/dt=DV1 then
Set(replyDV="Incorrect",
replyDV(background)=red, replyDV(foreground)=white);
Set(reply="It appears you forgot the dh/dt required by the chain rule. Fix it and check it again.",
reply(background)=red, reply(foreground)=white);
else
Set(replyDV="Incorrect",
replyDV(background)=red, replyDV(foreground)=white);
Set(reply="I'm sorry. You're not correct. Click hint to get a tip on completing this problem.",
reply(background)=red, reply(foreground)=white);
end if;
end proc:
CheckDh:=proc()
global R,H,h0,DV,r1,V1,DV1,Dh1;
local user_Dh;
user_Dh:=Get(TFDh::algebraic, corrections=true, update=true):
if user_Dh=Dh1 then
Set(replyDh="Correct",
replyDh(background)=green, replyDh(foreground)=black);
Set(reply="Great Job! You rock!",
reply(background)=green, reply(foreground)=black);
else
Set(replyDh="Incorrect",
replyDh(background)=red, replyDh(foreground)=white);
Set(reply="I'm sorry. You're not correct. Click hint to get a tip on completing this problem.",
reply(background)=red, reply(foreground)=white);
end if;
end proc:
Showr:=proc()
global r1,V1,DV1,Dh1;
Set(TFr=r1):
Set(replyr="Shown",
replyr(background)=yellow, replyr(foreground)=black):
Set(reply="Read the hint and try again.",
reply(background)=yellow, reply(foreground)=black);
end proc:
ShowV:=proc()
global R,H,h0,DV,r1,V1,DV1,Dh1;
Set(TFV=V1):
Set(replyV="Shown",
replyV(background)=yellow, replyV(foreground)=black):
Set(reply="Read the hint and try again.",
reply(background)=yellow, reply(foreground)=black);
end proc:
ShowDV:=proc()
global R,H,h0,DV,r1,V1,DV1,Dh1;
Set(TFDV=DV1):
Set(replyDV="Shown",
replyDV(background)=yellow, replyDV(foreground)=black):
Set(reply="Read the hint and try again.",
reply(background)=yellow, reply(foreground)=black);
end proc:
ShowDh:=proc()
global R,H,h0,DV,r1,V1,DV1,Dh1;
Set(TFDh=Dh1):
Set(replyDh="Shown",
replyDh(background)=yellow, replyDh(foreground)=black):
Set(reply="Read the hint and try again.",
reply(background)=yellow, reply(foreground)=black);
end proc:
RelatedRates:=Maplet(onstartup = RunWindow(MAIN),
Window[MAIN](title="Related Rates: Filling a Cone",
[
[ halign=none,
Button("New Problem", Evaluate(function="NewProblem"), background=magenta),
HorizontalGlue(),
Button("Quit", Shutdown(), background=pink)
],
[ halign=none,
[ border=true, halign=none,
caption="Problem Statement",
TextBox[TBProb]("Water is poured at a rate of\n dV/dt = __ cm^3/sec\ninto a cone with vertex is at the bottom whose\n height is H = __ cm\nand\n radius is R = __ cm.\nWhat is the rate of change in water level when the\n depth is h = __ cm?", width=30, height=11)
],
[ halign=none, valign=none, border=true,
caption="Animation",
[ Button[BPlay]("Play", onclick=SetOption(PCone(play)=true),
background=tan, foreground=black),
Button[BPause]("Pause", onclick=SetOption(PCone(pause)=true),
background=tan, foreground=black),
Button[BForward]("Forward",
onclick=Action(SetOption(PCone(pause)=true),
SetOption(PCone(frame_forward)=true)),
background=tan, foreground=black),
Button[BReverse]("Reverse",
onclick=Action(SetOption(PCone(pause)=true),
SetOption(PCone(frame_backwards)=true)),
background=tan, foreground=black)
],
[ background=tan,
Plotter[PCone](plot0, width=200, height=200, delay =200)
]
]
],
[ border=true, halign=none,
caption="Step 1: Express r in terms of h:",
"r =",
TextField[TFr](width=15, background=turquoise),
HorizontalGlue(),
Button("Hint", Evaluate(function="Hintr"), background="Orange"),
Button("Check", Evaluate(function = "Checkr"), background=green),
TextField[replyr](width=6, editable=false, background=white),
Button("Show", Evaluate(function = "Showr"), background=yellow)
],
[ border=true,halign=none,
caption="Step 2: Express V in terms of h, only:",
"V =",
TextField[TFV](width=15, background=turquoise),
HorizontalGlue(),
Button("Hint", Evaluate(function="HintV"), background="Orange"),
Button("Check", Evaluate(function = "CheckV"), background=green),
TextField[replyV](width=6, editable=false, background=white),
Button("Show", Evaluate(function = "ShowV"), background=yellow)
],
[ border=true,halign=none,
caption="Step 3: Compute dV/dt in terms of h and dh/dt, only:",
"dV/dt =",
TextField[TFDV](width=15, background=turquoise),
HorizontalGlue(),
Button("Hint", Evaluate(function="HintDV"), background="Orange"),
Button("Check", Evaluate(function = "CheckDV"), background=green),
TextField[replyDV](width=6, editable=false, background=white),
Button("Show", Evaluate(function = "ShowDV"), background=yellow)
],
[ border=true,halign=none,
caption="Step 4: Compute dh/dt for the given value of h:",
"dh/dt =",
TextField[TFDh](width=15, background=turquoise),
HorizontalGlue(),
Button("Hint", Evaluate(function="HintDh"), background="Orange"),
Button("Check", Evaluate(function = "CheckDh"), background=green),
TextField[replyDh](width=6, editable=false, background=white),
Button("Show", Evaluate(function = "ShowDh"), background=yellow)
],
TextBox[reply](width=40, height=2, editable=false, background=white),
[ inset=0, spacing=0,
"Instructor: Phillip Yasskin",
"Programmers: Connor Fields and John Choate",
"Copyright: Yasskin 2011"
]
]
)
):
Maplets[Display]( RelatedRates );