Finding the surface area of a parametric surface
Programmers: Garret Mai & Danielle Cope
Math 253 Honors Section 202
Fall 2012
Instructor: Philip Yasskin
restart:
with(Maplets[Tools]):
with(Maplets[Elements]):
StartEngine();
randomize():
TEXTLprogrammers:=
"Programmers: D.B. Meade & P.B. Yasskin":
TEXTLasstprogrammer:=
"Assistant Programmers: Garret Mai & Danielle Cope":
TEXTLcopyright:=
"\302\251 Copyright: Maplets for Calculus 2006-10":
TEXTLversion:=
"M4C v1.3.2 2012":
FontFooter:=Font("helvetica",10):
FontSymbol:=Font("symbol",12):
FontBig:=Font("times",20):
LIBLogo:=cat(libname,"/M4C/M4C.png"):
Logo:="M4C.png":
ColorFooter:=cyan:
ColorMessage:=white:
ColorMessageFrgd:=black:
ColorBkgd:=wheat:
GetVersion:=proc()
local S, S1, S3, S4;
options `Copyright 2009-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`;
uses StringTools;
S:=interface(version);
S:=map( Trim, Split( S, "," ) );
S1:=Split(S[1], " " );
S3:=Split(S[3], " " );
S4:=Split(S[-1], " " );
sprintf("%s (%s)", S[2],S3[-1]);
end proc:
rand5:=rand(1..5):
zrs:=[a0*r^2,a0*r,a0*sqrt(b0^2-r^2),b0^2-a0*r^2,b0-a0*r]:
randzr:=rand(1..nops(zrs)):
ask:=proc()
global R0, er, etheta, N0, NLen, Aint,rAint, Aint2,rAint2, Aval,rmin,rmax,thetamin,thetamax;
local a0,z0, r0;
a0:=rand5();
r0:=rand5();
z0:=a0*r0^2;
R0:=[r*cos(theta),r*sin(theta),a0*r^2];
er:=diff(R0,r);
etheta:=diff(R0,theta);
N0:=simplify(convert(LinearAlgebra:-CrossProduct(Vector(er),Vector(etheta)),list));
NLen:=simplify(sqrt(((N0[1])^2)+((N0[2])^2)+((N0[3])^2)));
rmin:=0;
rmax:=r0;
thetamin:=0;
thetamax:=2*Pi;
Aint:=Int(Int(NLen,r=0..r0),theta=0..2*Pi);
rAint:=Int(Int(r*NLen,r=0..r0),theta=0..2*Pi);
Aint2:=Int(Int(NLen,theta=0..2*Pi),r=0..r0);
rAint2:=Int(Int(r*NLen,theta=0..2*Pi),r=0..r0);
Aval:=value(Aint);
Set(question=sprintf("Find the surface area of the %s:\134n z = %a for z <= %a.", "paraboloid", a0*(x^2+y^2),z0));
Set(TFR="");
Set(BCkR(enabled)=true);
Set(BShR(enabled)=true);
Set(replyR="", replyR(background)=white);
Set(TFer="");
Set(BCker(enabled)=false);
Set(BSher(enabled)=false);
Set(replyer="", replyer(background)=white);
Set(TFetheta="");
Set(BCketheta(enabled)=false);
Set(BShetheta(enabled)=false);
Set(replyetheta="", replyetheta(background)=white);
Set(TFN0="");
Set(BCkN0(enabled)=false);
Set(BShN0(enabled)=false);
Set(replyN0="", replyN0(background)=white);
Set(TFNLen="");
Set(BCkNLen(enabled)=false);
Set(BShNLen(enabled)=false);
Set(replyNLen="", replyNLen(background)=white);
Set(TFrmin="");
Set(TFrmax="");
Set(TFthetamin="");
Set(TFthetamax="");
Set(BCkinterval(enabled)=false);
Set(BShinterval(enabled)=false);
Set(replyinterval="", replyinterval(background)=white);
Set(TFAint="");
Set(BCkAint(enabled)=false);
Set(BShAint(enabled)=false);
Set(replyAint="", replyAint(background)=white);
Set(TFAval="");
Set(BCkAval(enabled)=false);
Set(BShAval(enabled)=false);
Set(replyAval="", replyAval(background)=white);
Set(reply=" ", reply(background)=white);
end proc:
hintR:=proc()
Set(reply="Use r and theta to parametrize the surface, making sure to enter your answer as [xcomponent,ycomponent,zcomponent]",
reply(background)="Orange", reply(foreground)=black);
Set(replyR="", replyR(background)=white);
end proc:
checkR:=proc()
global R0;
local userR;
userR:=Get(TFR::list, corrections=true, update=true):
if simplify(userR-R0)=[0,0,0] then
Set(reply="Correct! Keep going.",
reply(background)=green, reply(foreground)=black);
Set(replyR="correct",
replyR(background)=green, replyR(foreground)=black);
Set(BCkR(enabled)=true);
Set(BShR(enabled)=true);
else
Set(reply="Incorrect. Try again.",reply(background)=red, reply(foreground)=white);
Set(replyR="incorrect", replyR(background)=red, replyR(foreground)=white);
end if;
end proc:
showR:=proc()
global R0;
Set(TFR=R0):
Set(reply="Next time try doing it yourself.",
reply(background)=yellow, reply(foreground)=black);
Set(replyR="shown",
replyR(background)=yellow, replyR(foreground)=black);
Set(BCker(enabled)=true);
Set(BSher(enabled)=true);
end proc:
hinter:=proc()
Set(reply="Take the partial derivative of R with respect to r.",
reply(background)="Orange", reply(foreground)=black);
Set(replyer="", replyer(background)=white);
end proc:
checker:=proc()
global R0,er;
local userer;
userer:=Get(TFer::list, corrections=true, update=true):
if simplify(userer-er)=[0,0,0] then
Set(reply="Correct! Keep going.",
reply(background)=green, reply(foreground)=black);
Set(replyer="correct",
replyer(background)=green, replyer(foreground)=black);
Set(BCketheta(enabled)=true);
Set(BShetheta(enabled)=true);
else
Set(reply="Incorrect. Try again.",
reply(background)=red, reply(foreground)=white);
Set(replyer="incorrect",
replyer(background)=red, replyer(foreground)=white);
end if;
end proc:
shower:=proc()
global er,R0;
Set(TFer=er):
Set(reply="Next time try doing it yourself.",
reply(background)=yellow, reply(foreground)=black);
Set(replyer="shown",
replyer(background)=yellow, replyer(foreground)=black);
Set(BCketheta(enabled)=true);
Set(BShetheta(enabled)=true);
end proc:
hintetheta:=proc()
Set(reply="Take the partial derivative of R with respect to theta.",
reply(background)="Orange", reply(foreground)=black);
Set(replyetheta="", replyetheta(background)=white);
end proc:
checketheta:=proc()
global etheta, R0;
local useretheta;
useretheta:=Get(TFetheta::list, corrections=true, update=true):
if simplify(useretheta-etheta)=[0,0,0] then
Set(reply="Correct! Keep going.",
reply(background)=green, reply(foreground)=black);
Set(replyetheta="correct",
replyetheta(background)=green, replyetheta(foreground)=black);
Set(BCketheta(enabled)=true);
Set(BShetheta(enabled)=true);
else
Set(reply="Incorrect. Try again.",
reply(background)=red, reply(foreground)=white);
Set(replyetheta="incorrect",
replyetheta(background)=red, replyetheta(foreground)=white);
end if;
end proc:
showetheta:=proc()
global etheta,R0;
Set(TFetheta=etheta):
Set(reply="Next time try doing it yourself.",
reply(background)=yellow, reply(foreground)=black);
Set(replyetheta="shown",
replyetheta(background)=yellow, replyetheta(foreground)=black);
Set(BCkN0(enabled)=true);
Set(BShN0(enabled)=true);
end proc:
hintN0:=proc()
Set(reply="Take the cross-product of the partials, by crossing er with etheta.",
reply(background)="Orange", reply(foreground)=black);
Set(replyN0="", replyN0(background)=white);
end proc:
checkN0:=proc()
global N0;
local userN0;
userN0:=Get(TFN0::list, corrections=true, update=true):
if simplify(userN0-N0)=[0,0,0] then
Set(reply="Correct! Keep going.",
reply(background)=green, reply(foreground)=black);
Set(replyN0="correct",
replyN0(background)=green, replyN0(foreground)=black);
Set(BCkNLen(enabled)=true);
Set(BShNLen(enabled)=true);
else
Set(reply="Incorrect. Try again.",
reply(background)=red, reply(foreground)=white);
Set(replyN0="incorrect",
replyN0(background)=red, replyN0(foreground)=white);
end if;
end proc:
showN0:=proc()
global N0;
Set(TFN0=N0):
Set(reply="Next time try doing it yourself.",
reply(background)=yellow, reply(foreground)=black);
Set(replyN0="shown",
replyN0(background)=yellow, replyN0(foreground)=black);
Set(BCkNLen(enabled)=true);
Set(BShNLen(enabled)=true);
end proc:
hintNLen:=proc()
Set(reply="Take the magnitude of N.",
reply(background)="Orange", reply(foreground)=black);
Set(replyNLen="", replyNLen(background)=white);
end proc:
checkNLen:=proc()
global NLen;
local userNLen;
userNLen:=Get(TFNLen::algebraic, corrections=true, update=true):
if simplify(userNLen-NLen)=0 assuming r>0 then
Set(reply="Correct! Keep going.",
reply(background)=green, reply(foreground)=black);
Set(replyNLen="correct",
replyNLen(background)=green, replyNLen(foreground)=black);
Set(BCkinterval(enabled)=true);
Set(BShinterval(enabled)=true);
else
Set(reply="Incorrect. Try again.",
reply(background)=red, reply(foreground)=white);
Set(replyNLen="incorrect",
replyN0(background)=red, replyN0(foreground)=white);
end if;
end proc:
showNLen:=proc()
global NLen;
Set(TFNLen=NLen):
Set(reply="Next time try doing it yourself.",
reply(background)=yellow, reply(foreground)=black);
Set(replyNLen="shown",
replyNLen(background)=yellow, replyNLen(foreground)=black);
Set(BCkinterval(enabled)=true);
Set(BShinterval(enabled)=true);
end proc:
hintinterval:=proc()
Set(reply="Draw a picture of the surface to determine the limits, make sure both intervals are correct",
reply(background)="Orange", reply(foreground)=black);
Set(replyinterval="", replyinterval(background)=white);
end proc:
checkinterval:=proc()
global rmin,rmax,thetamax,thetamin;
local userrmin, userrmax, userthetamin, userthetamax;
userrmin:=Get(TFrmin::realcons, corrections=true, update=true):
userrmax:=Get(TFrmax::realcons, corrections=true, update=true):
userthetamin:=Get(TFthetamin::realcons, corrections=true, update=true):
userthetamax:=Get(TFthetamax::realcons, corrections=true, update=true):
if (
userrmin=rmin
and
userrmax=rmax
and
userthetamin=thetamin
and
userthetamax=thetamax
)
then
Set(reply="Correct! Keep going.",
reply(background)=green, reply(foreground)=black);
Set(replyinterval="correct",
replyinterval(background)=green, replyinterval(foreground)=black);
Set(BCkAint(enabled)=true);
Set(BShAint(enabled)=true);
else
Set(reply="Incorrect. Try again.",
reply(background)=red, reply(foreground)=white);
Set(replyinterval="incorrect",
replyinterval(background)=red, replyinterval(foreground)=white);
end if;
end proc:
showinterval:=proc()
global rmin,rmax,thetamax,thetamin;
Set(TFrmin=rmin):
Set(TFrmax=rmax):
Set(TFthetamin=thetamin):
Set(TFthetamax=thetamax):
Set(reply="Next time try doing it yourself.",
reply(background)=yellow, reply(foreground)=black);
Set(replyinterval="shown",
replyinterval(background)=yellow, replyinterval(foreground)=black);
Set(BCkAint(enabled)=true);
Set(BShAint(enabled)=true);
end proc:
hintAint:=proc()
Set(reply="Set up the integral of the calculated magnitude of N, using the ranges of r and theta.",
reply(background)="Orange", reply(foreground)=black);
Set(replyAint="", replyAint(background)=white);
end proc:
checkAint:=proc()
global Aint;
local userAint;
userAint:=Get(TFAint::algebraic, corrections=true, update=true):
if simplify(userAint-Aint)=0 or simplify(userAint-Aint2)=0 then
Set(reply="Correct! Keep going.",
reply(background)=green, reply(foreground)=black);
Set(replyAint="correct",
replyAint(background)=green, replyAint(foreground)=black);
Set(BCkAval(enabled)=true);
Set(BShAval(enabled)=true);
elif simplify(userAint-rAint)=0 or simplify(userAint-rAint2)=0 then
Set(reply="Almost, it looks like you have an extra r in the integrand. Check your work and try again.",
reply(background)="Orange", reply(foreground)=black);
Set(replyAint="Almost",
replyAint(background)="Orange", replyAint(foreground)=black);
else
Set(reply="Incorrect. Try again.",
reply(background)=red, reply(foreground)=white);
Set(replyAint="incorrect",
replyAint(background)=red, replyAint(foreground)=white);
end if;
end proc:
showAint:=proc()
global Aint;
Set(TFAint=Aint):
Set(reply="Next time try doing it yourself.",
reply(background)=yellow, reply(foreground)=black);
Set(replyAint="shown",
replyAint(background)=yellow, replyAint(foreground)=black);
Set(BCkAval(enabled)=true);
Set(BShAval(enabled)=true);
end proc:
hintAval:=proc()
Set(reply="Evaluate the integral you set up, a u-substitution might be helpful.",
reply(background)="Orange", reply(foreground)=black);
Set(replyAval="", replyAval(background)=white);
end proc:
checkAval:=proc()
global Aval;
local userAval;
userAval:=Get(TFAval::realcons, corrections=true, update=true):
if simplify(userAval-Aval)=0 then
Set(reply="Correct! Keep going.",
reply(background)=green, reply(foreground)=black);
Set(replyAval="correct",
replyAval(background)=green, replyAval(foreground)=black);
else
Set(reply="Incorrect. Try again.",
reply(background)=red, reply(foreground)=white);
Set(replyAval="incorrect",
replyAval(background)=red, replyAval(foreground)=white);
end if;
end proc:
showAval:=proc()
global Aval;
Set(TFAval=Aval):
Set(reply="Next time try doing it yourself.",
reply(background)=yellow, reply(foreground)=black);
Set(replyAval="shown",
replyAval(background)=yellow, replyAval(foreground)=black);
end proc:
FindPSEquations:=Maplet(onstartup = RunWindow(MAIN),
Window[MAIN](title="Finding the surface area of a parametric surface",
[ valign=none, inset=0, spacing=0,
[ halign=none,
Button("New Problem", Evaluate(function = "ask"), background=magenta),
HorizontalGlue(),
TextBox[question](width=42, height=3, editable=false, background=white),
HorizontalGlue(),
Button("Quit", Shutdown(), background=pink)
],
[ halign=none, border=true,
caption="Step 1: Parametrize the surface: ",
"R =",
TextField[TFR](width=40, background=turquoise),
HorizontalGlue(),
Button[BHtR]("Hint", Evaluate(function = "hintR"), background="Orange"),
Button[BCkR]("Check", Evaluate(function = "checkR"), background=green, enabled=false),
TextField[replyR](width=6, background=white),
Button[BShR]("Show", Evaluate(function = "showR"), background=yellow, enabled=false)
],
BoxColumn( valign=none, inset=0, spacing=0, border=true,
caption="Step 2: Find the tangent vectors in the r and theta directions:",
[ MathMLViewer(e[r],width=20, height=25),
"=",
TextField[TFer](width=30, background=turquoise),
HorizontalGlue(),
Button[BHter]("Hint", Evaluate(function = "hinter"), background="Orange"),
Button[BCker]("Check", Evaluate(function = "checker"), background=green, enabled=false),
TextField[replyer](width=6, background=white),
Button[BSher]("Show", Evaluate(function = "shower"), background=yellow, enabled=false)
],
[ MathMLViewer(e[theta],width=20, height=25),
"=",
TextField[TFetheta](width=30, background=turquoise),
HorizontalGlue(),
Button[BHtetheta]("Hint", Evaluate(function = "hintetheta"), background="Orange"),
Button[BCketheta]("Check", Evaluate(function = "checketheta"), background=green, enabled=false),
TextField[replyetheta](width=6, background=white),
Button[BShetheta]("Show", Evaluate(function = "showetheta"), background=yellow, enabled=false)
]
),
BoxColumn( valign=none, inset=0, spacing=0, border=true,
caption="Step 3: Find the normal vector to the surface and its magnitude:",
[ halign=none,
"N =",
TextField[TFN0](width=41, background=turquoise),
HorizontalGlue(),
Button[BHtN0]("Hint", Evaluate(function = "hintN0"), background="Orange"),
Button[BCkN0]("Check", Evaluate(function = "checkN0"), background=green, enabled=false),
TextField[replyN0](width=6, background=white),
Button[BShN0]("Show", Evaluate(function = "showN0"), background=yellow, enabled=false)
],
[ halign=none,
"|N| =",
TextField[TFNLen](width=40, background=turquoise),
HorizontalGlue(),
Button[BHtNLen]("Hint", Evaluate(function = "hintNLen"), background="Orange"),
Button[BCkNLen]("Check", Evaluate(function = "checkNLen"), background=green, enabled=false),
TextField[replyNLen](width=6, background=white),
Button[BShNLen]("Show", Evaluate(function = "showNLen"), background=yellow, enabled=false)
]
),
[ halign=none, border=true,
caption="Step 4: Find the limits of the integral: ",
TextField[TFrmin](width=5, background=turquoise),
"<= r <=",
TextField[TFrmax](width=5, background=turquoise),
HorizontalGlue(),
HorizontalGlue(),
HorizontalGlue(),
TextField[TFthetamin](width=5, background=turquoise),
"<= theta <=",
TextField[TFthetamax](width=5, background=turquoise),
HorizontalGlue(),
Button[BHtinterval]("Hint", Evaluate(function = "hintinterval"), background="Orange"),
Button[BCkinterval]("Check", Evaluate(function = "checkinterval"), background=green, enabled=false),
TextField[replyinterval](width=6, background=white),
Button[BShinterval]("Show", Evaluate(function = "showinterval"), background=yellow, enabled=false)
],
BoxColumn( valign=none, inset=0, spacing=0, border=true,
caption="Step 5: Find the Surface Area by setting up and evaluating the integral:",
[ halign=none,
"A =",
TextField[TFAint](width=40, background=turquoise),
HorizontalGlue(),
Button[BHtAint]("Hint", Evaluate(function = "hintAint"), background="Orange"),
Button[BCkAint]("Check", Evaluate(function = "checkAint"), background=green, enabled=false),
TextField[replyAint](width=6, background=white),
Button[BShAint]("Show", Evaluate(function = "showAint"), background=yellow, enabled=false)
],
[ halign=none,
"A =",
TextField[TFAval](width=40, background=turquoise),
HorizontalGlue(),
Button[BHtAval]("Hint", Evaluate(function = "hintAval"), background="Orange"),
Button[BCkAval]("Check", Evaluate(function = "checkAval"), background=green, enabled=false),
TextField[replyAval](width=6, background=white),
Button[BShAval]("Show", Evaluate(function = "showAval"), background=yellow, enabled=false)
]
),
BoxRow( halign=none, background=ColorBkgd,
TextBox[reply](width=60, height=2, editable=false, background=ColorMessage),
Label(Image(Logo)),
Label(Image(LIBLogo))
),
[ halign=none,
"Instructor: Philip Yasskin",
HorizontalGlue(),
"Programmers: Garret Mai & Danielle Cope",
HorizontalGlue(),
"Copyright 2012, P. Yasskin"
]
]
)
):
Maplets[Display]( FindPSEquations );