# Maximum Rectangle Inscribed in an Ellipse # Chris Standley & Michael Strickland # # ################################## # # 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": # ################################## # # Template Translation Table For All Maplets TEXTLprogrammers:= "Programmers: D.B. Meade & P.B. Yasskin": TEXTLcopyright:= "© Copyright: Maplets for Calculus 2006-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:=[ 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)): # ################################## # # Put Translation Table For Specfic Maplet Here TEXTLasstprogrammer:= "Assistant Programmers: Chris Standley, Michael Strickland, & Matthew Barry": TEXTtitleMAIN:= "Maximum Rectangle Inscribed in an Ellipse": TEXTProbStmt1:= "Find the area of the largest rectangle that can be": TEXTProbStmt2:= "inscribed in %s ellipse:": TEXTProbTypeNames:= ["the whole", "the top half of the", "the right half of the", "the first quadrant of the"]: TEXTCapStep1:= "Step 1: Enter the area of the rectangle as a function of x and y:": TEXTCapStep2:= "Step 2: Express y as a function of x:": TEXTCapStep3:= "Step 3: Enter the area of the rectangle as a function of only x:": TEXTCapStep4:= "Step 4: Differentiate the area:": TEXTCapStep5:= "Step 5: Enter the coordinates that maximize the area:": TEXTCapStep6:= "Step 6: Enter the maximum area:": TEXTreplyNoX:= " No x answer given.": TEXTreplyNoY:= " No y answer given.": TEXTreplyXWrong:= " Your x value is incorrect.": TEXTreplyYWrong:= " Your y value is incorrect.": TEXTHintArear:= " The length and width may not just be x and y. There may be another half.": TEXTHintYfnx:= " Solve the equation of the ellipse for y in terms of x.": TEXTHintareax:= " Substitute the formula for y into the formula for A.": TEXTHintDerivarea:= " Differentiate the area formula using the product rule and the chain rule.": TEXTHintDimmax:= " Set the derivative of the area equal to zero and solve for x. Then plug the x value back into the formula for y.": TEXTHintAreamax:= " Plug the x and y values into area equation.": # ################################## rand15:=rand(1..5): randProbType:=rand(1..4): plot0:=plot(0,-2..2,-2..2, color=white): assume(a>0,b>0): coef:=[4, 2, 2, 1]: New_Problem:=proc() global area, areax, derivarea, xmax, ymax, areamax, a, b, probtype, yval, coef; local eq; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; probtype:=randProbType(); a:=rand15(); b:=rand15(); eq:=x^2/a^2 + y^2/b^2 = 1; yval:=b*sqrt(1-x^2/a^2); area:=coef[probtype]*x*y; areax:=coef[probtype]*x*yval; derivarea:=diff(areax,x); xmax:=a/sqrt(2); ymax:=b/sqrt(2); areamax:=coef[probtype]*a*b/2; Set(LProbStmt(caption)=sprintf(TEXTProbStmt2, TEXTProbTypeNames[probtype])); Set(MMLeq=eq); Set(TFarea="", TFarea(background)=ColorInput, TFarea(enabled)=true); Set(BareaHint(background)=ColorHintButton, BareaHint(enabled)=true); Set(MRarea="", MRarea(background)=ColorMessage, MRarea(foreground)=ColorMessageFrgd); Set(BareaCheck(background)=ColorCheckButton, BareaCheck(enabled)=true); Set(BareaShow(background)=ColorShowButton, BareaShow(enabled)=true); Set(TFyfnx="", TFyfnx(background)=ColorDisable, TFyfnx(enabled)=false); Set(ByfnxHint(background)=ColorDisable, ByfnxHint(enabled)=false); Set(MRyfnx="", MRyfnx(background)=ColorMessage, MRyfnx(foreground)=ColorMessageFrgd); Set(ByfnxCheck(background)=ColorDisable, ByfnxCheck(enabled)=false); Set(ByfnxShow(background)=ColorDisable, ByfnxShow(enabled)=false); Set(TFareax="", TFareax(background)=ColorDisable, TFareax(enabled)=false); Set(BareaxHint(background)=ColorDisable, BareaxHint(enabled)=false); Set(MRareax="", MRareax(background)=ColorMessage, MRareax(foreground)=ColorMessageFrgd); Set(BareaxCheck(background)=ColorDisable, BareaxCheck(enabled)=false); Set(BareaxShow(background)=ColorDisable, BareaxShow(enabled)=false); Set(TFderivarea="", TFderivarea(background)=ColorDisable, TFderivarea(enabled)=false); Set(BderivareaHint(background)=ColorDisable, BderivareaHint(enabled)=false); Set(MRderivarea="", MRderivarea(background)=ColorMessage, MRderivarea(foreground)=ColorMessageFrgd); Set(BderivareaCheck(background)=ColorDisable, BderivareaCheck(enabled)=false); Set(BderivareaShow(background)=ColorDisable, BderivareaShow(enabled)=false); Set(TFxmax="", TFxmax(background)=ColorDisable, TFxmax(enabled)=false); Set(TFymax="", TFymax(background)=ColorDisable, TFymax(enabled)=false); Set(BdimmaxHint(background)=ColorDisable, BdimmaxHint(enabled)=false); Set(MRdimmax="", MRdimmax(background)=ColorMessage, MRdimmax(foreground)=ColorMessageFrgd); Set(BdimmaxCheck(background)=ColorDisable, BdimmaxCheck(enabled)=false); Set(BdimmaxShow(background)=ColorDisable, BdimmaxShow(enabled)=false); Set(TFareamax="", TFareamax(background)=ColorDisable, TFareamax(enabled)=false); Set(BareamaxHint(background)=ColorDisable, BareamaxHint(enabled)=false); Set(MRareamax="", MRareamax(background)=ColorMessage, MRareamax(foreground)=ColorMessageFrgd); Set(BareamaxCheck(background)=ColorDisable, BareamaxCheck(enabled)=false); Set(BareamaxShow(background)=ColorDisable, BareamaxShow(enabled)=false); Set(reply="", reply(background)=ColorMessage, reply(foreground)=ColorMessageFrgd); AnimateIt(); end proc: hint_area:=proc() options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(reply=TEXTHintArear, reply(background)=ColorHint, reply(foreground)=ColorHintFrgd); end proc: check_area:=proc() global area; local user_area; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(TFarea)="" then Set(MRarea=TEXTWarning, MRarea(background)=ColorWarning, MRarea(foreground)=ColorWarningFrgd); Set(reply=TEXTreplyNoCheck, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; user_area:=Get(TFarea::anything, corrections=true, update=true); if simplify(area-user_area)=0 then Set(MRarea=TEXTCorrect, MRarea(background)=ColorCorrect, MRarea(foreground)=ColorCorrectFrgd); Set(reply=cat(great[randgreat()], nexts1[randnext1()]), reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd); Set(TFyfnx(background)=ColorInput, TFyfnx(enabled)=true); Set(ByfnxHint(background)=ColorHintButton, ByfnxHint(enabled)=true); Set(ByfnxCheck(background)=ColorCheckButton, ByfnxCheck(enabled)=true); Set(ByfnxShow(background)=ColorShowButton, ByfnxShow(enabled)=true); else Set(MRarea=TEXTIncorrect, MRarea(background)=ColorIncorrect, MRarea(foreground)=ColorIncorrectFrgd); Set(reply=cat(sorry[randsorry()], trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); Set(TFyfnx="", TFyfnx(background)=ColorDisable, TFyfnx(enabled)=false); Set(ByfnxHint(background)=ColorDisable, ByfnxHint(enabled)=false); Set(MRyfnx="", MRyfnx(background)=ColorMessage, MRyfnx(foreground)=ColorMessageFrgd); Set(ByfnxCheck(background)=ColorDisable, ByfnxCheck(enabled)=false); Set(ByfnxShow(background)=ColorDisable, ByfnxShow(enabled)=false); Set(TFareax="", TFareax(background)=ColorDisable, TFareax(enabled)=false); Set(BareaxHint(background)=ColorDisable, BareaxHint(enabled)=false); Set(MRareax="", MRareax(background)=ColorMessage, MRareax(foreground)=ColorMessageFrgd); Set(BareaxCheck(background)=ColorDisable, BareaxCheck(enabled)=false); Set(BareaxShow(background)=ColorDisable, BareaxShow(enabled)=false); Set(TFderivarea="", TFderivarea(background)=ColorDisable, TFderivarea(enabled)=false); Set(BderivareaHint(background)=ColorDisable, BderivareaHint(enabled)=false); Set(MRderivarea="", MRderivarea(background)=ColorMessage, MRderivarea(foreground)=ColorMessageFrgd); Set(BderivareaCheck(background)=ColorDisable, BderivareaCheck(enabled)=false); Set(BderivareaShow(background)=ColorDisable, BderivareaShow(enabled)=false); Set(TFxmax="", TFxmax(background)=ColorDisable, TFxmax(enabled)=false); Set(TFymax="", TFymax(background)=ColorDisable, TFymax(enabled)=false); Set(BdimmaxHint(background)=ColorDisable, BdimmaxHint(enabled)=false); Set(MRdimmax="", MRdimmax(background)=ColorMessage, MRdimmax(foreground)=ColorMessageFrgd); Set(BdimmaxCheck(background)=ColorDisable, BdimmaxCheck(enabled)=false); Set(BdimmaxShow(background)=ColorDisable, BdimmaxShow(enabled)=false); Set(TFareamax="", TFareamax(background)=ColorDisable, TFareamax(enabled)=false); Set(BareamaxHint(background)=ColorDisable, BareamaxHint(enabled)=false); Set(MRareamax="", MRareamax(background)=ColorMessage, MRareamax(foreground)=ColorMessageFrgd); Set(BareamaxCheck(background)=ColorDisable, BareamaxCheck(enabled)=false); Set(BareamaxShow(background)=ColorDisable, BareamaxShow(enabled)=false); end if; end proc: show_area:=proc() global area; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(TFarea=area); Set(MRarea=TEXTShown, MRarea(background)=ColorShow, MRarea(foreground)=ColorShowFrgd); Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd); Set(TFyfnx(background)=ColorInput, TFyfnx(enabled)=true); Set(ByfnxHint(background)=ColorHintButton, ByfnxHint(enabled)=true); Set(ByfnxCheck(background)=ColorCheckButton, ByfnxCheck(enabled)=true); Set(ByfnxShow(background)=ColorShowButton, ByfnxShow(enabled)=true); end proc: hint_yfnx:=proc() options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(reply=TEXTHintYfnx, reply(background)=ColorHint, reply(foreground)=ColorHintFrgd); end proc: check_yfnx:=proc() global yval; local user_yval; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(TFyfnx)="" then Set(MRyfnx=TEXTWarning, MRyfnx(background)=ColorWarning, MRyfnx(foreground)=ColorWarningFrgd); Set(reply=TEXTreplyNoCheck, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; user_yval:=Get(TFyfnx::anything, corrections=true, update=true): if simplify(user_yval-yval)=0 then Set(MRyfnx=TEXTCorrect, MRyfnx(background)=ColorCorrect, MRyfnx(foreground)=ColorCorrectFrgd); Set(reply=cat(great[randgreat()], nexts1[randnext1()]), reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd); Set(TFareax(background)=ColorInput, TFareax(enabled)=true); Set(BareaxHint(background)=ColorHintButton, BareaxHint(enabled)=true); Set(BareaxCheck(background)=ColorCheckButton, BareaxCheck(enabled)=true); Set(BareaxShow(background)=ColorShowButton, BareaxShow(enabled)=true); else Set(MRyfnx=TEXTIncorrect, MRyfnx(background)=ColorIncorrect, MRyfnx(foreground)=ColorIncorrectFrgd); Set(reply=cat(sorry[randsorry()], trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); Set(TFareax="", TFareax(background)=ColorDisable, TFareax(enabled)=false); Set(BareaxHint(background)=ColorDisable, BareaxHint(enabled)=false); Set(MRareax="", MRareax(background)=ColorMessage, MRareax(foreground)=ColorMessageFrgd); Set(BareaxCheck(background)=ColorDisable, BareaxCheck(enabled)=false); Set(BareaxShow(background)=ColorDisable, BareaxShow(enabled)=false); Set(TFderivarea="", TFderivarea(background)=ColorDisable, TFderivarea(enabled)=false); Set(BderivareaHint(background)=ColorDisable, BderivareaHint(enabled)=false); Set(MRderivarea="", MRderivarea(background)=ColorMessage, MRderivarea(foreground)=ColorMessageFrgd); Set(BderivareaCheck(background)=ColorDisable, BderivareaCheck(enabled)=false); Set(BderivareaShow(background)=ColorDisable, BderivareaShow(enabled)=false); Set(TFxmax="", TFxmax(background)=ColorDisable, TFxmax(enabled)=false); Set(TFymax="", TFymax(background)=ColorDisable, TFymax(enabled)=false); Set(BdimmaxHint(background)=ColorDisable, BdimmaxHint(enabled)=false); Set(MRdimmax="", MRdimmax(background)=ColorMessage, MRdimmax(foreground)=ColorMessageFrgd); Set(BdimmaxCheck(background)=ColorDisable, BdimmaxCheck(enabled)=false); Set(BdimmaxShow(background)=ColorDisable, BdimmaxShow(enabled)=false); Set(TFareamax="", TFareamax(background)=ColorDisable, TFareamax(enabled)=false); Set(BareamaxHint(background)=ColorDisable, BareamaxHint(enabled)=false); Set(MRareamax="", MRareamax(background)=ColorMessage, MRareamax(foreground)=ColorMessageFrgd); Set(BareamaxCheck(background)=ColorDisable, BareamaxCheck(enabled)=false); Set(BareamaxShow(background)=ColorDisable, BareamaxShow(enabled)=false); end if: end proc: show_yfnx:=proc() global yval; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(TFyfnx=yval); Set(MRyfnx=TEXTShown, MRyfnx(background)=ColorShow, MRyfnx(foreground)=ColorShowFrgd); Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd); Set(TFareax(background)=ColorInput, TFareax(enabled)=true); Set(BareaxHint(background)=ColorHintButton, BareaxHint(enabled)=true); Set(BareaxCheck(background)=ColorCheckButton, BareaxCheck(enabled)=true); Set(BareaxShow(background)=ColorShowButton, BareaxShow(enabled)=true); end proc: hint_areax:=proc() options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(reply=TEXTHintareax, reply(background)=ColorHint, reply(foreground)=ColorHintFrgd); end proc: check_areax:=proc() global areax; local user_areax; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(TFareax)="" then Set(MRareax=TEXTWarning, MRareax(background)=ColorWarning, MRareax(foreground)=ColorWarningFrgd); Set(reply=TEXTreplyNoCheck, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; user_areax:=Get(TFareax::anything, corrections=true, update=true); if simplify(areax-user_areax)=0 then Set(MRareax=TEXTCorrect, MRareax(background)=ColorCorrect, MRareax(foreground)=ColorCorrectFrgd); Set(reply=cat(great[randgreat()], nexts1[randnext1()]), reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd); Set(TFderivarea(background)=ColorInput, TFderivarea(enabled)=true); Set(BderivareaHint(background)=ColorHintButton, BderivareaHint(enabled)=true); Set(BderivareaCheck(background)=ColorCheckButton, BderivareaCheck(enabled)=true); Set(BderivareaShow(background)=ColorShowButton, BderivareaShow(enabled)=true); else Set(MRareax=TEXTIncorrect, MRareax(background)=ColorIncorrect, MRareax(foreground)=ColorIncorrectFrgd); Set(reply=cat(sorry[randsorry()], trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); Set(TFderivarea="", TFderivarea(background)=ColorDisable, TFderivarea(enabled)=false); Set(BderivareaHint(background)=ColorDisable, BderivareaHint(enabled)=false); Set(MRderivarea="", MRderivarea(background)=ColorMessage, MRderivarea(foreground)=ColorMessageFrgd); Set(BderivareaCheck(background)=ColorDisable, BderivareaCheck(enabled)=false); Set(BderivareaShow(background)=ColorDisable, BderivareaShow(enabled)=false); Set(TFxmax="", TFxmax(background)=ColorDisable, TFxmax(enabled)=false); Set(TFymax="", TFymax(background)=ColorDisable, TFymax(enabled)=false); Set(BdimmaxHint(background)=ColorDisable, BdimmaxHint(enabled)=false); Set(MRdimmax="", MRdimmax(background)=ColorMessage, MRdimmax(foreground)=ColorMessageFrgd); Set(BdimmaxCheck(background)=ColorDisable, BdimmaxCheck(enabled)=false); Set(BdimmaxShow(background)=ColorDisable, BdimmaxShow(enabled)=false); Set(TFareamax="", TFareamax(background)=ColorDisable, TFareamax(enabled)=false); Set(BareamaxHint(background)=ColorDisable, BareamaxHint(enabled)=false); Set(MRareamax="", MRareamax(background)=ColorMessage, MRareamax(foreground)=ColorMessageFrgd); Set(BareamaxCheck(background)=ColorDisable, BareamaxCheck(enabled)=false); Set(BareamaxShow(background)=ColorDisable, BareamaxShow(enabled)=false); end if; end proc: show_areax:=proc() global areax; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(TFareax=areax); Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd); Set(MRareax=TEXTShown, MRareax(background)=ColorShow, MRareax(foreground)=ColorShowFrgd); Set(TFderivarea(background)=ColorInput, TFderivarea(enabled)=true); Set(BderivareaHint(background)=ColorHintButton, BderivareaHint(enabled)=true); Set(BderivareaCheck(background)=ColorCheckButton, BderivareaCheck(enabled)=true); Set(BderivareaShow(background)=ColorShowButton, BderivareaShow(enabled)=true); end proc: hint_derivarea:=proc() options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(reply=TEXTHintDerivarea, reply(background)=ColorHint, reply(foreground)=ColorHintFrgd); end proc: check_derivarea:=proc() global derivarea; local user_derivarea; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(TFderivarea)="" then Set(MRderivarea=TEXTWarning, MRderivarea(background)=ColorWarning, MRderivarea(foreground)=ColorWarningFrgd); Set(reply=TEXTreplyNoCheck, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; user_derivarea:=Get(TFderivarea::anything, corrections=true, update=true); if simplify(derivarea-user_derivarea=0) then Set(MRderivarea=TEXTCorrect, MRderivarea(background)=ColorCorrect, MRderivarea(foreground)=ColorCorrectFrgd); Set(reply=cat(great[randgreat()], nexts1[randnext1()]), reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd); Set(TFxmax(background)=ColorInput, TFxmax(enabled)=true); Set(TFymax(background)=ColorInput, TFymax(enabled)=true); Set(BdimmaxHint(background)=ColorHintButton, BdimmaxHint(enabled)=true); Set(BdimmaxCheck(background)=ColorCheckButton, BdimmaxCheck(enabled)=true); Set(BdimmaxShow(background)=ColorShowButton, BdimmaxShow(enabled)=true); else Set(MRderivarea=TEXTIncorrect, MRderivarea(background)=ColorIncorrect, MRderivarea(foreground)=ColorIncorrectFrgd); Set(reply=cat(sorry[randsorry()], trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); Set(TFxmax="", TFxmax(background)=ColorDisable, TFxmax(enabled)=false); Set(TFymax="", TFymax(background)=ColorDisable, TFymax(enabled)=false); Set(BdimmaxHint(background)=ColorDisable, BdimmaxHint(enabled)=false); Set(MRdimmax="", MRdimmax(background)=ColorMessage, MRdimmax(foreground)=ColorMessageFrgd); Set(BdimmaxCheck(background)=ColorDisable, BdimmaxCheck(enabled)=false); Set(BdimmaxShow(background)=ColorDisable, BdimmaxShow(enabled)=false); Set(TFareamax="", TFareamax(background)=ColorDisable, TFareamax(enabled)=false); Set(BareamaxHint(background)=ColorDisable, BareamaxHint(enabled)=false); Set(MRareamax="", MRareamax(background)=ColorMessage, MRareamax(foreground)=ColorMessageFrgd); Set(BareamaxCheck(background)=ColorDisable, BareamaxCheck(enabled)=false); Set(BareamaxShow(background)=ColorDisable, BareamaxShow(enabled)=false); end if; end proc: show_derivarea:=proc() global derivarea; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(TFderivarea=derivarea); Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd); Set(MRderivarea=TEXTShown, MRderivarea(background)=ColorShow, MRderivarea(foreground)=ColorShowFrgd); Set(TFxmax(background)=ColorInput, TFxmax(enabled)=true); Set(TFymax(background)=ColorInput, TFymax(enabled)=true); Set(BdimmaxHint(background)=ColorHintButton, BdimmaxHint(enabled)=true); Set(BdimmaxCheck(background)=ColorCheckButton, BdimmaxCheck(enabled)=true); Set(BdimmaxShow(background)=ColorShowButton, BdimmaxShow(enabled)=true); end proc: hint_dimmax:=proc() options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(reply=TEXTHintDimmax, reply(background)=ColorHint, reply(foreground)=ColorHintFrgd); end proc: check_dimmax:=proc() global xmax, ymax; local user_xmax, user_ymax; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(TFxmax)="" and Get(TFymax)="" then Set(MRdimmax=TEXTWarning, MRdimmax(background)=ColorWarning, MRderivarea(foreground)=ColorWarningFrgd); Set(reply=TEXTreplyNoCheck, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; elif Get(TFxmax)="" then Set(MRdimmax=TEXTWarning, MRdimmax(background)=ColorWarning, MRdimmax(foreground)=ColorWarningFrgd); Set(reply=TEXTreplyNoX, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; elif Get(TFymax)="" then Set(MRdimmax=TEXTWarning, MRdimmax(background)=ColorWarning, MRdimmax(foreground)=ColorWarningFrgd); Set(reply=TEXTreplyNoY, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; user_ymax:=Get(TFymax::anything, corrections=true, update=true); user_xmax:=Get(TFxmax::anything, corrections=true, update=true); if simplify(xmax-user_xmax)=0 and simplify(ymax-user_ymax)=0 then Set(MRdimmax=TEXTCorrect, MRdimmax(background)=ColorCorrect, MRdimmax(foreground)=ColorCorrectFrgd); Set(reply=cat(great[randgreat()], nexts1[randnext1()]), reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd); Set(TFareamax(background)=ColorInput, TFareamax(enabled)=true); Set(BareamaxHint(background)=ColorHintButton, BareamaxHint(enabled)=true); Set(BareamaxCheck(background)=ColorCheckButton, BareamaxCheck(enabled)=true); Set(BareamaxShow(background)=ColorShowButton, BareamaxShow(enabled)=true); elif simplify(xmax-user_xmax)=0 and simplify(ymax-user_ymax)<>0 then Set(MRdimmax=TEXTIncorrect, MRdimmax(background)=ColorIncorrect, MRdimmax(foreground)=ColorIncorrectFrgd); Set(reply=cat(sorry[randsorry()], TEXTreplyYWrong, trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); Set(TFareamax="", TFareamax(background)=ColorDisable, TFareamax(enabled)=false); Set(BareamaxHint(background)=ColorDisable, BareamaxHint(enabled)=false); Set(MRareamax="", MRareamax(background)=ColorMessage, MRareamax(foreground)=ColorMessageFrgd); Set(BareamaxCheck(background)=ColorDisable, BareamaxCheck(enabled)=false); Set(BareamaxShow(background)=ColorDisable, BareamaxShow(enabled)=false); elif simplify(xmax-user_xmax)<>0 and simplify(ymax-user_ymax)=0 then Set(MRdimmax=TEXTIncorrect, MRdimmax(background)=ColorIncorrect, MRdimmax(foreground)=ColorIncorrectFrgd); Set(reply=cat(sorry[randsorry()], TEXTreplyXWrong, trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); Set(TFareamax="", TFareamax(background)=ColorDisable, TFareamax(enabled)=false); Set(BareamaxHint(background)=ColorDisable, BareamaxHint(enabled)=false); Set(MRareamax="", MRareamax(background)=ColorMessage, MRareamax(foreground)=ColorMessageFrgd); Set(BareamaxCheck(background)=ColorDisable, BareamaxCheck(enabled)=false); Set(BareamaxShow(background)=ColorDisable, BareamaxShow(enabled)=false); else Set(MRdimmax=TEXTIncorrect, MRdimmax(background)=ColorIncorrect, MRdimmax(foreground)=ColorIncorrectFrgd); Set(reply=cat(sorry[randsorry()], trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); Set(TFareamax="", TFareamax(background)=ColorDisable, TFareamax(enabled)=false); Set(BareamaxHint(background)=ColorDisable, BareamaxHint(enabled)=false); Set(MRareamax="", MRareamax(background)=ColorMessage, MRareamax(foreground)=ColorMessageFrgd); Set(BareamaxCheck(background)=ColorDisable, BareamaxCheck(enabled)=false); Set(BareamaxShow(background)=ColorDisable, BareamaxShow(enabled)=false); end if; end proc: show_dimmax:=proc() global xmax, ymax; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(TFxmax=xmax, TFymax=ymax); Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd); Set(MRdimmax=TEXTShown, MRdimmax(background)=ColorShow, MRdimmax(foreground)=ColorShowFrgd); Set(TFareamax(background)=ColorInput, TFareamax(enabled)=true); Set(BareamaxHint(background)=ColorHintButton, BareamaxHint(enabled)=true); Set(BareamaxCheck(background)=ColorCheckButton, BareamaxCheck(enabled)=true); Set(BareamaxShow(background)=ColorShowButton, BareamaxShow(enabled)=true); end proc: hint_areamax:=proc() options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(reply=TEXTHintAreamax, reply(background)=ColorHint, reply(foreground)=ColorHintFrgd); end proc: check_areamax:=proc() global areamax; local user_areamax; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(TFareamax)="" then Set(MRareamax=TEXTWarning, MRareamax(background)=ColorWarning, MRareamax(foreground)=ColorWarningFrgd); Set(reply=TEXTreplyNoCheck, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; user_areamax:=Get(TFareamax::anything, corrections=true, update=true); if simplify(areamax - user_areamax=0) then Set(MRareamax=TEXTCorrect, MRareamax(background)=ColorCorrect, MRareamax(foreground)=ColorCorrectFrgd); Set(reply=cat(great[randgreat()], nexts2[randnext2()]), reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd); else Set(MRareamax=TEXTIncorrect, MRareamax(background)=ColorIncorrect, MRareamax(foreground)=ColorIncorrectFrgd); Set(reply=cat(sorry[randsorry()], trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); end if; end proc: show_areamax:=proc() global areamax; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(TFareamax=areamax); Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd); Set(MRareamax=TEXTShown, MRareamax(background)=ColorShow, MRareamax(foreground)=ColorShowFrgd); end proc: AnimateIt:=proc() global probtype, a, b; local ellbg, plotlist, plotticks, i, t, box, plotview; options `Copyright 2004-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(anim=plot0); Set(reply=TEXTAnimWait, reply(background)=ColorWarning): ellbg:=ellipse([0,0], a, b, color=blue): plotlist:=NULL: for i from 0 to 47 do t:=i*Pi/48+Pi/4: if probtype=1 then box:=rectangle([-a*abs(cos(t)), -b*abs(sin(t))], [a*abs(cos(t)), b*abs(sin(t))], color=red): plotview:=[-a..a, -b..b]: plotticks:=[[-a,0,a],[-b,0,b]]: elif probtype=2 then box:=rectangle([-a*abs(cos(t)), 0], [a*abs(cos(t)), b*abs(sin(t))], color=red): plotview:=[-a..a, 0..b]: plotticks:=[[-a,0,a],[0,b]]: elif probtype=3 then box:=rectangle([0, -b*abs(sin(t))], [a*abs(cos(t)), b*abs(sin(t))], color=red): plotview:=[0..a, -b..b]: plotticks:=[[0,a],[-b,0,b]]: else box:=rectangle([0,0], [a*abs(cos(t)), b*abs(sin(t))], color=red): plotview:=[0..a, 0..b]: plotticks:=[[0,a],[0,b]]: end if: plotlist:=plotlist, display(box, ellbg): end do: Set(anim=display([plotlist], insequence=true, scaling=constrained, view=plotview, tickmarks=plotticks), anim(delay)=250); Set(reply="", reply(background)=ColorMessage): Set(BPlay(background)=ColorPlotButton, BPlay(foreground)=ColorPlotButtonFrgd, BPlay(enabled)=true); Set(BPause(background)=ColorPlotButton, BPause(foreground)=ColorPlotButtonFrgd, BPause(enabled)=true); Set(BForward(background)=ColorPlotButton, BForward(foreground)=ColorPlotButtonFrgd, BForward(enabled)=true); Set(BReverse(background)=ColorPlotButton, BReverse(foreground)=ColorPlotButtonFrgd, BReverse(enabled)=true); Set(SlSpeed(background)=ColorBkgd, SlSpeed(enabled)=true); 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(anim(delay)=speed); end proc: MaxRectinEll:=Maplet(onstartup=RunWindow(MAIN), Window[MAIN](title=TEXTtitleMAIN, defaultbutton=BHintMain, [ background=ColorBkgd, halign=none, spacing=0, [ background=ColorBkgd, halign=none, Button(TEXTBNewProblem, Evaluate(function="New_Problem"), background=ColorNewButton), HorizontalGlue(), Button[BHintMain](TEXTBHint, Evaluate(function="hint_dimmax"), visible=false), Button(TEXTBQuit, Shutdown(), background=ColorCloseButton) ], [ background=ColorBkgd, inset=0, [ background=ColorBkgd, inset=0, spacing=0, BoxColumn( background=ColorBkgd, halign=left, spacing=0, border=true, caption=TEXTCapProbStat, [ background=ColorBkgd, halign=left, spacing=0, TEXTProbStmt1 ], [ background=ColorBkgd, halign=left, spacing=0, Label[LProbStmt](sprintf(TEXTProbStmt2, 'an')) ], MathMLViewer[MMLeq](width=200, height=55) ), BoxColumn( background=ColorBkgd, border=true, caption=TEXTCapAnim, [ background=ColorBkgd, Button[BPlay](TEXTBPlay, Action(SetOption(anim(play)=true)), background=ColorDisable, enabled=false), Button[BPause](TEXTBPause, Action(SetOption(anim(pause)=true)), background=ColorDisable, enabled=false), Button[BForward](TEXTBForward, Action(SetOption(anim(pause)=true), SetOption(anim(frame_forward)=true)), background=ColorDisable, enabled=false), Button[BReverse](TEXTBReverse, Action(SetOption(anim(pause)=true), SetOption(anim(frame_backwards)=true)), background=ColorDisable, enabled=false) ], [ background=ColorPlotButton, Plotter[anim](plot0, width=275, height=200) ], [ background=ColorBkgd, TEXTSlower, Slider[SlSpeed](0..500, 250, filled=true, majorticks=50, snapticks=false, showlabels=false, onchange=Evaluate(function="SetSpeed"), background=ColorDisable, enabled=false), TEXTFaster ] ) ], [ background=ColorBkgd, inset=0, spacing=0, [ background=ColorBkgd, border=true, caption=TEXTCapStep1, "A =", TextField[TFarea](width=17, background=ColorDisable, enabled=false), HorizontalGlue(), Button[BareaHint](TEXTBHint, Evaluate(function="hint_area"), background=ColorDisable, enabled=false), Button[BareaCheck](TEXTBCheck, Evaluate(function="check_area"), background=ColorDisable, enabled=false), TextField[MRarea](width=6, editable=false, background=ColorMessage), Button[BareaShow](TEXTBShow, Evaluate(function="show_area"), background=ColorDisable, enabled=false) ], [ background=ColorBkgd, border=true, caption=TEXTCapStep2, "y =", TextField[TFyfnx](width=14, background=ColorDisable, enabled=false), HorizontalGlue(), Button[ByfnxHint](TEXTBHint, Evaluate(function="hint_yfnx"), background=ColorDisable, enabled=false), Button[ByfnxCheck](TEXTBCheck, Evaluate(function="check_yfnx"), background=ColorDisable, enabled=false), TextField[MRyfnx](width=6, editable=false, background=ColorMessage), Button[ByfnxShow](TEXTBShow, Evaluate(function="show_yfnx"), background=ColorDisable, enabled=false) ], [ background=ColorBkgd, border=true, caption=TEXTCapStep3, "A =", TextField[TFareax](width=17, background=ColorDisable, enabled=false), HorizontalGlue(), Button[BareaxHint](TEXTBHint, Evaluate(function="hint_areax"), background=ColorDisable, enabled=false), Button[BareaxCheck](TEXTBCheck, Evaluate(function="check_areax"), background=ColorDisable, enabled=false), TextField[MRareax](width=6, editable=false, background=ColorMessage), Button[BareaxShow](TEXTBShow, Evaluate(function="show_areax"), background=ColorDisable, enabled=false) ], [ background=ColorBkgd, border=true, caption=TEXTCapStep4, "A ' =", TextField[TFderivarea](width=30, background=ColorDisable, enabled=false), HorizontalGlue(), Button[BderivareaHint](TEXTBHint, Evaluate(function="hint_derivarea"), background=ColorDisable, enabled=false), Button[BderivareaCheck](TEXTBCheck, Evaluate(function="check_derivarea"), background=ColorDisable, enabled=false), TextField[MRderivarea](width=6, editable=false, background=ColorMessage), Button[BderivareaShow](TEXTBShow, Evaluate(function="show_derivarea"), background=ColorDisable, enabled=false) ], [ background=ColorBkgd, border=true, caption=TEXTCapStep5, "x =", TextField[TFxmax](width=9, background=ColorDisable, enabled=false), HorizontalGlue(), "y =", TextField[TFymax](width=9, background=ColorDisable, enabled=false), HorizontalGlue(), Button[BdimmaxHint](TEXTBHint, Evaluate(function="hint_dimmax"), background=ColorDisable, enabled=false), Button[BdimmaxCheck](TEXTBCheck, Evaluate(function="check_dimmax"), background=ColorDisable, enabled=false), TextField[MRdimmax](width=6, editable=false, background=ColorMessage), Button[BdimmaxShow](TEXTBShow, Evaluate(function="show_dimmax"), background=ColorDisable, enabled=false) ], [ background=ColorBkgd, border=true, caption=TEXTCapStep6, "A =", TextField[TFareamax](width=10, background=ColorDisable, enabled=false), HorizontalGlue(), Button[BareamaxHint](TEXTBHint, Evaluate(function="hint_areamax"), background=ColorDisable, enabled=false), Button[BareamaxCheck](TEXTBCheck, Evaluate(function="check_areamax"), background=ColorDisable, enabled=false), TextField[MRareamax](width=6, editable=false, background=ColorMessage), Button[BareamaxShow](TEXTBShow, Evaluate(function="show_areamax"), background=ColorDisable, enabled=false) ] ] ], BoxRow( background=ColorBkgd, TextBox[reply](width=60, height=2, 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) ] ) ] ) ): Maplets[Display](MaxRectinEll);