# Work: Spring # Yasskin, Matthew Barry # # ################################## # # 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 2005-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 Maplet #with(plots):with(plottools): #with(RandomTools): #alias(e=exp(1)): nextlocal:=[ NULL ]: trylocal:=[ NULL ]: showlocal:=[ NULL ]: nextF:=[ " Now find the force.", " Use the constant to find the force.", NULL ]: nextW:=[ " May the force be with you. Find the Work.", " Now find the work.", " Use the constant to find the work.", NULL ]: nextsF:=[ #Keep what is appropriate. This is for all but the last check. op(nextgeneric), #op(nextprob), op(nextquest), op(nextpart), op(nextstep), op(nextF), NULL ]: nextsW:=[ #Keep what is appropriate. This is for all but the last check. op(nextgeneric), #op(nextprob), op(nextquest), op(nextpart), op(nextstep), op(nextW), 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)): randnextF:=rand(1..nops(nextsF)): randnextW:=rand(1..nops(nextsW)): 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 WorkSpring TEXTLasstprogrammer:= "Assistant Programmer: Matthew Barry": TEXTtitleMAIN:= "Work: Spring": TEXTLa:= " to the point x =": TEXTL1a:= "Assume the force required to maintain the spring in this position is F =": TEXTL1b:= "Assume the work required to stretch the spring was W =": TEXTL1c:= "Find the force required to maintain the spring at the point x =": TEXTL1d:= "Find the work done to stretch the spring from x =": TEXTreply1a:= "Your numeric value is correct but the unit is wrong.": TEXTreply1b:= "Read the Hint and try again.": TEXTreply1c:= "Read the Hint and try again. Also check your unit.": TEXTreply2a:= "Your numeric value is correct but the unit is wrong.": TEXTreply2b:= "In computing the %s, you did not account for the rest position. Read the Hint and try again.": TEXTreply2c:= "In computing the %s, you did not account for the rest position. Read the Hint and try again. Also check your unit.": TEXTreply2d:= "At least your unit is correct. ": TEXTreply2e:= " Also check your unit.": TEXTto:= " to ": TEXTwork:= "work": TEXTforce:= "force": TEXTUnits:= "Units:": TEXTL1:= "A spring is stretched from its rest position at x =": TEXTL2:= "Assume the force required to maintain the spring in this position is F =": TEXTL3:= "Find the force constant:": TEXTL4:= "Find the work done to stretch the spring from x =": TEXTSelectUnit:= "Select Unit": TEXTPL1:= "Rest Position: x =": TEXTPL2:= "Initial Stretched Position: x =": TEXTPCap1:= "Specify initial given information:": TEXTPCap2:= "Specify problem question:": TEXTPinitF:= "The force required to maintain the spring in this position is": TEXTPinitW:= "The work required to stretch the spring to this position was": TEXTPfinF:= "Find the force required to maintain the spring at the point": TEXTPfinW:= "Find the work done to stretch the spring from": TEXTHL1:= "Assume a spring has spring constant k and its rest position is at x = x0.": TEXTHL2:= "The force required to stretch the spring to x = x1 is:": TEXTHL3:= "The work required to stretch the spring from x = x1 to x = x2 is:": # ################################## ks:=[2,3,4,5,6,8,9,10,12,15,16,18,20]: randk:=rand(1..nops(ks)): rand04:=rand(0..4): rand14:=rand(1..4): rand02:=rand(0..2): rand03:=rand(0..3): unittype:=1: lengthunit,forceunit,workunit,springunit:="m","N","J","N/m": x1, x2, Finit, Winit:="", "", "", "": RandomProblem:=proc() global x0, xi, x1, x2, Finit, Winit, unittype, inittype, probtype, ks, randk, rand04, rand14, rand02, rand03, spring_k, Ffin, FfinWRONG, Wfin, WfinWRONG1, WfinWRONG2, lengthunit, forceunit, workunit, springunit; options `Copyright 2005-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; unittype:=rand02(); if unittype=0 then #cgs lengthunit,forceunit,workunit,springunit:="cm","dyne","erg","dyne/cm"; elif unittype=1 then #mks lengthunit,forceunit,workunit,springunit:="m","N","J","N/m"; else #fps lengthunit,forceunit,workunit,springunit:="ft","lb","ft-lb","lb/ft"; end if; Set(LUx0(caption)=cat(lengthunit,TEXTLa)): Set(LUxi(caption)=cat(lengthunit,".")): Set(LUx1(caption)=cat(lengthunit,TEXTLa)): Set(LUx2(caption)=cat(lengthunit,":")): Set(DDB1=TEXTSelectUnit): Set(DDB2=TEXTSelectUnit): spring_k:=ks[randk()]; x0:=rand04(); xi:=x0+rand14(); if rand02() < 2 then inittype:=force; if rand03() < 3 then probtype:=work; x1:=x0+rand04(); x2:=x1+rand14(); else probtype:=force; x2:=x0+rand14(); while x2=xi do x2:=x0+rand14(); end do; end if; else inittype:=work; if rand03() < 2 then probtype:=work; x1:=x0+rand04(); x2:=x1+rand14(); while x2=xi and x1=x0 do x2:=x1+rand14(); end do; else probtype:=force; x2:=x0+rand14(); end if; end if; Set(TFx0=x0): Set(TFxi=xi): Set(TFx1=x1): Set(TFx2=x2): if inittype=force then Finit:=spring_k*(xi-x0); Winit:=""; Set(Linit(caption)=TEXTL1a): Set(TFinit=Finit): Set(LUnitinit(caption)=cat(forceunit,".")): else # So inittype=work Finit:=""; Winit:=spring_k/2*(xi-x0)^2; Set(Linit(caption)=TEXTL1b): Set(TFinit=Winit): Set(LUnitinit(caption)=cat(workunit,".")): end if; if probtype=force then Ffin:=spring_k*(x2-x0); FfinWRONG:=spring_k*x2; #Forgot rest position Set(LfinQ(caption)=TEXTL1c): Set(TFx1(visible)=false): Set(LUx1(visible)=false): Set(Lfin(caption)="F ="): else # So probtype=work Wfin:=spring_k/2*((x2-x0)^2-(x1-x0)^2); WfinWRONG1:=spring_k/2*(x2^2-x1^2); #Forgot rest position WfinWRONG2:=spring_k/2*(x2-x1)^2; #Forgot rest position Set(LfinQ(caption)=TEXTL1d): Set(TFx1(visible)=true): Set(LUx1(visible)=true): Set(Lfin(caption)="W ="): end if; Set(TFk=""): Set(TFkck="", TFkck(background)=ColorMessage, TFkck(foreground)=ColorMessageFrgd): Set(BkCk(enabled)=true, BkCk(background)=ColorCheckButton): Set(BkSh(enabled)=true, BkSh(background)=ColorShowButton): Set(TFfin=""): Set(TFfinck="", TFfinck(background)=ColorMessage, TFfinck(foreground)=ColorMessageFrgd): Set(BfinCk(enabled)=false, BfinCk(background)=ColorDisable): Set(BfinSh(enabled)=false, BfinSh(background)=ColorDisable): Set(reply="", reply(background)=ColorMessage, reply(foreground)=ColorMessageFrgd): end proc: InitializeProblem:=proc() global x0, xi, x1, x2, Finit, Winit, unittype, inittype, probtype, ks, randk, rand04, rand14, rand02, rand03, spring_k, Ffin, FfinWRONG, Wfin, WfinWRONG1, WfinWRONG2, lengthunit, forceunit, workunit, springunit; options `Copyright 2005-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if unittype=0 then Set(RBcgs=true); elif unittype=1 then Set(RBmks=true); else Set(RBfps=true); end if; Set(LUNewx0(caption)=cat(lengthunit,".")): Set(LUNewxi(caption)=cat(lengthunit,".")): Set(LUNewinitF(caption)=cat(forceunit,".")): Set(LUNewinitW(caption)=cat(workunit,".")): Set(LUNewFx(caption)=cat(lengthunit,".")): Set(LUNewx1(caption)=lengthunit): Set(LUNewx2(caption)=cat(lengthunit,".")): Set(TFNewx0=x0); Set(TFNewxi=xi); if inittype=force then Set(TFNewinitF=Finit, TFNewinitF(enabled)=true, TFNewinitF(background)=ColorInput); Set(TFNewinitW="", TFNewinitW(enabled)=false, TFNewinitW(background)=ColorDisable): Set(RBinitF=true); else # So inittype=work Set(TFNewinitF="", TFNewinitF(enabled)=false, TFNewinitF(background)=ColorDisable): Set(TFNewinitW=Winit, TFNewinitW(enabled)=true, TFNewinitW(background)=ColorInput); Set(RBinitW=true); end if; if probtype=force then Set(TFNewFx=x2, TFNewFx(enabled)=true, TFNewFx(background)=ColorInput); Set(TFNewx1="", TFNewx1(enabled)=false, TFNewx1(background)=ColorDisable); Set(TFNewx2="", TFNewx2(enabled)=false, TFNewx2(background)=ColorDisable); Set(RBfinF=true); else # So probtype=work Set(TFNewFx="", TFNewFx(enabled)=false, TFNewFx(background)=ColorDisable); Set(TFNewx1=x1, TFNewx1(enabled)=true, TFNewx1(background)=ColorInput); Set(TFNewx2=x2, TFNewx2(enabled)=true, TFNewx2(background)=ColorInput); Set(RBfinW=true); end if; end proc: ChangeUnits:=proc() global lengthunittmp, forceunittmp, workunittmp, springunittmp; options `Copyright 2005-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(RBcgs) then lengthunittmp, forceunittmp, workunittmp, springunittmp:="cm","dyne","erg","dyne/cm"; elif Get(RBmks) then lengthunittmp, forceunittmp, workunittmp, springunittmp:="m","N","J","N/m"; elif Get(RBfps) then lengthunittmp, forceunittmp, workunittmp, springunittmp:="ft","lb","ft-lb","lb/ft"; end if; Set(LUNewx0(caption)=cat(lengthunittmp,".")): Set(LUNewxi(caption)=cat(lengthunittmp,".")): Set(LUNewinitF(caption)=cat(forceunittmp,".")): Set(LUNewinitW(caption)=cat(workunittmp,".")): Set(LUNewFx(caption)=cat(lengthunittmp,".")): Set(LUNewx1(caption)=lengthunittmp): Set(LUNewx2(caption)=cat(lengthunittmp,".")): end proc: Changeinit:=proc() global inittypetmp; options `Copyright 2005-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(RBinitF) then inittypetmp=force; Set(TFNewinitF(enabled)=true, TFNewinitF(background)=ColorInput): Set(TFNewinitW="", TFNewinitW(enabled)=false, TFNewinitW(background)=ColorDisable): elif Get(RBinitW) then inittypetmp=work; Set(TFNewinitF="", TFNewinitF(enabled)=false, TFNewinitF(background)=ColorDisable): Set(TFNewinitW(enabled)=true, TFNewinitW(background)=ColorInput): end if; end proc: Changefin:=proc() global probtypetmp; options `Copyright 2005-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(RBfinF) then probtypetmp=force; Set(TFNewFx(enabled)=true, TFNewFx(background)=ColorInput): Set(TFNewx1="", TFNewx1(enabled)=false, TFNewx1(background)=ColorDisable): Set(TFNewx2="", TFNewx2(enabled)=false, TFNewx2(background)=ColorDisable): elif Get(RBfinW) then probtypetmp=work; Set(TFNewFx="", TFNewFx(enabled)=false, TFNewFx(background)=ColorDisable): Set(TFNewx1(enabled)=true, TFNewx1(background)=ColorInput): Set(TFNewx2(enabled)=true, TFNewx2(background)=ColorInput): end if; end proc: MakeProblem:=proc() global x0, xi, x1, x2, Finit, Winit, unittype, inittype, probtype, ks, randk, rand04, rand14, rand02, rand03, spring_k, Ffin, FfinWRONG, Wfin, WfinWRONG1, WfinWRONG2, lengthunit, forceunit, workunit, springunit; options `Copyright 2005-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(TFNewx0)="" or Get(TFNewxi)="" or (Get(RBinitF) and Get(TFNewinitF)="") or (Get(RBinitW) and Get(TFNewinitW)="") or (Get(RBfinF) and Get(TFNewFx)="") or (Get(RBfinW) and (Get(TFNewx1)="" or Get(TFNewx2)="")) then Set(reply=TEXTreplyNoSaveProblem, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; if Get(RBcgs) then unittype:=0; lengthunit, forceunit, workunit, springunit:="cm","dyne","erg","dyne/cm"; elif Get(RBmks) then unittype:=1; lengthunit, forceunit, workunit, springunit:="m","N","J","N/m"; elif Get(RBfps) then unittype:=2; lengthunit, forceunit, workunit, springunit:="ft","lb","ft-lb","lb/ft"; end if; Set(LUx0(caption)=cat(lengthunit, TEXTLa)): Set(LUxi(caption)=cat(lengthunit,".")): Set(LUx1(caption)=cat(lengthunit, TEXTLa)): Set(LUx2(caption)=cat(lengthunit,":")): Set(DDB1=TEXTSelectUnit): Set(DDB2=TEXTSelectUnit): x0:=Get(TFNewx0::realcons, corrections=true, update=true); xi:=Get(TFNewxi::realcons, corrections=true, update=true); if Get(RBinitF) then inittype:=force; Finit:=Get(TFNewinitF::realcons, corrections=true, update=true); Winit:=""; spring_k:=Finit/(xi-x0); Set(Linit(caption)=TEXTL1a): Set(TFinit=Finit): Set(LUnitinit(caption)=cat(forceunit,".")): Set(AClosePROBLEM(run)=true): else inittype:=work; Finit:=""; Winit:=Get(TFNewinitW::realcons, corrections=true, update=true); spring_k:=2*Winit/(xi-x0)^2; Set(Linit(caption)=TEXTL1b): Set(TFinit=Winit): Set(LUnitinit(caption)=cat(workunit,".")): end if; if Get(RBfinF) then probtype:=force; x1:=""; x2:=Get(TFNewFx::realcons, corrections=true, update=true); Ffin:=spring_k*(x2-x0); FfinWRONG:=spring_k*x2; #Forgot rest position Set(LfinQ(caption)=TEXTL1c): Set(TFx1(visible)=false): Set(LUx1(visible)=false): Set(Lfin(caption)="F ="): Set(AClosePROBLEM(run)=true): else probtype:=work; x1:=Get(TFNewx1::realcons, corrections=true, update=true); x2:=Get(TFNewx2::realcons, corrections=true, update=true); Wfin:=spring_k/2*((x2-x0)^2-(x1-x0)^2); WfinWRONG1:=spring_k/2*(x2^2-x1^2); #Forgot rest position WfinWRONG2:=spring_k/2*(x2-x1)^2; #Forgot rest position Set(LfinQ(caption)=TEXTL1d): Set(TFx1(visible)=true): Set(LUx1(visible)=true): Set(Lfin(caption)="W ="): Set(AClosePROBLEM(run)=true): end if; Set(TFx0=x0): Set(TFxi=xi): Set(TFx1=x1): Set(TFx2=x2): Set(TFk=""): Set(TFkck="", TFkck(background)=ColorMessage, TFkck(foreground)=ColorMessageFrgd): Set(BkCk(enabled)=true, BkCk(background)=ColorCheckButton): Set(BkSh(enabled)=true, BkSh(background)=ColorShowButton): Set(TFfin=""): Set(TFfinck="", TFfinck(background)=ColorMessage, TFfinck(foreground)=ColorMessageFrgd): Set(BfinCk(enabled)=false, BfinCk(background)=ColorDisable): Set(BfinSh(enabled)=false, BfinSh(background)=ColorDisable): Set(reply="", reply(background)=ColorMessage, reply(foreground)=ColorMessageFrgd): end proc: Check_k:=proc() local user_k, user_unit; global spring_k, springunit, probtype; options `Copyright 2005-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(TFk)="" then Set(reply=TEXTreplyNoCheck, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; user_k:=Get(TFk::realcons, corrections=true, update=true): user_unit:=Get(DDB1, corrections=true, update=true): if simplify(normal(spring_k - user_k))= 0 then if user_unit=springunit then Set(TFkck=TEXTCorrect, TFkck(background)=ColorCorrect, TFkck(foreground)=ColorCorrectFrgd): Set(reply=cat(great[randgreat()], `if`(probtype=force,nextsF[randnextF()],nextsW[randnextW()])), reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd); Set(BfinCk(enabled)=true, BfinCk(background)=ColorCheckButton): Set(BfinSh(enabled)=true, BfinSh(background)=ColorShowButton): else Set(TFkck=TEXTWarning, TFkck(background)=ColorWarning, TFkck(foreground)=ColorWarningFrgd): Set(reply=TEXTreply1a, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); Set(TFfin=""): Set(DDB2=TEXTSelectUnit): Set(TFfinck="", TFfinck(background)=ColorMessage, TFfinck(foreground)=ColorMessageFrgd): Set(BfinCk(enabled)=false, BfinCk(background)=ColorDisable): Set(BfinSh(enabled)=false, BfinSh(background)=ColorDisable): end if; else if user_unit=springunit then Set(TFkck=TEXTIncorrect, TFkck(background)=ColorIncorrect, TFkck(foreground)=ColorIncorrectFrgd): Set(reply=sprintf(TEXTreply1b, TEXTforce), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); Set(TFfin=""): Set(DDB2=TEXTSelectUnit): Set(TFfinck="", TFfinck(background)=ColorMessage, TFfinck(foreground)=ColorMessageFrgd): Set(BfinCk(enabled)=false, BfinCk(background)=ColorDisable): Set(BfinSh(enabled)=false, BfinSh(background)=ColorDisable): else Set(TFkck=TEXTIncorrect, TFkck(background)=ColorIncorrect, TFkck(foreground)=ColorIncorrectFrgd): Set(reply=sprintf(TEXTreply1c, TEXTforce), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); Set(TFfin=""): Set(DDB2=TEXTSelectUnit): Set(TFfinck="", TFfinck(background)=ColorMessage, TFfinck(foreground)=ColorMessageFrgd): Set(BfinCk(enabled)=false, BfinCk(background)=ColorDisable): Set(BfinSh(enabled)=false, BfinSh(background)=ColorDisable): end if; end if; end proc: Show_k:=proc() global spring_k, springunit; options `Copyright 2005-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; Set(TFk=spring_k): Set(DDB1=springunit): Set(TFkck=TEXTShown, TFkck(background)=ColorShow, TFkck(foreground)=ColorShowFrgd): Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd): Set(BfinCk(enabled)=true, BfinCk(background)=ColorCheckButton): Set(BfinSh(enabled)=true, BfinSh(background)=ColorShowButton): end proc: Check_fin:=proc() local user_fin, user_unit; global probtype, Ffin, FfinWRONG, Wfin, WfinWRONG1, WfinWRONG2, forceunit, workunit; options `Copyright 2005-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if Get(TFfin)="" then Set(reply=TEXTreplyNoCheck, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); return; end if; user_fin:=Get(TFfin::realcons, corrections=true, update=true): user_unit:=Get(DDB2, corrections=true, update=true): if probtype=force then if simplify(normal(Ffin - user_fin))=0 then if user_unit=forceunit then Set(TFfinck=TEXTCorrect, TFfinck(background)=ColorCorrect, TFfinck(foreground)=ColorCorrectFrgd): Set(reply=cat(great[randgreat()], nexts2[randnext2()]), reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd); else Set(TFfinck=TEXTWarning, TFfinck(background)=ColorWarning, TFfinck(foreground)=ColorWarningFrgd): Set(reply=TEXTreply2a, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); end if; elif simplify(normal(FfinWRONG - user_fin))=0 then if user_unit=forceunit then Set(TFfinck=TEXTIncorrect, TFfinck(background)=ColorIncorrect, TFfinck(foreground)=ColorIncorrectFrgd): Set(reply=sprintf(TEXTreply2b, TEXTwork), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); else Set(TFfinck=TEXTIncorrect, TFfinck(background)=ColorIncorrectFrgd, TFfinck(foreground)=ColorIncorrectFrgd): Set(reply=sprintf(TEXTreply2c, TEXTwork), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); end if; else if user_unit=forceunit then Set(TFfinck=TEXTIncorrect, TFfinck(background)=ColorIncorrect, TFfinck(foreground)=ColorIncorrectFrgd): Set(reply=cat(sorry[randsorry()], TEXTreply2d, trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); else Set(TFfinck=TEXTIncorrect, TFfinck(background)=ColorIncorrect, TFfinck(foreground)=ColorIncorrectFrgd): Set(reply=cat(sorry[randsorry()], trys[randtry()], TEXTreply2e), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); end if; end if; else #probtype=work if simplify(normal(Wfin - user_fin))=0 then if user_unit=workunit then Set(TFfinck=TEXTCorrect, TFfinck(background)=ColorCorrect, TFfinck(foreground)=ColorCorrectFrgd): Set(reply=cat(great[randgreat()], nexts2[randnext2()]), reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd); else Set(TFfinck=TEXTWarning, TFfinck(background)=ColorWarning, TFfinck(foreground)=ColorWarningFrgd): Set(reply=TEXTreply2a, reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd); end if; elif simplify(normal(WfinWRONG1 - user_fin))=0 or simplify(normal(WfinWRONG2 - user_fin))=0 then if user_unit=workunit then Set(TFfinck=TEXTIncorrect, TFfinck(background)=ColorIncorrect, TFfinck(foreground)=ColorIncorrectFrgd): Set(reply=TEXTreply2b, reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); else Set(TFfinck=TEXTIncorrect, TFfinck(background)=ColorIncorrect, TFfinck(foreground)=ColorIncorrectFrgd): Set(reply=sprintf(TEXTreply2c, TEXTwork), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); end if; else if user_unit=workunit then Set(TFfinck=TEXTIncorrect, TFfinck(background)=ColorIncorrect, TFfinck(foreground)=ColorIncorrectFrgd): Set(reply=cat(sorry[randsorry()], TEXTreply2d, trys[randtry()]), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); else Set(TFfinck=TEXTIncorrect, TFfinck(background)=ColorIncorrect, TFfinck(foreground)=ColorIncorrectFrgd): Set(reply=cat(sorry[randsorry()], trys[randtry()], TEXTreply2e), reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd); end if; end if; end if; end proc: Show_fin:=proc() global probtype, Ffin, Wfin; options `Copyright 2005-10, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`; if probtype=force then Set(TFfin=Ffin): Set(DDB2=forceunit): else #probtype=work Set(TFfin=Wfin): Set(DDB2=workunit): end if; Set(TFfinck=TEXTShown, TFfinck(background)=ColorShow, TFfinck(foreground)=ColorShowFrgd): Set(reply=shows[randshow()], reply(background)=ColorShow, reply(foreground)=ColorShowFrgd): end proc: Work_Spring:=Maplet(onstartup=StartMAIN, Window[MAIN]( title=TEXTtitleMAIN, defaultbutton=BHint, [ background=ColorBkgd, halign=none, BoxRow( background=ColorBkgd, Button[Bnew](TEXTBNewProblem, Evaluate(function="RandomProblem"), background=ColorNewButton), TEXTor, Button(TEXTBMake, onclick=AMakeProblem, background=ColorNewButton ), HorizontalGlue(), Button[BHint](TEXTBHint, RunWindow(HINT), background=ColorHintButton), Button(TEXTBQuit, Shutdown(), background=ColorCloseButton) ), BoxColumn( border=true, inset=0, background=ColorBkgd, halign=none, [ background=ColorBkgd, TEXTL1, TextField[TFx0]("", width=3, editable=false, background=ColorMessage), Label[LUx0](cat("m",TEXTLa)), TextField[TFxi]("", width=3, editable=false, background=ColorMessage), Label[LUxi]("m."), HorizontalGlue() ], [ background=ColorBkgd, Label[Linit](TEXTL2), TextField[TFinit]("", width=3, editable=false, background=ColorMessage), Label[LUnitinit]("N."), HorizontalGlue() ] ), BoxColumn( border=true, inset=0, background=ColorBkgd, halign=none, [ background=ColorBkgd, TEXTL3, HorizontalGlue() ], [ background=ColorBkgd, "k =", TextField[TFk](width=10, background=ColorInput), DropDownBox[DDB1]([TEXTSelectUnit, "dyne-cm", "dyne/cm", "ft-lb", "lb/ft", "N-m", "N/m"]), HorizontalGlue(), Button[BkCk](TEXTBCheck, Evaluate(function="Check_k"), enabled=false, background=ColorDisable), TextField[TFkck](width=6, editable=false, background=ColorMessage), Button[BkSh](TEXTBShow, Evaluate(function="Show_k"), enabled=false, background=ColorDisable) ] ), BoxColumn( border=true, inset=0, background=ColorBkgd, halign=none, [ background=ColorBkgd, Label[LfinQ](TEXTL4), TextField[TFx1]("", width=3, editable=false, background=ColorMessage), Label[LUx1](cat("m",TEXTLa)), TextField[TFx2]("", width=3, editable=false, background=ColorMessage), Label[LUx2]("m:"), HorizontalGlue() ], [ background=ColorBkgd, Label[Lfin]("W ="), TextField[TFfin](width=10, background=ColorInput), DropDownBox[DDB2]([TEXTSelectUnit, "dyne", "erg", "ft-lb", "J", "lb", "N"]), HorizontalGlue(), Button[BfinCk](TEXTBCheck, Evaluate(function="Check_fin"), enabled=false, background=ColorDisable), TextField[TFfinck](width=6, editable=false, background=ColorMessage), Button[BfinSh](TEXTBShow, Evaluate(function="Show_fin"), enabled=false, background=ColorDisable) ] ), 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) ] ) ]), Window[PROBLEM]( title=TEXTtitlePROBLEM,# defaultbutton=BSaveClose, BoxColumn(halign=none, background=ColorBkgd, BoxColumn( background=ColorBkgd, border=true, inset=0, halign=none, caption=TEXTCapSpecify, [ background=ColorBkgd, TEXTUnits, RadioButton[RBcgs]("cgs", value=false, group=BGunits, background=ColorBkgd), RadioButton[RBmks]("mks", value=true, group=BGunits, background=ColorBkgd), RadioButton[RBfps]("fps", value=false, group=BGunits, background=ColorBkgd), HorizontalGlue() ], [ background=ColorBkgd, TEXTPL1, TextField[TFNewx0]("", width=3, background=ColorInput), Label[LUNewx0]("m."), HorizontalGlue(), TEXTPL2, TextField[TFNewxi]("", width=3, background=ColorInput), Label[LUNewxi]("m."), HorizontalGlue() ] ), BoxColumn( background=ColorBkgd, border=true, inset=0, halign=none, caption=TEXTPCap1, [ background=ColorBkgd, RadioButton[RBinitF](TEXTPinitF, value=true, group=BGinittype, background=ColorBkgd), HorizontalGlue(), "F =", TextField[TFNewinitF]("", width=3, background=ColorInput), Label[LUNewinitF]("N.") ], [ background=ColorBkgd, RadioButton[RBinitW](TEXTPinitW, value=false, group=BGinittype, background=ColorBkgd), HorizontalGlue(), "W =", TextField[TFNewinitW]("", width=3, enabled=false, background=ColorDisable), Label[LUNewinitW]("J.") ] ), BoxColumn( background=ColorBkgd, border=true, inset=0, halign=none, caption=TEXTPCap2, [ background=ColorBkgd, RadioButton[RBfinF](TEXTPfinF, value=false, group=BGfintype, background=ColorBkgd), HorizontalGlue(), "x =", TextField[TFNewFx]("", width=3, enabled=false, background=ColorBkgd), Label[LUNewFx]("m.") ], [ background=ColorBkgd, RadioButton[RBfinW](TEXTPfinW, value=true, group=BGfintype, background=ColorBkgd), HorizontalGlue(), "x =", TextField[TFNewx1]("", width=3, background=ColorInput), Label[LUNewx1]("m"), cat(TEXTto," x ="), TextField[TFNewx2]("", width=3, background=ColorInput), Label[LUNewx2]("m.") ] ), [ background=ColorBkgd, HorizontalGlue(), Button[BSaveClose](TEXTBSaveClose, onclick=ASaveProblem, background=ColorNewButton), Button(TEXTBClose, onclick=CloseWindow(PROBLEM), background=ColorCloseButton), HorizontalGlue() ] ) ), Window[HINT]( title=TEXTtitleHINT, defaultbutton=CloseHint, [ background=ColorBkgd, halign=none, [ background=ColorBkgd, HorizontalGlue(), Button[CloseHint](TEXTBClose, CloseWindow(HINT), background=ColorCloseButton) ], [ background=ColorBkgd, TEXTHL1, HorizontalGlue() ], [ background=ColorBkgd, TEXTHL2, HorizontalGlue() ], [ background=ColorBkgd, MathMLViewer( value=MathML[Export]( F = k * (x[1]-x[0])), height=40, width=200), HorizontalGlue() ], [ background=ColorBkgd, TEXTHL3, HorizontalGlue() ], [ background=ColorBkgd, MathMLViewer( value=MathML[Export]( W = Int(k * (x-x[0]), x=x[1]..x[2])), height=75, width=200), HorizontalGlue() ] ]), Action[StartMAIN]( RunWindow(PROBLEM), CloseWindow(PROBLEM), RunWindow(MAIN) ), Action[AMakeProblem]( Evaluate(function="InitializeProblem"), RunWindow(PROBLEM) ), Action[ASaveProblem]( Evaluate(function="MakeProblem") ), Action[AClosePROBLEM]( CloseWindow(PROBLEM) ), ButtonGroup[BGunits](onchange=Evaluate(function="ChangeUnits")), ButtonGroup[BGinittype](onchange=Evaluate(function="Changeinit")), ButtonGroup[BGfintype](onchange=Evaluate(function="Changefin")) ): Maplets[Display]( Work_Spring );