# Area as an Anti-Derivative: Derivation of the FTC # Yasskin & Meade for WebALT 2006 # ################################## # # 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(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)): # ################################## # # Translation Table For AreaDerivFTC TEXTLasstprogrammer:= "Assistant Programmer: Matthew Barry": TEXTtitleMAIN:= "Area as an Antiderivative: Derivation of the Fundamental Theorem of Calculus": TEXTDiffHint:= " A(x+h)-A(x) is the area under the curve. It is approximated by the area of the rectangle.\n So enter the area of the rectangle.": TEXTSlopeHint:= " Divide the previous approximation by h.": TEXTDerivHint:= " Notice that the previous approximation is independent of h.": TEXTreply1a:= " You gave the height of the rectangle. You need the area. ": TEXTreply1b:= " You gave the width of the rectangle. You need the area. ": TEXTreply2a:= "That's the numerator. Don't forget to divide by h. ": TEXT0a:= " Let A(x) be the area below y = f(x), above the x-axis, between a and x.\n It is shown in magenta.": TEXT1cap:= "Goal: To compute the derivative of the Area function, A'(x).": TEXT1a:= "\n Its definition is:": TEXT1b:= " The quantity A(x+h) is the area of the region\n below y = f(x), above the x-axis, between a and x+h,\n It is shown in magenta and green. Click on Play.": TEXT1c:= " The quantity A(x+h) - A(x) is the area of the region below y = f(x),\n above the x-axis, between x and x+h. It is shown in green.": TEXT1d:= " The quantity A(x+h) - A(x) may be approximated by the\n area of the rectangle with height f(x) and width h.\n It is shown in blue. Click on Play.": TEXT1e:= " Notice the approximation gets better as h gets smaller.": TEXTCBPlotArea:= "Plot A(x+h)": TEXTCBPlotRect:= "Plot Rectangle": TEXT3cap:= "Derivation:": TEXTtitleFTC:= "The Fundamental Theorem of Calculus": TEXT4a:= "You have just justified one version of the Fundamental Theorem of Calculus which states:": TEXT4b:= " The Fundamental Theorem of Calculus ": TEXT4c:= " If f(x) is a positive function and A(x) is the area under the graph of y=f(x), above the x-axis, between a and x, then A(x) is an antiderivative of f(x), that is, A'(x) = f(x).": # NULL; fx:=sin(2*Pi/10*(x-1))+3-x/10: p0:=plot(fx, x=-1..10, color=black): t0:=textplot([9,4,"y = f(x)"]): plotseq:=NULL: for theta from 0 by 1/12 to 23/12 do p1:=plot(fx, x=1..5+3*sin(theta*Pi), color=magenta, filled=true): t1:=textplot([[1,0,"a"],[5+3*sin(theta*Pi),0,"x"]], align=BELOW): t2:=textplot([3+3/2*sin(theta*Pi),1.5,"A(x)"]): plotseq:=plotseq, display([p1,p0,t2,t1,t0], view=[-1..10,-1..4.5], tickmarks=[0,0], labels=["",""]): end do: d00:=display([plotseq], insequence=true): p1:=plot(fx, x=1..5, color=magenta, filled=true): pfx:=plot(subs(x=5,fx), x=0..5, linestyle=DOT, color=black): t2:=textplot([3,-.4,"A(x)"], align={BELOW}, color=magenta): t3:=textplot([5,1.5,"A(x+h)"]): t4:=textplot([5,-.4," A(x+h) - A(x)"], align={BELOW,RIGHT}, color=green): tfx:=textplot([0,subs(x=5,fx),"f(x) "], align=LEFT): plotseq:=NULL: for H from 3.1 by -.2 to 0.1 do t1:=textplot([[1,0,"a"],[5,0,"x"],[5+H,0,"x+h"]], align=BELOW): p2:=plot(fx, x=5..5+H, color=green, filled=true): plotseq:=plotseq,display([pfx,p2,p1,p0,tfx,t4,t3,t2,t1,t0], view=[-1..10,-1..4.5], tickmarks=[0,0], labels=["",""]): end do: d10:=display([plotseq], insequence=true): t5:=textplot([5,subs(x=5,fx)," h * f(x)"], align={ABOVE,RIGHT}, color=blue): plotseq:=NULL: for H from 3.1 by -.2 to 0.1 do t1:=textplot([[1,0,"a"],[5,0,"x"],[5+H,0,"x+h"]], align=BELOW): p3:=plot(subs(x=5,fx), x=5..5+H, color=blue, filled=true): plotseq:=plotseq,display([pfx,p3,p1,p0,tfx,t5,t2,t1,t0], view=[-1..10,-1..4.5], tickmarks=[0,0], labels=["",""]): end do: d01:=display([plotseq], insequence=true): plotseq:=NULL: for H from 3.1 by -.2 to 0.1 do t1:=textplot([[1,0,"a"],[5,0,"x"],[5+H,0,"x+h"]], align=BELOW): p2:=plot(fx, x=5..5+H, color=green, filled=true): p3:=plot(subs(x=5,fx), x=5..5+H, color=blue, filled=true): plotseq:=plotseq,display([pfx,p2,p3,p1,p0,tfx,t5,t4,t3,t2,t1,t0], view=[-1..10,-1..4.5], tickmarks=[0,0], labels=["",""]): end do: d11:=display([plotseq], insequence=true): plotseq:=NULL: PlotIt:=proc() local PlotArea, PlotRect; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade for WebALT.`; PlotArea:=Get(CBPlotArea::truefalse); PlotRect:=Get(CBPlotRect::truefalse); if PlotArea and PlotRect then Set(PFTC=d11); elif PlotArea then Set(PFTC=d10); elif PlotRect then Set(PFTC=d01); else Set(PFTC=d00); end if; 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(PFTC(delay)=speed); end proc: DiffHint:=proc() options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade for WebALT.`; Set(reply=TEXTDiffHint, reply(background)=ColorHint, reply(foreground)=ColorHintFrgd): end proc: DiffCheck:=proc() local userDiff; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade for WebALT.`; userDiff:=Get(TFDiff::anything, corrections, update); if userDiff=f(x)*h then Set(TFDiffMsg=TEXTCorrect, TFDiffMsg(background)=ColorCorrect, TFDiffMsg(foreground)=ColorCorrectFrgd): Set(reply=cat(great[randgreat()], nexts1[randnext1()]), reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd): Set(BSlopeCheck(enabled)=true, BSlopeCheck(background)=ColorCheckButton); Set(BSlopeShow(enabled)=true, BSlopeShow(background)=ColorShowButton); elif userDiff=f(x) then Set(TFDiffMsg=TEXTIncorrect, TFDiffMsg(background)=ColorIncorrect, TFDiffMsg(foreground)=ColorIncorrectFrgd): Set(reply=cat(TEXTreply1a, trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd): elif userDiff=h then Set(TFDiffMsg=TEXTIncorrect, TFDiffMsg(background)=ColorIncorrect, TFDiffMsg(foreground)=ColorIncorrectFrgd): Set(reply=cat(TEXTreply1b, trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd): else Set(TFDiffMsg=TEXTIncorrect, TFDiffMsg(background)=ColorIncorrect, TFDiffMsg(foreground)=ColorIncorrectFrgd): Set(reply=cat(sorry[randsorry()], trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd): end if; end proc: DiffShow:=proc() options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade for WebALT.`; Set(TFDiff="f(x) * h"): Set(TFDiffMsg=TEXTShown, TFDiffMsg(background)=ColorShow, TFDiffMsg(foreground)=ColorShowFrgd): Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd): Set(BSlopeCheck(enabled)=true, BSlopeCheck(background)=ColorCheckButton); Set(BSlopeShow(enabled)=true, BSlopeShow(background)=ColorShowButton); end proc: SlopeHint:=proc() options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade for WebALT.`; Set(reply=TEXTSlopeHint, reply(background)=ColorHint, reply(foreground)=ColorHintFrgd): end proc: SlopeCheck:=proc() local userSlope; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade for WebALT.`; userSlope:=Get(TFSlope::anything, corrections, update); if userSlope=f(x) then Set(TFSlopeMsg=TEXTCorrect, TFSlopeMsg(background)=ColorCorrect, TFSlopeMsg(foreground)=ColorCorrectFrgd): Set(reply=cat(great[randgreat()],nexts1[randnext1()]), reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd): Set(BDerivCheck(enabled)=true, BDerivCheck(background)=ColorCheckButton); Set(BDerivShow(enabled)=true, BDerivShow(background)=ColorShowButton); elif userSlope=f(x)*h then Set(TFSlopeMsg=TEXTIncorrect, TFSlopeMsg(background)=ColorIncorrect, TFSlopeMsg(foreground)=ColorIncorrectFrgd): Set(reply=cat(TEXTreply2a,trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd): else Set(TFSlopeMsg=TEXTIncorrect, TFSlopeMsg(background)=ColorIncorrect, TFSlopeMsg(foreground)=ColorIncorrectFrgd): Set(reply=cat(sorry[randsorry()],trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd): end if; end proc: SlopeShow:=proc() options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade for WebALT.`; Set(TFSlope="f(x)"): Set(TFSlopeMsg=TEXTShown, TFSlopeMsg(background)=ColorShow, TFSlopeMsg(foreground)=ColorShowFrgd): Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd): Set(BDerivCheck(enabled)=true, BDerivCheck(background)=ColorCheckButton); Set(BDerivShow(enabled)=true, BDerivShow(background)=ColorShowButton); end proc: DerivHint:=proc() options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade for WebALT.`; Set(reply=TEXTDerivHint, reply(background)=ColorHint, reply(foreground)=ColorHintFrgd): end proc: DerivCheck:=proc() local userDeriv; options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade for WebALT.`; userDeriv:=Get(TFDeriv::anything, corrections, update); if userDeriv=f(x) then Set(TFDerivMsg=TEXTCorrect, TFDerivMsg(background)=ColorCorrect, TFDerivMsg(foreground)=ColorCorrectFrgd): Set(reply=great[randgreat()], reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd): Set(ARunFTC(run)=true): else Set(TFDerivMsg=TEXTIncorrect, TFDerivMsg(background)=ColorIncorrect, TFDerivMsg(foreground)=ColorIncorrectFrgd): Set(reply=cat(sorry[randsorry()],trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd): end if; end proc: DerivShow:=proc() options `Copyright 2006-10, Philip B. Yasskin and Douglas B. Meade for WebALT.`; Set(TFDeriv="f(x)"): Set(TFDerivMsg=TEXTShown, TFDerivMsg(background)=ColorShow, TFDerivMsg(foreground)=ColorShowFrgd): Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd): end proc: AreaDeriv:=Maplet(onstartup=RunWindow(MAIN), Window[MAIN]( title=TEXTtitleMAIN, defaultbutton=BPlay, [ valign=none, halign=none, inset=0, spacing=0, background=ColorBkgd, [ background=ColorBkgd, halign=none, TextBox(TEXT0a, width=80, height=2, background=ColorMessage, editable=false), HorizontalGlue(), Button(TEXTBQuit, Shutdown(), background=ColorCloseButton) ], [ valign=none, halign=none, inset=0, spacing=0, background=ColorBkgd, [ background=ColorBkgd, border=true, halign=none, inset=0, spacing=0, caption=TEXT1cap, [ background=ColorBkgd, halign=none, inset=0, spacing=0, TextBox(TEXT1a, width=20, height=1, background=ColorMessage, editable=false), " ", MathMLViewer[MMLarea](value=MathML[Export]( `A'`(x) = Limit((A(x+h)-A(x))/h, h=0) ), height=50, width=250) ], [ background=ColorBkgd, halign=none, inset=0, spacing=0, CheckBox[CBPlotArea](TEXTCBPlotArea, Evaluate(function="PlotIt"), background=ColorBkgd), HorizontalGlue(), TextBox(TEXT1b, width=58, height=3, background=ColorMessage, editable=false) ], [ background=ColorBkgd, halign=none, inset=0, spacing=0, TextBox(TEXT1c, width=73, height=2, background=ColorMessage, editable=false), HorizontalGlue() ], [ background=ColorBkgd, halign=none, inset=0, spacing=0, CheckBox[CBPlotRect](TEXTCBPlotRect, Evaluate(function="PlotIt"), background=ColorBkgd), HorizontalGlue(), TextBox(TEXT1d, width=58, height=3, background=ColorMessage, editable=false) ], [ background=ColorBkgd, halign=none, inset=0, spacing=0, TextBox(TEXT1e, width=73, height=1, background=ColorMessage, editable=false) ] ], [ background=ColorBkgd, border=true, inset=0, spacing=0, caption=TEXTCapAnim, Plotter[PFTC](d00, height=200, width=350, play=true), [ background=ColorBkgd, Button[BPlay](TEXTBPlay, onclick=SetOption(PFTC(play)=true), background=ColorPlotButton, foreground=ColorPlotButtonFrgd), Button[BPause](TEXTBPause, onclick=SetOption(PFTC(pause)=true), background=ColorPlotButton, foreground=ColorPlotButtonFrgd), Button[BStep](TEXTBStep, onclick=Action(SetOption(PFTC(pause)=true), SetOption(PFTC(frame_forward)=true)), background=ColorPlotButton, foreground=ColorPlotButtonFrgd) ], [ halign=none, background=ColorBkgd, TEXTSlower, Slider[SlSpeed](0..500, 250, filled=true, majorticks=50, snapticks=false, showlabels=false, onchange=Evaluate(function="SetSpeed"), background=ColorPlotButton, foreground=ColorPlotButtonFrgd), TEXTFaster ] ] ], [ valign=none, background=ColorBkgd, inset=0, [ valign=none, background=ColorBkgd, border=true, inset=0, spacing=0, caption=TEXT3cap, [ background=ColorBkgd, spacing=0, halign=none, TEXTApproximate, MathMLViewer[MMLDiff](value=MathML[Export]( A(x+h)-A(x) ), height=30, width=200), Label(" H "), # The " H " does not always work. I want an approximate equal sign, but how do I get it? TextField[TFDiff]("", width=20, background=ColorInput), HorizontalGlue(), Button[BDiffHint](TEXTBHint, Evaluate(function="DiffHint"), background=ColorHintButton), Button[BDiffCheck](TEXTBCheck, Evaluate(function="DiffCheck"), background=ColorCheckButton), TextField[TFDiffMsg]("", width=6, editable=false, background=ColorMessage), Button[BDiffShow](TEXTBShow, Evaluate(function="DiffShow"), background=ColorShowButton) ], [ background=ColorBkgd, spacing=0, halign=none, TEXTApproximate, MathMLViewer[MMLSlope](value=MathML[Export]( (A(x+h)-A(x))/h ), height=40, width=200), Label(" H "), # The " H " does not always work. I want an approximate equal sign, but how do I get it? TextField[TFSlope]("", width=20, background=ColorInput), HorizontalGlue(), Button[BSlopeHint](TEXTBHint, Evaluate(function="SlopeHint"), background=ColorHintButton), Button[BSlopeCheck](TEXTBCheck, Evaluate(function="SlopeCheck"), background=ColorDisable, enabled=false), TextField[TFSlopeMsg]("", width=6, editable=false, background=ColorMessage), Button[BSlopeShow](TEXTBShow, Evaluate(function="SlopeShow"), background=ColorDisable, enabled=false) ], [ background=ColorBkgd, spacing=0, halign=none, TEXTSo, MathMLViewer[MMLDeriv](value=MathML[Export](` A'`(x) = Limit((A(x+h)-A(x))/h, h=0) ), height=50, width=250), " = ", TextField[TFDeriv]("", width=20, background=ColorInput), HorizontalGlue(), Button[BDerivHint](TEXTBHint, Evaluate(function="DerivHint"), background=ColorHintButton), Button[BDerivCheck](TEXTBCheck, Evaluate(function="DerivCheck"), background=ColorDisable, enabled=false), TextField[TFDerivMsg]("", width=6, editable=false, background=ColorMessage), Button[BDerivShow](TEXTBShow, Evaluate(function="DerivShow"), background=ColorDisable, enabled=false) ] ] ], [ background=ColorBkgd, TextBox[reply](width=100, 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) ] ) ]),#close BoxColumn, Window, Window[FTC]( title=TEXTtitleFTC, defaultbutton=BCloseFTC, [ background=ColorBkgd, halign=none, [ background=ColorBkgd, halign=none, TEXT4a, HorizontalGlue(), Button[BCloseFTC](TEXTBClose, CloseWindow(FTC), background=ColorCloseButton) ], [ background=ColorBkgd, halign=none, HorizontalGlue(), TextField(TEXT4b, width=25, background=ColorHint), HorizontalGlue() ], [ background=ColorBkgd, halign=none, TextBox(TEXT4c, height=3, width=75, background=ColorHint) ] ]),#close BoxColumn, Window, Action[ARunFTC](RunWindow(FTC)) ): #close Maplet Maplets[Display](AreaDeriv);