# Surface Area of Revolution # Meade, Yasskin # # ################################## # # Header For All Maplets restart: with(Maplets[Elements]):with(Maplets[Tools]): StartEngine(); randomize(): lightorange:="#FFB300": lightcyan:="#DDFFFF": lightblue:="#CFCFFF": lightgreen:="#CCFFCC": darkgreen:="#00C000": ColorBkgd:=wheat: ColorDefaultMenu:=lightcyan: ColorHelpMenu:=lightorange: ColorFileMenu:=pink: ColorFooter:=lightcyan: ColorNewButton:=magenta: # or Make, Save, Enter Problem ColorReturnButton:=magenta: ColorCloseButton:=pink: # or Quit, Clear, Reset, Cancel ColorHintButton:=lightorange: # or Syntax ColorPrevButton:=turquoise: # or Update ColorEnterButton:=turquoise: ColorSimplifyButton:=lightorange: ColorCheckButton:=green: ColorShowButton:=lightorange: ColorPlotButton:=gold: ColorPlotButtonFrgd:=black: ColorPlotFrame:=gold: ColorTableBkgd:=lightgreen: ColorCalculatorBkgd:=gold: ColorBlackBox:=black: ColorBlackBoxFrgd:=yellow: ColorMessage:=white: ColorMessageFrgd:=black: ColorInput:=turquoise: ColorInputFrgd:=black: ColorCorrect:=green: ColorCorrectFrgd:=black: ColorIncorrect:=red: ColorIncorrectFrgd:=white: ColorWarning:=yellow: ColorWarningFrgd:=black: ColorShow:=lightorange: ColorShowFrgd:=black: ColorHint:=lightorange: ColorHintFrgd:=black: # or Info, Syntax ColorDisable:=wheat: ColorDisableFrgd:=black: FontFooter:=Font("helvetica",10): FontSymbol:=Font("symbol",12): FontBig:=Font("times",20): LIBLogo:=cat(libname,"/M4C/M4C.png"): Logo:="M4C.png": #LIBLogo:=cat(libname,"/M4C/WebALT_logo.png"): #Logo:="WebALT_logo.png": # ################################## # # English Translation Table For All Maplets TEXTLprogrammers:= "Programmers: D.B. Meade & P.B. Yasskin": TEXTLcopyright:= "© Copyright: Maplets for Calculus 2004-10": #"© Copyright: WebALT 2006-07": TEXTLversion:= "M4C v1.3 July 2010": TEXTBQuit:= "Quit": TEXTBClose:= "Close": TEXTBCheck:= "Check": TEXTBShow:= "Show": TEXTBShowAll:= "Show All Steps": TEXTBCheckAns:= "Check Answer": TEXTBShowAns:= "Show Answer": TEXTBInstructions:= "Instructions": TEXTBHint:= "Hint": TEXTBHints:= "Hints": TEXTBSyntax:= "Syntax": TEXTBHintSyntax:= "Hints and Syntax": TEXTBPrev:= "Preview": TEXTBUpdate:= "Update": TEXTBDerivation:= "Derivation": TEXTBNewProblem:= "New Problem": TEXTBNewFunction:= "New Function": TEXTBNewGraph:= "New Graph": TEXTBNewEquation:= "New Equation": TEXTBNewLimit:= "New Limit": TEXTBNewDerivative:= "New Derivative": TEXTBNewIntegral:= "New Integral": TEXTBNewSequence:= "New Sequence": TEXTBNewSeries:= "New Series": TEXTBNewDiffEq:= "New Differential Equation": TEXTBNewCurve:= "New Curve": TEXTBEnterProblem:= "Enter Problem": TEXTBEnterFunction:= "Enter Function": TEXTBEnterGraph:= "Enter Graph": TEXTBEnterEquation:= "Enter Equation": TEXTBEnterLimit:= "Enter Limit": TEXTBEnterDerivative:= "Enter Derivative": TEXTBEnterIntegral:= "Enter Integral": TEXTBEnterSequence:= "Enter Sequence": TEXTBEnterSeries:= "Enter Series": TEXTBEnterDiffEq:= "Enter Differential Equation": TEXTBMake:= "Modify or Make Your Own Problem": TEXTBSaveClose:= "Save Problem and Close": TEXTBAskQuestion:= "Ask Question": TEXTBNextQuestion:= "Next Question": TEXTBHowtoAnswer:= "How to Answer": TEXTBEnter:= "Enter": TEXTBOK:= "OK": TEXTBAccept:= "Accept": TEXTBReturn:= "Return": TEXTBClear:= "Clear": TEXTBClearSelections:= "Clear Selections": TEXTBClearAll:= "Clear All Steps": TEXTBReset:= "Reset": TEXTBRestart:= "Restart": TEXTBCancel:= "Cancel": TEXTBPlot:= "Plot": TEXTBPlotIt:= "Plot It": TEXTBAnimate:= "Animate": TEXTBPlay:= "Play": TEXTBPause:= "Pause": TEXTBForward:= "Forward": TEXTBReverse:= "Reverse": TEXTBStep:= "Step": TEXTBUpdatePlot:= "Update Plot": TEXTBZoomIn:= "Zoom In": TEXTBZoomOut:= "Zoom Out": TEXTBPlotSetup:= "Plot Setup": TEXTBRefresh:= "Refresh": TEXTBCalculate:= "Calculate": TEXTBSimplify:= "Simplify": TEXTBFactor:= "Factor": TEXTBExpand:= "Expand": TEXTBNormalize:= "Normalize": TEXTBCombine:= "Combine": TEXTBRationalize:= "Rationalize": TEXTBSort:= "Sort": TEXTBDecimal:= "Decimal": TEXTBExact:= "Exact": TEXTCorrect:= " correct ": TEXTIncorrect:= "incorrect": TEXTAlmost:= " almost ": TEXTWarning:= " warning ": TEXTShown:= " shown ": TEXTSlower:= "Slower": TEXTFaster:= "Faster": TEXTEnterFormula:= " Enter Formula:": TEXTEvaluate:= " Evaluate:": TEXTApproximate:= " Approximate:": TEXTand:= " and ": TEXTor:= " or ": TEXTThus:= " Thus ": TEXTSo:= " So ": TEXTType:= " Type ": TEXTfor:= " for ": TEXTat:= " at ": TEXTorcheck:= " or check: ": TEXTvertical:= "vertical": TEXThorizontal:= "horizontal": TEXTleft:= "left": TEXTright:= "right": TEXTless:= "less": TEXTgreater:= "greater": TEXTCBDNE:= "does not exist": TEXTCBNone:= "None": TEXTCB11scaling:= "1-1 scaling": TEXTdefault:= " default ": TEXTCBDoNotShow:= "Do not show this window again.": TEXTRBNumeric:= "Numeric": TEXTRBSymbolic:= "Symbolic": TEXTRBTrue:= "True": TEXTRBFalse:= "False": TEXTRBT:= "T": TEXTRBF:= "F": TEXTRBOn:= "On": TEXTRBOff:= "Off": TEXTRed:= "Red": TEXTGreen:= "Green": TEXTBlue:= "Blue": TEXTCyan:= "Cyan": TEXTMagenta:= "Magenta": TEXTYellow:= "Yellow": TEXTRedR:= "R": TEXTGreenG:= "G": TEXTBlueB:= "B": TEXTRBPlot1:= "Plot # 1": TEXTRBPlot2:= "Plot # 2": TEXTRBPlot3:= "Plot # 3": TEXTRBPlot4:= "Plot # 4": TEXTRBPlot5:= "Plot # 5": TEXTRBPlot6:= "Plot # 6": TEXTRBconverge:= "converge": TEXTRBdiverge:= "diverge": TEXTRBconverges:= "converges": TEXTRBdiverges:= "diverges": TEXTRBdiverges2:= "diverges ": TEXTRBconvergent:= "Convergent": TEXTRBdivergent:= "Divergent": TEXTtitlePROBLEM:= "Modify or Make Your Own Problem": TEXTtitlePREVIEW:= "Preview": TEXTtitleHINT:= "Hint": TEXTtitleSYNTAX:= "Syntax": TEXTtitlePlotSetup:= "Plot Setup": TEXTCapGoal:= "Goal:": TEXTCapProbStat:= "Problem Statement:": TEXTCapSyntaxTutorial:= "Syntax Tutorial:": TEXTCapEnter:= "Enter:": TEXTCapSpecify:= "Specify:": TEXTCapTrueFalse:= "True or False?": TEXTCapCalculator:= "Calculator": TEXTCapPlot:= "Plot": TEXTCapLegend:= "Legend": TEXTCapEvaluate:= "Evaluate:": TEXTCapDataTable:= "Data Table": TEXTCapVis:= "Visualization": TEXTCapAnim:= "Animation": TEXTCapPreviewer:= "Previewer": TEXTCapHorRng:= "Horizontal Range:": TEXTxmin:= "xmin =": TEXTxmax:= "xmax =": TEXTCapVertRng:= "Vertical Range:": TEXTymin:= "ymin =": TEXTymax:= "ymax =": TEXTPlotWait:= #Use ColorHint " Please be patient while the plot is generated.": TEXTAnimWait:= " Please be patient while the animation is generated.": TEXTRotatePlot:= " You may rotate the plot with your mouse.": TEXTreplyNoCheck:= " You must enter an expression to be checked.": TEXTreplyNoCheckBoth:= " You must answer both questions before checking.": TEXTreplyNoChecks:= " You must answer all %a questions before checking.": TEXTreplyNoPrev:= " You must enter an expression to be previewed.": TEXTreplyNoSimplify:= " You must enter an expression to be simplified.": TEXTreplyNoFactor:= " You must enter an expression to be factored.": TEXTreplyNoExpand:= " You must enter an expression to be expanded.": TEXTreplyNoNormalize:= " You must enter an expression to be normalized.": TEXTreplyNoModify:= " You must enter an expression to be modified.": TEXTreplyNoPlot:= " Please select a plot.": TEXTreplyNoSelection:= " Please select an answer.": TEXTreplyNoSaveProblem:= " You must fill in all the boxes before saving the problem.": TEXTreplyNoSaveSettings:= " You must fill in all the boxes before saving the settings.": TEXTreplyNoSlider:= " Set the slider to a number between %a and %a": TEXTreplySideEqWrong:= " The %a side of your equation is wrong.": TEXTreplyBothSideEqWrong:= " Both sides of your equation are wrong.": TEXTreplySideIneqWrong:= " The %a side of your inequality is wrong.": TEXTreplyBothSideIneqWrong:= " Both sides of your inequality are wrong.": TEXTreplyNoConst:= " You forgot to add a constant of integration.": TEXTreplyManyConst:= " Your answer should have only one constant of integration.": TEXTreplyMinusErr:= " You have a minus sign error.": DNEset:= {"", undefined, Undefined, UNDEFINED, divergent, Divergent, DIVERGENT, diverges, Diverges, DIVERGES, dne, DNE, doesnotexist, DoesNotExist}: TEXTM_File:= "File": TEXTM_Fns:= "Functions": TEXTCBMI_polygen:= "Polynomials (Generalized)": TEXTCBMI_exp:= "Exponentials": TEXTCBMI_log:= "Logarithms": TEXTCBMI_trig:= "Trigonometric": TEXTCBMI_invtrig:= "Inverse Trigonometric": TEXTCBMI_hyper:= "Hyperbolic": TEXTCBMI_invhyper:= "Inverse Hyperbolic": TEXTCBMI_simpsubst:= "Allow Simple Substitutions": TEXTM_Rules:= "Rules": TEXTCBMI_prod:= "Product Rule": TEXTCBMI_quot:= "Quotient Rule": TEXTCBMI_power:= "Power Rule": TEXTCBMI_chain:= "Chain Rule": TEXTM_Methods:= "Methods": TEXTCBMI_subst:= "Substitution": TEXTCBMI_parts:= "Integration by Parts": TEXTCBMI_trigpow:= "Trigonometric Powers": TEXTCBMI_trigsubst:= "Trigonometric Substitution": TEXTCBMI_trigident:= "Trigonometric Identity": TEXTCBMI_parfrac:= "Partial Fractions": TEXTCBMI_impfrac:= "Improper Fraction": TEXTRBproper:= "only proper integrals": TEXTRBimproper:= "allow improper integrals": TEXTM_RulesProb:= "Rules per Problem": TEXTreply_manyrules:= " Problems which involve too many rules tend to become rather messy.": TEXTM_MaxTerms:= "Max # Terms": TEXTreply_manyterms:= " Problems with large numbers of terms tend to become rather messy.": TEXTM_TermsPoly:= "Terms in Polynomial": TEXTM_PowerProp:= "Power Properties": TEXTCBMI_neg:= "Allow Negatives": TEXTCBMI_frac:= "Allow Fractions": TEXTreply_largepower:= " Problems with large degree polynomials tend to become rather messy.": TEXTM_Help:= "Help": TEXTmenu_start:= "Getting Started": TEXTmenu_custom:= "Customized Problems": TEXTmenu_manip:= "Manipulating Functions": TEXTmenu_about:= "About this maplet": great:=[ " Bullseye.", " Right on the mark.", " Great.", " That's absolutely right.", " Awesome. You're unstoppable.", " Correct.", " WOW, nailed that one.", " You got it!", " YES! Right on.", " Way to go.", " Don't stop now.", " I knew you could do it!", " Perfect. You're unstoppable.", " Radical Dude.", " Power house.", " Sweet! Keep on Rockin'.", " You rock!", " You got those mad skills.", " Awesome!", " Wowzers! That was great!", " Awesome man!", " Good job! You really know what you are doing.", " You're awesome kid.", " Tearing it up.", " Right on the money.", " High Five!!!!!", " Cool Beans.", " What a nerd!", " You're so money.", " You're a genius.", " You hit the nail on the head.", " Excellent!", " If I had a cookie, I'd give it to you.", " You're a winner.", " That's a winner.", " Whoop! Way to go.", " That's the way, ah ha ah ha, I like it.", " Oh yeah!", " You're the bomb!", " That was fantastic!", " Oh Snap!", NULL ]: nextgeneric:=[ " Keep it up.", " Keep going.", NULL ]: nextprob:=[ " On to the next problem.", " Try another problem.", " You're ready for another problem.", NULL ]: nextquest:=[ " On to the next question.", " Try another question.", " You're ready for another question.", NULL ]: nextpart:=[ " On to the next part.", " Try another part.", " You're ready for another part.", NULL ]: nextstep:=[ " On to the next step.", " Try another step.", " You're ready for another step.", NULL ]: nexteq:=[ " On to the next equation.", " Try another equation.", " Solve another equation.", " You're ready for another equation.", NULL ]: nextfn:=[ " On to the next function.", " Try another function.", " You're ready for another function.", NULL ]: nextlim:=[ " On to the next limit.", " Try another limit.", " Compute another limit.", " You're ready for another limit.", " Find another limit.", NULL ]: nextderiv:=[ " On to the next derivative.", " Try another derivative.", " Compute another derivative.", " You're ready for another derivative.", " Differentiate another function.", NULL ]: nextinteg:=[ " On to the next integral.", " Try another integral.", " Compute another integral.", " You're ready for another integral.", " Integrate another function.", NULL ]: nextdiffeq:=[ " On to the next differential equation.", " Try another differential equation.", " You're ready for another differential equation.", " Analyze another differential equation.", NULL ]: nextseq:=[ " On to the next sequence.", " Try another sequence.", " Find the limit of another sequence.", " You're ready for another sequence.", NULL ]: nextser:=[ " On to the next series.", " Try another series.", " Sum another series.", " You're ready for another series.", NULL ]: almost:=[ " Close.", " Oh so close.", " Close call. ", " Near miss.", " Not quite good enough for government work.", " Ooooh...close.", " Yikes! Really close. You'll get it next time.", " Close, but no cigar.", " Slightly off.", " Off by a hair.", " Almost there.", " Almost got it.", NULL ]: sorry:=[ " Sorry, that's not right.", " Nope, but don't give up.", " Not quite, it's a little off.", " Bummer, thought you would get it this time.", " If you need help, please ask a human.", " I don't know where you went wrong.", " Sorry, killer problem.", " No, but don't blow it off.", " D'oh!", " That's whack.", " Thought you would get it this time.", " Nice try, but your answer is wrong.", " Ask your neighbor for help.", " Brutal kid.", " That won't fly.", " So close and yet so far.", " So, that was just practice.", " A swing and a miss.", " Better luck next time.", " Oops.", " Tilt. Play again.", " I know you can do better.", " Sorry Charlie.", " Tisk, tisk. It's a tough one.", " It takes a lot of wrongs to make a right.", " Even Einstein didn't get everything right.", " Today's not your lucky day.", " Don't quit your day job.", " You're colder than a polar bear's toenail.", op(almost), NULL ]: trygeneric:=[ " Fix your answer and check it again.", " Give it another try.", " Try again.", " Please try again.", NULL ]: tryhint:=[ " Try the hints and answer again.", " Read the hints and try again.", " Study the hints and answer again.", NULL ]: tryhelp:=[ " Try the Help menu and answer again.", " Look at the Help menu and try again.", NULL ]: showgeneric:=[ " OK That's just practice. But try doing it yourself.", " That's fine for practice. Try doing it yourself.", " Think about it and enter an answer yourself.", " Next time, compute an answer yourself.", " So that was practice. Try doing it yourself.", NULL ]: showhint:=[ " Next time, try the hints.", " Read the hints and enter an answer yourself.", NULL ]: showhelp:=[ " Next time, read the Help menu.", " Read the Help and enter an answer yourself.", NULL ]: # ################################## # Procs for all maplets. 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: # ################################## # # Customize For Each Maplets with(plots):with(plottools): #with(RandomTools): #alias(e=exp(1)): nextlocal:=[ " Try another surface area.", " Find another surface area.", " Compute another surface area.", " You're ready for another surface area.", NULL ]: trylocal:=[ NULL ]: showlocal:=[ NULL ]: nexts1:=[ #Keep what is appropriate. This is for all but the last check. op(nextgeneric), #op(nextprob), #op(nextquest), op(nextpart), op(nextstep), #op(nextlocal), NULL ]: nexts2:=[ #Keep what is appropriate. This is for the last check. op(nextgeneric), op(nextprob), op(nextquest), #op(nexteq), #op(nextfn), #op(nextlim), #op(nextderiv), op(nextinteg), #op(nextdiffeq), #op(nextseq), #op(nextser), op(nextlocal), NULL ]: trys:=[ #Keep what is appropriate. op(trygeneric), op(tryhint), #op(tryhelp), #op(trylocal), NULL ]: shows:=[ #Keep what is appropriate. op(showgeneric), op(showhint), #op(showhelp), #op(showlocal), NULL ]: randgreat:=rand(1..nops(great)): randnext1:=rand(1..nops(nexts1)): randnext2:=rand(1..nops(nexts2)): randalmost:=rand(1..nops(almost)): randsorry:=rand(1..nops(sorry)): randtry:=rand(1..nops(trys)): randshow:=rand(1..nops(shows)): # ################################## # # English Translation Table For SurfAreaOfRev TEXTLasstprogrammer:= "Assistant Programmers: ": TEXTtitleMAIN:= "Surface Area Of Solid Of Revolution": TEXTBTemplate:= "Show Template": TEXTprob0:= " The curve y = ..., between x = ... and x = ..., is rotated about the x-axis.\nFind the surface area of the surface of revolution.": TEXTprob1:= " The curve %a = %a, between %a = %a and %a = %a, is rotated about the %a-axis.\n Find the surface area of the surface of revolution.": TEXTcap1:= "Step 1 - Enter the integral for the surface area.": TEXTcap2:= "Step 2 - Compute the surface area of the solid": TEXTP1:= "Specify a Variable of Integration: ": TEXTP2:= "Specify an Interval of Integration: ": TEXTP3x:= "Specify Curve: y =": TEXTP3y:= "Specify Curve: x =": TEXTP4:= "Specify an Axis of Rotation: ": TEXTreplyAnim1:= " The animation first rotates the whole curve, then rotates one segment to get a frustum of a cone, and then adds frustums to produce the surface.": TEXTreplyAnim2:= " Try rotating the plot with your mouse.": TEXTreplyTemplate:= " Now fill in the template.": TEXTreplyHint2:= " Get out some paper and do the integral!\n\n Try the Simplify, Factor and Expand buttons.": TEXTreplyP:= " Your curve must be functions of %a only!": TEXTreply1a:= " This response must be a definite integral. (You can use either Int or int.)": TEXTreply1b:= " The surface area integral has the wrong integration variable.": TEXTreply1c:= " The limits of integration on the surface area integral are not correct.": TEXTreply1d:= " The integrand of the surface area integral is incorrect.": # ################################## First:=true: Axes:=[" x ", " y "]: rand12:=rand(1..2): formCURVE:=[ [ a, b, c*X^3, [X], [a,[$0..5]], [b,[$1..5]], [c,[$-2..2]] ], [ a, b, c*sqrt(X), [X], [a,[$0..9]], [b,[$1..9]], [c,[$-5..5]] ], [ a, b, X^3/6+1/2/X, [X,Y], [a,[1/3,1/2,1,2]], [b,[1/3,1/2,1,2]] ], [ a, b, sqrt(c-X^2), [X,Y], [a,[($0..2)/2]], [b,[($-4..4)/2]], [c,[$4..9]] ], [ a, b, c*X+d, [X,Y], [a,[$0..2]], [b,[$2..5]], [c,[$1..10]], [d,[$0..5]] ], NULL ]: randform:=rand(1..nops(formCURVE)): indvar:=" x ": start:="": finish:="": crv:="": axisvar:=" x ": emptyplot:=display( plot3d(4, x=-3..3, y=-3..3, view=-3..3, scaling=constrained, orientation=[45,60], axes=normal, labels=["","",""], color=white), textplot3d([0,3,0,`x`], color=black, align=ABOVE, font=[TIMES,BOLDITALIC,16]), textplot3d([0,0,3,` y`], color=black, align=RIGHT, font=[TIMES,BOLDITALIC,16]) ): RandomProblem:=proc() global formCURVE, indvar, var, other, start, finish, crv, axisvar; local axis, RandCURVE, i, pname, pvals, C, othervar; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; indvar:=Axes[rand12()]; if indvar=" x " then var:=x; other:=y; othervar:=" y "; else var:=y; other:=x; othervar:=" x "; end if; RandCURVE:=formCURVE[randform()]; do C:=RandCURVE[1..3]; axis:=RandomTools[Generate](choose( RandCURVE[4] )); if axis=X then axisvar:=indvar else axisvar:=othervar end if; for i from 5 to nops(RandCURVE) do pname:=RandCURVE[i,1]; pvals:=RandCURVE[i,2]; C:=eval( C, pname=pvals[rand(1..nops(pvals))()] ); end do; if C[1]<>C[2] and C[3]<>0 then start,finish:=sort(C[1..2])[]; crv:=eval( expand(C[3]), X=var ); return; end if; end do; end proc: InitializeProblem:=proc() global indvar, start, finish, crv, axisvar, indvarsave; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(Variable=indvar); Set(Start=start); Set(Finish=finish); Set(Curve=crv); Set(Axis=axisvar); indvarsave:=indvar; SetVariable(); end proc: SetVariable:=proc() global indvar, var, other; local variable; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; indvar:=Get(Variable); if indvar=" x " then var:=x; other:=y; Set(VarIneq(caption)="< x <"); Set(QCurve(caption)=TEXTP3x); else #So indvar=" y " var:=y; other:=x; Set(VarIneq(caption)="< y <"); Set(QCurve(caption)=TEXTP3y); end if; end proc: UnSetVariable:=proc() global indvarsave; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(Variable=indvarsave); Set(reply="", reply(background)=ColorMessage, reply(foreground)=ColorMessageFrgd); SetVariable(); end proc: MakeProblem:=proc() global var, start, finish, crv, axisvar; local ustart, ufinish, ucrv; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(Start)="" or Get(Finish)="" or Get(Curve)="" then Set(reply=TEXTreplyNoSaveProblem, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; ustart:=Get(Start::realcons, corrections=true, update=true); ufinish:=Get(Finish::realcons, corrections=true, update=true); ucrv:=Get(Curve::algebraic, corrections=true, update=true); if nops(indets(ucrv, name) minus{var})>0 then Set(reply=sprintf(TEXTreplyP, var), reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; start:=ustart; finish:=ufinish; crv:=ucrv; axisvar:=Get(Axis); Set(ACloseProblem(run)=true); NewProblem(); end proc: NewProblem:=proc() global First, axisvar, indvar, var, other, start, finish, crv, template, form, surf; local axis, p, integrand, domain, R1, R2, DS; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(reply=TEXTAnimWait, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); Set(APlot=emptyplot); if First then First:=false; Set(BPlay(enabled)=true, BPlay(background)=ColorPlotButton, BPlay(foreground)=ColorPlotButtonFrgd); Set(BPause(enabled)=true, BPause(background)=ColorPlotButton, BPause(foreground)=ColorPlotButtonFrgd); Set(BForward(enabled)=true, BForward(background)=ColorPlotButton, BForward(foreground)=ColorPlotButtonFrgd); Set(BReverse(enabled)=true, BReverse(background)=ColorPlotButton, BReverse(foreground)=ColorPlotButtonFrgd); Set(SlSpeed(enabled)=true, SlSpeed(background)=ColorPlotButton, SlSpeed(foreground)=ColorPlotButtonFrgd); Set(BTemplate(enabled)=true, BTemplate(background)=ColorHintButton); Set(TFform(enabled)=true, TFform(background)=ColorInput); Set(BPreview(enabled)=true, BPreview(background)=ColorPrevButton); Set(Bformck(enabled)=true, Bformck(background)=ColorCheckButton); Set(Bformsh(enabled)=true, Bformsh(background)=ColorShowButton); end if; Set(Bsimplify(enabled)=false, Bsimplify(background)=ColorDisable); Set(Bfactor(enabled)=false, Bfactor(background)=ColorDisable); Set(Bexpand(enabled)=false, Bexpand(background)=ColorDisable); Set(BHint2(enabled)=false, BHint2(background)=ColorDisable); Set(Bsurfck(enabled)=false, Bsurfck(background)=ColorDisable); Set(Bsurfsh(enabled)=false, Bsurfsh(background)=ColorDisable); axis:=`if`(axisvar=" x ", x, y); Set(problem=sprintf(TEXTprob1, other, crv, var, start, var, finish, axis)); Set(TFform="Int(2 * Pi * r,s)"); Set(MMLform=MathML[Export](S = Int(2*Pi*r,s))); Set(formck="", formck(background)=ColorMessage, formck(foreground)=ColorMessageFrgd): Set(TFsurf="", TFsurf(enabled)=false, TFsurf(background)=ColorDisable); Set(surfck="", surfck(background)=ColorMessage, surfck(foreground)=ColorMessageFrgd): if indvar=axisvar then R1:=f(var); R2:=crv; else R1:=var; R2:=var; end if; DS:=sqrt( 1+(cat(d,other)/cat(d,var))^2 ); integrand:=2*Pi*abs(R1)*DS; template:=Int(integrand,var=a..b); DS:=sqrt(1+diff(crv,var)^2); integrand:=2*Pi*abs(R2)*DS; form:=Int( integrand, var=start..finish ); surf:=value(form); AnimateIt(); end proc: AnimateIt:=proc() global indvar, var, crv, axisvar, start, finish, rand12; local C, S, S0, pC, p0, plist, i, p, comment; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if indvar=" x " then C:=[var,0,crv]; if axisvar=" x " then S:=[var,crv*sin(theta),crv*cos(theta)]; else # axisvar=" y " S:=[var*cos(theta),var*sin(theta),crv]; end if; else # indvar=" y " C:=[crv,0,var]; if axisvar=" x " then S:=[crv,var*sin(theta),var*cos(theta)]; else # axisvar=" y " then S:=[crv*cos(theta),crv*sin(theta),var] end if; end if; S0:=eval(S, var=start): pC:=spacecurve(C, var=start..finish, color=blue, thickness=3): p0:=spacecurve(S0, theta=0..2*Pi, transparency=0.4, style=patch, color=black, numpoints=24): plist:=pC: for i to 12 do plist:=plist, display(pC,plot3d(S, var=start..finish, theta=0..i*2*Pi/12, transparency=0.4, style=patch, color=pink, grid=[11,1+2*i])): end do: plist:=plist, pC: for i to 12 do plist:=plist, display(pC,plot3d(S, var=start+.3*(finish-start)..start+.4*(finish-start), theta=0..i*2*Pi/12, transparency=0.4, style=patch, color=pink, grid=[2,1+2*i])): end do: plist:=plist, display(pC,p0): for i to 10 do plist:=plist, display(pC,plot3d(S, var=start..start+i/10*(finish-start), theta=0..2*Pi, transparency=0.4, style=patch, color=pink, grid=[1+i,24])): end do: p:=display([plist], insequence=true, orientation=[-60,75], axes=normal, labels=["x","","y"], tickmarks=[DEFAULT,0,DEFAULT]); Set(APlot=p); Set(APlot(frame_backwards)=true); Set(reply=TEXTreplyAnim1, reply(background)=ColorHint, reply(foreground)=ColorHintFrgd); end proc: SetSpeed:=proc() local speed; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; speed:=600 - Get(SlSpeed); Set(APlot(delay)=speed); end proc: # ShowTemplate:=proc() global template; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(TFform=template): Set(MMLform=MathML[Export](S=template)): Set(formck="", formck(background)=ColorMessage, formck(foreground)=ColorMessageFrgd): Set(reply=TEXTreplyTemplate, reply(background)=ColorHint, reply(foreground)=ColorHintFrgd): Set(TFsurf="", TFsurf(enabled)=false, TFsurf(background)=ColorDisable); Set(surfck="", surfck(background)=ColorMessage, surfck(foreground)=ColorMessageFrgd): Set(Bsimplify(enabled)=false, Bsimplify(background)=ColorDisable); Set(Bfactor(enabled)=false, Bfactor(background)=ColorDisable); Set(Bexpand(enabled)=false, Bexpand(background)=ColorDisable); Set(BHint2(enabled)=false, BHint2(background)=ColorDisable); Set(Bsurfck(enabled)=false, Bsurfck(background)=ColorDisable); Set(Bsurfsh(enabled)=false, Bsurfsh(background)=ColorDisable); end proc: Preview:=proc() local user_form; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(TFform)="" then Set(reply=TEXTreplyNoPrev, reply(background)=ColorWarning, reply(foreground)= ColorWarningFrgd); Set(MMLform=MathML[Export]("")); return; end if; user_form:=Get(TFform::anything, corrections=true, update=true): Set(MMLform=MathML[Export](S=user_form)): end proc: Check_form:=proc() global form; local dom, f, user_dom, user_f, user_form, message; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(TFform)="" then Set(reply=TEXTreplyNoCheck, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; user_form:=Get(TFform::anything, corrections=true, update=true): Set(MMLform=MathML[Export](S=user_form)): message:=""; if not member(op(0,user_form),{int,Int}) then message:=cat(message, TEXTreply1a); else f,dom:=op(form); user_f,user_dom:=op(user_form); if lhs(dom)<>lhs(user_dom) then message:=cat(message, TEXTreply1b) end if; if rhs(dom)<>rhs(user_dom) then message:=cat(message, TEXTreply1c) end if; if simplify(normal(f-user_f))<>0 assuming lhs(dom)>op(1,rhs(dom)), lhs(dom)"" then Set(Bsimplify(enabled)=false, Bsimplify(background)=ColorDisable); Set(Bfactor(enabled)=false, Bfactor(background)=ColorDisable); Set(Bexpand(enabled)=false, Bexpand(background)=ColorDisable); Set(TFsurf="", TFsurf(enabled)=false, TFsurf(background)=ColorDisable); Set(BHint2(enabled)=false, BHint2(background)=ColorDisable); Set(Bsurfck(enabled)=false, Bsurfck(background)=ColorDisable); Set(surfck="", surfck(enabled)=false, surfck(background)=ColorDisable); Set(Bsurfsh(enabled)=false, Bsurfsh(background)=ColorDisable); Set(formck=TEXTIncorrect, formck(background)=ColorIncorrect, formck(foreground)=ColorIncorrectFrgd): Set(reply=cat(message, trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd): else Set(Bsimplify(enabled)=true, Bsimplify(background)=ColorSimplifyButton); Set(Bfactor(enabled)=true, Bfactor(background)=ColorSimplifyButton); Set(Bexpand(enabled)=true, Bexpand(background)=ColorSimplifyButton); Set(TFsurf(enabled)=true, TFsurf(background)=ColorInput); Set(BHint2(enabled)=true, BHint2(background)=ColorHintButton); Set(Bsurfck(enabled)=true, Bsurfck(background)=ColorCheckButton); Set(surfck="", surfck(enabled)=true, surfck(background)=ColorMessage, surfck(foreground)=ColorMessageFrgd); Set(Bsurfsh(enabled)=true, Bsurfsh(background)=ColorShowButton); Set(formck=TEXTCorrect, formck(background)=ColorCorrect, formck(foreground)=ColorCorrectFrgd): Set(reply=nexts1[randnext1()], reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd): end if; end proc: Show_form:=proc() global form; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(TFform=form): Set(MMLform=MathML[Export](S=form)): Set(Bsimplify(enabled)=true, Bsimplify(background)=ColorSimplifyButton); Set(Bfactor(enabled)=true, Bfactor(background)=ColorSimplifyButton); Set(Bexpand(enabled)=true, Bexpand(background)=ColorSimplifyButton); Set(TFsurf(enabled)=true, TFsurf(background)=ColorInput); Set(BHint2(enabled)=true, BHint2(background)=ColorHintButton); Set(Bsurfck(enabled)=true, Bsurfck(background)=ColorCheckButton); Set(Bsurfsh(enabled)=true, Bsurfsh(background)=ColorShowButton); Set(formck=TEXTShown, formck(background)=ColorShow, formck(foreground)=ColorShowFrgd): Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd): end proc: Simplify_form:=proc() local form, integrand, domain; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(TFform)="" then Set(reply=TEXTreplyNoSimplify, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; form:=Get(TFform::algebraic, corrections=true, update=true); integrand,domain:=op(form); integrand:=simplify(integrand) assuming lhs(domain)>op(1,rhs(domain)), lhs(domain) 0 then Set(surfck=TEXTIncorrect, surfck(background)=ColorIncorrect, surfck(foreground)=ColorIncorrectFrgd): Set(reply=cat(sorry[randsorry()], trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd): else Set(surfck=TEXTCorrect, surfck(background)=ColorCorrect, surfck(foreground)=ColorCorrectFrgd): Set(reply=cat(great[randgreat()], nexts2[randnext2()]), reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd): end if; end proc: Show_surf:=proc() global surf; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(TFsurf=surf): Set(surfck=TEXTShown, surfck(background)=ColorShow, surfck(foreground)=ColorShowFrgd): Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd): end proc: Surface_Area_Of_Rev:=Maplet(onstartup=RunWindow(MAIN), Window[MAIN]( title=TEXTtitleMAIN, defaultbutton=BPause, [ halign=none, inset=0, spacing=0, background=ColorBkgd, [ background=ColorBkgd, Button[Bnew](TEXTBNewProblem, onclick=ANewProblem, background=ColorNewButton), TEXTor, Button(TEXTBMake, onclick=AMakeProblem, background=ColorNewButton), HorizontalGlue(), Button(TEXTBQuit, Shutdown(), background=ColorCloseButton) ], [ background=ColorBkgd, TextBox[problem](TEXTprob0, width=100, height=2, editable=false, background=ColorMessage) ], [ background=ColorBkgd, [ halign=none, valign=none,background=ColorBkgd, border=true, inset=0, spacing=0, caption=TEXTCapAnim, [ halign=none, background=ColorBkgd, Button[BPlay](TEXTBPlay, Action(SetOption(APlot(play)=true), SetOption(reply=TEXTreplyAnim2), SetOption(reply(background)=ColorHint), SetOption(reply(foreground)=ColorHintFrgd)), enabled=false, background=ColorDisable), Button[BPause](TEXTBPause, SetOption(APlot(pause)=true), enabled=false, background=ColorDisable), Button[BForward](TEXTBForward, Action(SetOption(APlot(pause)=true), SetOption(APlot(frame_forward)=true)), enabled=false, background=ColorDisable), Button[BReverse](TEXTBReverse, Action(SetOption(APlot(pause)=true), SetOption(APlot(frame_backwards)=true)), enabled=false, background=ColorDisable) ], [ background=ColorPlotFrame, Plotter[APlot](value=emptyplot, width=350, height=350) ], [ background=ColorBkgd, TEXTSlower, Slider[SlSpeed](0..500, 250, filled=true, majorticks=50, snapticks=false, showlabels=false, onchange=Evaluate(function="SetSpeed"), enabled=false, background=ColorDisable), TEXTFaster ] ], [ halign=none, background=ColorBkgd, inset=0, spacing=0, BoxColumn(background=ColorBkgd, inset=0, spacing=0, border=true, caption=TEXTcap1, [ background=ColorBkgd, "S =", TextField[TFform]("Int( 2 * Pi * r ,s)", width=30, enabled=false, background=ColorDisable) ], [ background=ColorBkgd, HorizontalGlue(), Button[BPreview](TEXTBPrev, Evaluate(function="Preview"), enabled=false, background=ColorDisable), HorizontalGlue(), Button[BTemplate](TEXTBTemplate, Evaluate(function="ShowTemplate"), enabled=false, background=ColorDisable), HorizontalGlue() ], [ background=ColorBkgd, MathMLViewer[MMLform](value=MathML[Export](S = Int(2*Pi*r,s)), width=250, height=100) ], [ background=ColorBkgd, HorizontalGlue(), Button[Bformck](TEXTBCheck, Evaluate(function="Check_form"), enabled=false, background=ColorDisable), TextField[formck](width=6, editable=false, background=ColorMessage), Button[Bformsh](TEXTBShow, Evaluate(function="Show_form"), enabled=false, background=ColorDisable), HorizontalGlue() ] ), [ background=ColorBkgd, HorizontalGlue(), Button[Bsimplify](TEXTBSimplify, Evaluate(function="Simplify_form"), enabled=false, background=ColorDisable), Button[Bfactor](TEXTBFactor, Evaluate(function="Factor_form"), enabled=false, background=ColorDisable), Button[Bexpand](TEXTBExpand, Evaluate(function="Expand_form"), enabled=false, background=ColorDisable), HorizontalGlue() ], BoxColumn( background=ColorBkgd, inset=0, spacing=0, border=true, caption=TEXTcap2, [ background=ColorBkgd, "S =", TextField[TFsurf](width=20, enabled=false, background=ColorDisable), HorizontalGlue(), Button[BHint2](TEXTBHint, onclick=AHint2, enabled=false, background=ColorDisable) ], [ background=ColorBkgd, HorizontalGlue(), Button[Bsurfck](TEXTBCheck, Evaluate(function="Check_surf"), enabled=false, background=ColorDisable), TextField[surfck](width=6, editable=false, background=ColorMessage), Button[Bsurfsh](TEXTBShow, Evaluate(function="Show_surf"), enabled=false, background=ColorDisable), HorizontalGlue() ] ), BoxRow( background=ColorBkgd, TextBox[reply](width=40, height=4, editable=false, background=ColorMessage), Label(Image(Logo)), Label(Image(LIBLogo)) ) ] ], BoxColumn( halign=none, background=ColorFooter, inset=0, spacing=0, [ background=ColorFooter, inset=0, spacing=0, Label(TEXTLprogrammers, font=FontFooter), HorizontalGlue(), Label(TEXTLcopyright, font=FontFooter), HorizontalGlue(), Label(TEXTLversion, font=FontFooter) ], [ background=ColorFooter, inset=0, spacing=0, # Label(TEXTLasstprogrammer, font=FontFooter), HorizontalGlue(), Label(GetVersion(), font=FontFooter) ] ) ]), #Close BoxColumn, Close Window Window[PROBLEM]( title=TEXTtitlePROBLEM, defaultbutton=BSaveClose, BoxColumn(halign=none, background=ColorBkgd, [ background=ColorBkgd, TEXTP1, DropDownBox[Variable]([" x ", " y "], width=50, onchange=Evaluate(function="SetVariable")), HorizontalGlue() ], [ background=ColorBkgd, TEXTP2, TextField[Start]("", width=9, background=ColorInput), Label[VarIneq]("< x <"), TextField[Finish]("", width=9, background=ColorInput), HorizontalGlue() ], [ background=ColorBkgd, Label[QCurve](TEXTP3x), TextField[Curve]("", width=25, background=ColorInput), HorizontalGlue() ], [ background=ColorBkgd, TEXTP4, DropDownBox[Axis]([" x ", " y "], width=50), HorizontalGlue() ], [ background=ColorBkgd, HorizontalGlue(), Button[BSaveClose](TEXTBSaveClose, onclick=ASaveProblem, background=ColorNewButton), Button(TEXTBCancel, onclick=ACancelProblem, background=ColorCloseButton), HorizontalGlue() ] )), #Close BoxColumn, Close Window Action[ANewProblem]( Evaluate(function="RandomProblem"), Evaluate(function="NewProblem") ), Action[AMakeProblem]( Evaluate(function="InitializeProblem"), RunWindow(PROBLEM) ), Action[ASaveProblem]( Evaluate(function="MakeProblem") ), Action[ACloseProblem]( CloseWindow(PROBLEM) ), Action[ACancelProblem]( Evaluate(function="UnSetVariable"), CloseWindow(PROBLEM) ), Action[AHint2]( SetOption(reply=TEXTreplyHint2), SetOption(reply(background)=ColorHint), SetOption(reply(foreground)=ColorHintFrgd) ) ): First:=true: Maplets[Display]( Surface_Area_Of_Rev );