Zach Abeyta & Jeff Brown
Finding Horizontal AsymptotesMath 151 Honors: Sec 202Fall 2011Instructor: Philip YasskinEdited by Katherine DavisHeader For All Mapletsrestart:
with(Maplets[Elements]):with(Maplets[Tools]):
StartEngine();randomize():lightorange:="#FFB300":
lightcyan:="#DDFFFF":
lightblue:="#CFCFFF":
lightgreen:="#CCFFCC":
darkgreen:="#00C000":
darkmaroon:="#CC0000":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:=yellow:
ColorPlotButton:=gold: ColorPlotButtonFrgd:=black:
ColorPlotFrame:=gold:
ColorTableBkgd:=lightgreen:
ColorCalculatorBkgd:=gold:
ColorBlackBox:=black: ColorBlackBoxFrgd:=yellow:
ColorMessage:=white: ColorMessageFrgd:=black:
ColorInput:=turquoise: ColorInputFrgd:=black: # or RadioButton, CheckBox, DropDownBox
ColorCorrect:=green: ColorCorrectFrgd:=black:
ColorIncorrect:=red: ColorIncorrectFrgd:=white:
ColorWarning:=yellow: ColorWarningFrgd:=black: #NoPrev, NoCheck
ColorShow:=yellow: ColorShowFrgd:=black:
ColorHint:=lightorange: ColorHintFrgd:=black: # or Info, Syntax, Almost
ColorDisable:=wheat: ColorDisableFrgd:=black:FontFooter:=Font("helvetica",10):
FontSymbol:=Font("symbol",12):
FontBig:=Font("times",20):
FontInstr:=Font("helvetica", bold, 12):
FontTB:=Font(SansSerif, 12):LIBLogo:=cat(libname,"/M4C/M4C.png"):
Logo:="M4C.png":
#LIBLogo:=cat(libname,"/M4C/WebALT_logo.png"):
#Logo:="WebALT_logo.png":Translation Table For All MapletsTEXTLprogrammers:=
"Programmers: D.B. Meade & P.B. Yasskin":TEXTLcopyright:=
"\302\251 Copyright: Maplets for Calculus 2005-13":
#"\302\251 Copyright: WebALT 2006-07":TEXTLversion:=
"M4C v1.4 Aug 2013":TEXTBRate:=
"Rate":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":TEXTBNewInequality:=
"New Inequality":TEXTBNewLimit:=
"New Limit":TEXTBNewDerivative:=
"New Derivative":TEXTBNewIntegral:=
"New Integral":TEXTBNewSequence:=
"New Sequence":TEXTBNewSeries:=
"New Series":TEXTBNewDiffEq:=
"New Differential Equation":TEXTBNewCurve:=
"New Curve":TEXTBDisableShow:=
"Disable Show":TEXTNameID:=
"Name or ID":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 ":TEXTHint:=
" hint ":TEXTShown:=
" shown ":TEXTTemplate:=
" template":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":TEXTSelect:=
"Select:":TEXTParallel:=
"Parallel":TEXTNotParallel:=
"Not Parallel":TEXTSkew:=
"Skew":TEXTIntersecting:=
"Intersecting":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 ColorWarning
" Please be patient while the plot is generated.":TEXTAnimWait:= #Use ColorWarning
" 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.":TEXTreplyNoEquation:=
" Please select an equation.":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.",
" 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!",
" You're unstoppable!",
" YES!",
" Perfecto!",
" You're awesome!",
" That's amazing!",
" You're a math whiz!",
" Nice job!",
" That's right!",
" That's the way!",
" I like the sound of that!",
" Ding! That's correct!",
" Right on the mark!",
" Brick...house!",
" Wonderful!",
" You're incredible!",
" All The Way!",
" Cool!",
" I Wish I Was as Smart as You!",
" Holy Smokes! You're Right!",
" You got your nerd on!",
" Mad Skillz!",
" Who are You, John Nash?",
" Who are You, Albert Einstein?",
" Dang, You're Smart!",
" Bam! Right on Target",
" You're Correct!",
" That's Money Baby!",
" Keep up the great work.",
" You're absolutely correct!",
" You know your stuff!",
" You're doing so awesome!",
" Keep on keepin' on!",
" You're doing great!",
" Keep on truckin'!",
" Correctamundo!",
" Right On!",
" Nailed that one!",
" YES!",
" Perfecto!",
" You're awesome!",
" That's amazing!",
" Holla!",
" You're super!",
" That's the way to do it.",
" Been there. Done that.",
" Your mental strength is showing.",
" Truly, you have a dizzying intellect.",
" You are powerful, as the Emperor has forseen.",
" That's the spirit.",
" Now that's how you do it!",
" I couldn't have done it better!",
" Ding Ding Ding, we have a winner.",
" Very Niiiiiiice!",
" Nicely Done.",
NULL
]:nextgeneric:=[
" Keep it up.",
" Keep going.",
" Move on to the next one!",
" Keep on keepin' on!",
" Don't stop now!",
" Go on to the next one!",
" Try the next one!",
" On to the next challenge.",
" Can you do that again?",
NULL
]:nextprob:=[
" On to the next problem.",
" Try another problem.",
" You're ready for another problem.",
" Go on to the next problem!",
" Try the next problem!",
NULL
]:nextquest:=[
" On to the next question.",
" Try another question.",
" You're ready for another question.",
" Go on to the next question!",
" Try the next question!",
NULL
]:nextpart:=[
" On to the next part.",
" Try another part.",
" You're ready for another part.",
" Go on to the next part!",
" Try the next part!",
NULL
]:nextstep:=[
" On to the next step.",
" Try another step.",
" You're ready for another step.",
" Go on to the next step!",
" Try the next step!",
NULL
]:nexteq:=[
" On to the next equation.",
" Try another equation.",
" Solve another equation.",
" You're ready for another equation.",
" Go on to the next equation!",
" Try the next equation!",
NULL
]:nextfn:=[
" On to the next function.",
" Try another function.",
" You're ready for another function.",
" Go on to the next function!",
" Try the next function!",
NULL
]:nextgraph:=[
" On to the next graph.",
" Try another graph.",
" You're ready for another graph.",
" Go on to the next graph!",
" Try the next graph!",
" On to the next plot.",
" Try another plot.",
" You're ready for another plot.",
" Go on to the next plot!",
" Try the next plot!",
NULL
]:nextlim:=[
" On to the next limit.",
" Try another limit.",
" Compute another limit.",
" You're ready for another limit.",
" Find another limit.",
" Go on to the next limit!",
" Try the next limit!",
NULL
]:nextderiv:=[
" On to the next derivative.",
" Try another derivative.",
" Compute another derivative.",
" You're ready for another derivative.",
" Differentiate another function.",
" Go on to the next derivative!",
" Try the next derivative!",
NULL
]:nextinteg:=[
" On to the next integral.",
" Try another integral.",
" Compute another integral.",
" You're ready for another integral.",
" Integrate another function.",
" Go on to the next integral!",
" Try the next integral!",
NULL
]:nextdiffeq:=[
" On to the next differential equation.",
" Try another differential equation.",
" You're ready for another differential equation.",
" Analyze another differential equation.",
" Go on to the next differential equation!",
" Try the next differential equation!",
NULL
]:nextseq:=[
" On to the next sequence.",
" Try another sequence.",
" Find the limit of another sequence.",
" You're ready for another sequence.",
" Go on to the next sequence!",
" Try the next sequence!",
NULL
]:nextser:=[
" On to the next series.",
" Try another series.",
" Sum another series.",
" You're ready for another series.",
" Go on to the next series!",
" Try the next 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.",
" Missed it by a hair.",
" Almost there.",
" Almost got it.",
" You're close.",
" Really close. You'll get it next time.",
" Oh man, you were so close.",
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.",
" C'mon, you can do it.",
" You can do better.",
" Put on your thinking cap.",
" Keep trying.",
" Never give up.",
" Never say never.",
" I have faith in you.",
" Back to the drawing board.",
" Recheck Your answer.",
" I don't think that's right.",
" Not Bad, but Not Good.",
" You're not on your A game.",
" Give it another shot!",
" Sheesh, I was hoping you were right.",
" Not quite right.",
" Keep trying, you're bound to figure it out sooner or later!",
" You better check your work.",
" Not quite right.",
" Give it another go.",
" Better luck next time.",
" Maybe you should phone a friend.",
" You are the weakest link.",
" Maybe you should use a lifeline.",
" You're having a bad day.",
" Not your day!",
" Not really what I was looking for.",
" Ummmm.....no",
" Negative",
" This one's pretty tough",
op(almost),
NULL
]:trygeneric:=[
" Fix your answer and check it again.",
" Give it another try.",
" Try again.",
" Please try again.",
" Try harder.",
" They say the third times the charm. Please try again.",
" Give it another shot.",
" Don't bail out!",
" Try again, you silly wabbit.",
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.",
" There it is. Now try it yourself.",
" There it is. Now figure it out.",
" Don't settle for seeing the answer. Work it out.",
" Now try one on your own.",
" Seeing is believing, but try it yourself.",
" You didn't really need me to show you, did you?",
" You must have pressed this by mistake, but I'll show you anyway.",
" OK now try it yourself.",
" I know how you think: You click SHOW IT so I have to do all the work! How about trying it yourself!?",
" Now try using your own mind for a change to solve the problem.",
" Do you see how it's done now? Okay now you try it.",
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 for footer lineGetVersion:=proc()
local S, S1, S3, S4;
options `Copyright 2005-13, 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:Procs to get the OS and open a web page:GetOS:=proc()
local S;
options `Copyright 2005-13, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`;
uses StringTools;
S:=LowerCase(interface(version));
piecewise(
Search("windows",S)<>0,"windows",
Search("mac",S)<>0,"mac",
Search("linux",S)<>0,"linux","unknown"
);
end proc:URLcmd:=table(["windows"="explorer", "mac"="open", "linux"="xdg-open"]):openURL:= proc(url,param)
global OScmd;
local OS;
options `Copyright 2013, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`;
if param=1 then
OS:=GetOS();
else
OS:=Get(DDBOS);
end if;
if not OS in {"windows","mac","linux"} then
Set(ARunERRORURL(run)=true);
else
system[launch](URLcmd[OS],url)
end if;
end proc:Calculator proccalculator:=proc(CalcExact)
local calc;
options `Copyright 2005-13, Philip B. Yasskin and Douglas Meade, Maplets for Calculus`;
if Get(CalcIn)="" then
return;
end if;
if CalcExact then
calc:=simplify(Get(CalcIn::realcons, corrections=true, update=true)):
else
calc:=evalf(Get(CalcIn::realcons, corrections=true, update=true)):
end if;
Set(CalcOut=calc):
end proc:Preview procfor Preview MMLViewer in a PREVIEW windowPreview:=proc(TFname,MRfield)
global CurrentTFname;
local expr;
options `Copyright 2005-13, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`;
if Get(TFname)="" then
Set(MRfield=TEXTWarning,
MRfield(background)=ColorWarning, MRfield(foreground)=ColorWarningFrgd);
Set(reply=TEXTreplyNoPrev,
reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd);
return;
end if;
CurrentTFname:=TFname;
expr:=Get(TFname::anything, corrections=true, update=true);
Set(TFPreview=expr);
Set(MMLPreview=MathML[Export](expr));
Set(ARunPreview(run)=true);
end proc:Update_Preview:=proc()
global CurrentTFname;
local expr;
options `Copyright 2005-13, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`;
if Get(TFPreview)="" then
Set(reply=TEXTreplyNoPrev,
reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd);
return;
end if;
expr:=Get(TFPreview::anything, corrections=true, update=true);
Set(MMLPreview=MathML[Export](expr));
Set(CurrentTFname=expr);
end proc:Blank the reply boxes when you change the textbox.Change_Answer:=proc(MRfield)
options `Copyright 2005-13, Philip B. Yasskin and Douglas B. Meade, Maplets for Calculus`;
Set(MRfield="", MRfield(background)=ColorMessage);
Set(reply="", reply(background)=ColorMessage);
end proc:Set Animation SpeedSetSpeed:=proc()
local speed;
options `Copyright 2004-13, Philip B. Yasskin and Douglas Meade, Maplets for Calculus`;
speed:=600 - Get(SlSpeed);
Set(PAnim(delay)=speed);
end proc:Customize For Each Mapletwith(plots):with(plottools):with(RandomTools):with(ListTools):(*alias(e=exp(1)):*)(*interface(imaginaryunit=i):*)_Envsignum0:=0:_Env_Plot_StandardInterface:=true:nextlocal1:=[
NULL
]:nextlocal2:=[
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(nextlocal1),
NULL
]:nexts2:=[ #Keep what is appropriate. This is for the last check.
op(nextgeneric),
op(nextprob),
op(nextquest),
#op(nexteq),
#op(nextfn),
#op(nextgraph),
#op(nextlim),
#op(nextderiv),
#op(nextinteg),
#op(nextdiffeq),
#op(nextseq),
#op(nextser),
op(nextlocal2),
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 Specfic MapletMapletFileName:="HorAsymp":rateURL:="http://mymathapps.com/M4C/Ratings/1.4/"||MapletFileName:TEXTtitleMAIN:=
"Finding Horizontal Asymptotes":TEXTLasstprogrammer:=
"Programmers: Zach Abeyta, Jeff Brown & Katherine Davis":
randdeg:=rand(1..3):NewProblem:=proc()
global limR, limL, AsympRCorrect, AsympLCorrect:
local topdeg, botdeg, topterms, botterms, top, bot, f, rng, asympplot:
topdeg:=randdeg();
topterms:=topdeg+1;
botdeg:=randdeg();
botterms:=botdeg+1;
top:=sort(randpoly(x, terms=topterms, degree=topdeg, coeffs=rand(-9..9)));
bot:=sort(randpoly(x, terms=botterms, degree=botdeg, coeffs=rand(-9..9)));
if bot=0 then
bot:=sort(randpoly(x, terms=botterms, degree=botdeg, coeffs=rand(1..9)));
end if;
f:=top/bot;
limR:=limit(f,x=infinity);
limL:=limit(f,x=-infinity);
AsympRCorrect:=false;
AsympLCorrect:=false;
if abs(evalf(limR))>1 or abs(evalf(limL))>1 then
rng:=10
else
rng:=5
end if:
print(f, limR, limL, rng);
asympplot:=plot([f, limR, limL], x=-15..15,
-rng..rng, discont=true,
thickness=[1, 2, 2], color=[red, blue, blue],
linestyle=[solid, dash, dash],
title=typeset('f'(x)=f),
titlefont=[Times,italic,10],
labels=[x, 'f'(x)],
labelfont=[Times,bolditalic,10]);
Set(Asympplot(value)=asympplot);
print(asympplot);
Set(MMLfunction=(f));
Set(MMLLimR=Limit(f,x=infinity));
Set(MMLLimL=Limit(f,x=-infinity));
Set(TFLimR="");
Set(TFLimL="");
Set(TFAsympR="");
Set(TFAsympL="");
Set(CBNoAsympR=false);
Set(CBNoAsympL=false);
Set(replyLimR="", replyLimR(background)=ColorMessage);
Set(replyLimL="", replyLimL(background)=ColorMessage);
Set(replyAsympR="", replyAsympR(background)=ColorMessage);
Set(replyAsympL="", replyAsympL(background)=ColorMessage);
Set(reply="", reply(background)=ColorMessage);
Set(BHintAsympR(enabled)=false);
Set(BCheckAsympR(enabled)=false);
Set(BShowAsympR(enabled)=false);
Set(BHintAsympL(enabled)=false);
Set(BCheckAsympL(enabled)=false);
Set(BShowAsympL(enabled)=false);
Set(BHintLimL(enabled)=true);
Set(BCheckLimL(enabled)=true);
Set(BShowLimL(enabled)=true);
Set(BHintLimR(enabled)=true);
Set(BCheckLimR(enabled)=true);
Set(BShowLimR(enabled)=true);
Set(BPlot(enabled)=false);
end proc: HintLimR:=proc()
Set(reply="Divide the numerator and denominator by the largest term (power of x) in the denominator.",
reply(background)=ColorHint, reply(foreground)=ColorHintFrgd);
end proc:CheckLimR:=proc()
global limR, limL, AsympRCorrect, AsympLCorrect:
local user_limR;
if Get(TFLimR)="" then
Set(replyLimR="Warning",
replyLimR(background)=ColorWarning, replyLimR(foreground)=ColorWarningFrgd);
Set(reply="You need to enter an answer.",
reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd);
return;
end if;
user_limR:=Get(TFLimR::realcons, corrections=true, update=true);
if user_limR=limR then
Set(replyLimR=TEXTCorrect,
replyLimR(background)=ColorCorrect, replyLimR(foreground)=ColorCorrectFrgd);
Set(reply="Good Job.",
reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd);
Set(BHintAsympR(enabled)=true);
Set(BCheckAsympR(enabled)=true);
Set(BShowAsympR(enabled)=true);
else
Set(replyLimR=TEXTIncorrect,
replyLimR(background)=ColorIncorrect, replyLimR(foreground)=ColorIncorrectFrgd);
Set(reply="Try Again.",
reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd);
end if;
end proc:ShowLimR:=proc()
global limR, limL, AsympRCorrect, AsympLCorrect:
Set(TFLimR=limR);
Set(replyLimR="Shown",
replyLimR(background)=ColorShow, replyLimR(foreground)=ColorShowFrgd);
Set(reply="Try it yourself.",
reply(background)=ColorShow, reply(foreground)=ColorShowFrgd);
Set(BCheckAsympR(enabled)=true);
Set(BShowAsympR(enabled)=true);
Set(BHintAsympR(enabled)=true);
end proc:HintLimL:=proc()
Set(reply="Divide the numerator and denominator by the largest term (power of x) in the denominator.",
reply(background)=ColorHint, reply(foreground)=ColorHintFrgd);
end proc:CheckLimL:=proc()
global limR, limL, AsympRCorrect, AsympLCorrect:
local user_limL;
if Get(TFLimL)="" then
Set(replyLimL="Warning",
replyLimL(background)=ColorWarning, replyLimL(foreground)=ColorWarningFrgd);
Set(reply="You need to enter an answer.",
reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd);
return;
end if;
user_limL:=Get(TFLimL::realcons, corrections=true, update=true);
if user_limL=limL then
Set(replyLimL=TEXTCorrect,
replyLimL(background)=ColorCorrect, replyLimL(foreground)=ColorCorrectFrgd);
Set(reply="Good Job.",
reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd);
Set(BHintAsympL(enabled)=true);
Set(BCheckAsympL(enabled)=true);
Set(BShowAsympL(enabled)=true);
else
Set(replyLimL=TEXTIncorrect,
replyLimL(background)=ColorIncorrect, replyLimL(foreground)=ColorIncorrectFrgd);
Set(reply="Try Again.",
reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd);
end if;
end proc:ShowLimL:=proc()
global limR, limL, AsympRCorrect, AsympLCorrect:
Set(TFLimL=limL);
Set(replyLimL="Shown",
replyLimL(background)=ColorShow, replyLimL(foreground)=ColorShowFrgd);
Set(reply="Try it yourself.",
reply(background)=ColorShow, reply(foreground)=ColorShowFrgd);
Set(BHintAsympL(enabled)=true);
Set(BCheckAsympL(enabled)=true);
Set(BShowAsympL(enabled)=true);
end proc:HintAsympR:=proc()
Set(reply="If the limit R is finite then the horizontal asymptote is y = R.\134nIf R = +/- infinity, then there is no horizontal asymptote.",
reply(background)=ColorHint, reply(foreground)=ColorHintFrgd);
end proc:CheckAsympR:=proc()
global limR, limL, AsympRCorrect, AsympLCorrect:
local user_limR, user_DNER;
user_limR:=Get(TFAsympR);
user_DNER:=Get(CBNoAsympR);
if user_limR="" and not user_DNER then
Set(replyAsympR="Warning",
replyAsympR(background)=ColorWarning, replyAsympR(foreground)=ColorWarningFrgd);
Set(reply="You need to enter an answer or select Does Not Exist.",
reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd);
return;
end if;
if user_limR<>"" and user_DNER then
Set(replyAsympR="Warning",
replyAsympR(background)=ColorWarning, replyAsympR(foreground)=ColorWarningFrgd);
Set(reply="You cannot answer both a value and Does Not Exist.",
reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd);
return;
end if;
if user_limR<>"" then
user_limR:=Get(TFAsympR::realcons, corrections=true, update=true);
end if;
if limR in {infinity,-infinity} then
if user_DNER then
Set(replyAsympR=TEXTCorrect,
replyAsympR(background)=ColorCorrect, replyAsympR(foreground)=ColorCorrectFrgd);
Set(reply="Good Job.",
reply(background)=green, reply(foreground)=ColorCorrect);
AsympRCorrect:=true;
if AsympLCorrect then
Set(BPlot(enabled)=true);
end if;
elif user_limR in {infinity,-infinity} then
Set(replyAsympR=TEXTIncorrect,
replyAsympR(background)=ColorIncorrect, replyAsympR(foreground)=ColorIncorrectFrgd);
Set(reply="+/- infinity cannot be a horizontal asymptote.",
reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd);
else
Set(replyAsympR=TEXTIncorrect,
replyAsympR(background)=ColorIncorrect, replyAsympR(foreground)=ColorIncorrectFrgd);
Set(reply="If the limit is +/- infinity, then the function does not approach a horizonal line. Try Again.",
reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd);
end if;
return;
end if;
if user_DNER then
Set(replyAsympR=TEXTIncorrect,
replyAsympR(background)=ColorIncorrect, replyAsympR(foreground)=ColorIncorrectFrgd);
Set(reply="If the limit is finite, then the asymptote exists. Try Again.",
reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd);
elif user_limR in {infinity,-infinity} then
Set(replyAsympR=TEXTIncorrect,
replyAsympR(background)=ColorIncorrect, replyAsympR(foreground)=ColorIncorrectFrgd);
Set(reply="+/- infinity cannot be a horizontal asymptote.",
reply(background)=ColorIncorrect, reply(foreground)=colorIncorrectFrgd);
elif user_limR=limR then
Set(replyAsympR=TEXTCorrect,
replyAsympR(background)=ColorCorrect, replyAsympR(foreground)=ColorCorrectFrgd);
Set(reply="Good Job.",
reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd);
AsympRCorrect:=true;
if AsympLCorrect then
Set(BPlot(enabled)=true);
end if;
else
Set(replyAsympR=TEXTIncorrect,
replyAsympR(background)=ColorIncorrect, replyAsympR(foreground)=ColorIncorrectFrgd);
Set(reply="The value of the asymptote is the value of the limit. Try Again.",
reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd);
end if;
end proc:ShowAsympR:=proc()
global limR, limL, AsympRCorrect, AsympLCorrect:
if limR in {infinity,-infinity} then
Set(CBNoAsympR=true);
else
Set(TFAsympR=limR);
end if;
Set(replyAsympR="Shown",
replyAsympR(background)=ColorShow, replyAsympR(foreground)=ColorShowFrgd);
Set(reply="Try it yourself.",
reply(background)=ColorShow, reply(foreground)=ColorShowFrgd);
AsympRCorrect:=true;
if AsympLCorrect then
Set(BPlot(enabled)=true);
end if;
end proc:HintAsympL:=proc()
Set(reply="If the limit L is finite then the horizontal asymptote is y = L.\134nIf L = +/- infinity, then there is no horizontal asymptote.",
reply(background)=ColorHint, reply(foreground)=ColorHintFrgd);
end proc:CheckAsympL:=proc()
global limR, limL, AsympRCorrect, AsympLCorrect:
local user_limL, user_DNEL;
user_limL:=Get(TFAsympL);
user_DNEL:=Get(CBNoAsympL);
if user_limL="" and user_DNEL=false then
Set(replyAsympL="Warning",
replyAsympL(background)=ColorWarning, replyAsympL(foreground)=ColorWarningFrgd);
Set(reply="You need to enter an answer or select Does Not Exist.",
reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd);
return;
end if;
if user_limL<>"" and user_DNEL then
Set(replyAsympL="Warning",
replyAsympL(background)=ColorWarning, replyAsympL(foreground)=ColorWarningFrgd);
Set(reply="You cannot answer both a value and Does Not Exist.",
reply(background)=ColorWarning, reply(foreground)=ColorWarningFrgd);
return;
end if;
if user_limL<>"" then
user_limL:=Get(TFAsympL::realcons, corrections=true, update=true);
end if;
if limL in {infinity,-infinity} then
if user_DNEL then
Set(replyAsympL=TEXTCorrect,
replyAsympL(background)=ColorCorrect, replyAsympL(foreground)=ColorCorrectFrgd);
Set(reply="Good Job.",
reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd);
AsympLCorrect:=true;
if AsympRCorrect then
Set(BPlot(enabled)=true);
end if;
elif user_limL in {infinity,-infinity} then
Set(replyAsympL=TEXTIncorrect,
replyAsympL(background)=ColorIncorrect, replyAsympL(foreground)=ColorIncorrectFrgd);
Set(reply="+/- infinity cannot be a horizontal asymptote.",
reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd);
else
Set(replyAsympL=TEXTIncorrect,
replyAsympL(background)=ColorIncorrect, replyAsympL(foreground)=ColorIncorrectFrgd);
Set(reply="If the limit is +/- infinity, then the function does not approach a horizonal line. Try Again.",
reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd);
end if;
return;
end if;
if user_DNEL then
Set(replyAsympL=TEXTIncorrect,
replyAsympL(background)=ColorIncorrect, replyAsympL(foreground)=ColorIncorrectFrgd);
Set(reply="If the limit is finite, then the asymptote exists. Try Again.",
reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd);
elif user_limL in {infinity,-infinity} then
Set(replyAsympL=TEXTIncorrect,
replyAsympL(background)=ColorIncorrect, replyAsympL(foreground)=ColorIncorrectFrgd);
Set(reply="+/- infinity cannot be a horizontal asymptote.",
reply(background)=ColorIncorrect, reply(foreground)=ColorCorrectFrgd);
elif user_limL=limL then
Set(replyAsympL=TEXTCorrect,
replyAsympL(background)=ColorCorrect, replyAsympL(foreground)=ColorCorrectFrgd);
Set(reply="Good Job.",
reply(background)=ColorCorrect, reply(foreground)=ColorCorrectFrgd);
AsympLCorrect:=true;
if AsympRCorrect then
Set(BPlot(enabled)=true);
end if;
else
Set(replyAsympL=TEXTIncorrect,
replyAsympL(background)=ColorIncorrect, replyAsympL(foreground)=ColorIncorrectFrgd);
Set(reply="The value of the asymptote is the value of the limit. Try Again.",
reply(background)=ColorIncorrect, reply(foreground)=ColorIncorrectFrgd);
end if;
end proc:ShowAsympL:=proc()
global limR, limL, AsympRCorrect, AsympLCorrect:
if limL in {infinity,-infinity} then
Set(CBNoAsympL=true);
else
Set(TFAsympL=limL);
end if;
Set(replyAsympL="Shown",
replyAsympL(background)=ColorShow, replyAsympL(foreground)=ColorShowFrgd);
Set(reply="Try it yourself.",
reply(background)=ColorShow, reply(foreground)=ColorShowFrgd);
AsympLCorrect:=true;
if AsympRCorrect then
Set(BPlot(enabled)=true);
end if;
end proc:HorizontalAsymptote:=Maplet(onstartup=RunWindow (MAIN),
Window [MAIN] (title="Finding Horizontal Asymptotes",
[ valign=none, inset=0, spacing=0, background=ColorBkgd,
[ halign=none, inset=0, background=ColorBkgd,
Button("New Function", Evaluate(function="NewProblem"), background=ColorNewButton),
BoxRow( halign=none, background=ColorBkgd, border=true,
caption="GOAL: Find the Horizontal Asymptotes of the function:",
"f =",
MathMLViewer[MMLfunction](width=200, height=60, background=white)
),
Button("Quit", Shutdown (), background=ColorCloseButton)
],
BoxColumn( border=true, valign=none, inset=0, spacing=0, background=ColorBkgd,
caption="Step 1: Compute the Limits:",
[ halign=none, background=ColorBkgd,
"R =",
MathMLViewer[MMLLimR](width=200, height=60, background=white),
"=",
TextField[TFLimR](width=6, background=ColorMessage),
HorizontalGlue(),
Button[BHintLimR]("Hint", Evaluate(function="HintLimR"), background=ColorHintButton, enabled=false),
Button[BCheckLimR]("Check", Evaluate(function="CheckLimR"), background=ColorCheckButton, enabled=false),
TextField[replyLimR](width=6, editable=false, background=ColorMessage),
Button[BShowLimR]("Show", Evaluate(function="ShowLimR"), background=ColorShowButton, enabled=false)
],
[ halign=none, background=ColorBkgd,
"L =",
MathMLViewer[MMLLimL](width=200, height=60, background=white),
"=",
TextField[TFLimL](width=6, background=ColorMessage),
HorizontalGlue (),
Button[BHintLimL]("Hint", Evaluate(function="HintLimL"), background=ColorHintButton, enabled=false),
Button[BCheckLimL]("Check", Evaluate(function="CheckLimL"), background=ColorCheckButton, enabled=false),
TextField[replyLimL](width=6, editable=false, background=ColorMessage),
Button[BShowLimL]("Show", Evaluate(function="ShowLimL"), background=ColorShowButton, enabled=false)
]
),
BoxColumn( border=true, valign=none, inset=0, spacing=0, background=ColorBkgd,
caption="Step 2: Identify the Horizontal Asymptotes:",
[ halign=none, background=ColorBkgd,
"As x -> infinity, y =",
TextField[TFAsympR](width=6, background=ColorInput),
CheckBox[CBNoAsympR]("Does Not Exist", background=ColorInput),
HorizontalGlue (),
Button[BHintAsympR]("Hint", Evaluate(function="HintAsympR"), background=ColorHintButton, enabled=false),
Button[BCheckAsympR]("Check", Evaluate(function="CheckAsympR"), background=ColorCheckButton, enabled=false),
TextField[replyAsympR](width=6, editable=false, background=ColorMessage),
Button[BShowAsympR]("Show", Evaluate(function="ShowAsympR"), background=ColorShowButton, enabled=false)
],
[ halign=none, background=ColorBkgd,
"As x -> - infinity, y =",
TextField[TFAsympL](width=6, background=ColorInput),
CheckBox[CBNoAsympL]("Does Not Exist", background=ColorInput),
HorizontalGlue (),
Button[BHintAsympL]("Hint", Evaluate(function="HintAsympL"), background=ColorHintButton, enabled=false),
Button[BCheckAsympL]("Check", Evaluate(function="CheckAsympL"), background=ColorCheckButton, enabled=false),
TextField[replyAsympL](width=6, editable=false, background=ColorMessage),
Button[BShowAsympL]("Show", Evaluate(function="ShowAsympL"), background=ColorShowButton, enabled=false)
]
),
[ halign=none, background=ColorBkgd,
TextBox[reply](width=60, height=2, editable=false, background=ColorMessage),
Button[BPlot](TEXTBPlot, RunWindow(PlotIt),
enabled=false, background=ColorPlotButton),
Label(Image(Logo)),
Label(Image(LIBLogo))
],
BoxColumn( valign=none, inset=0, spacing=0, background=ColorFooter,
[ halign=none, inset=0, spacing=0, background=ColorFooter,
Label(TEXTLprogrammers, font=FontFooter),
HorizontalGlue(),
Label(TEXTLcopyright, font=FontFooter),
HorizontalGlue(),
Label(TEXTLversion, font=FontFooter)
],
[ halign=none, inset=0, spacing=0, background=ColorFooter,
Label(TEXTLasstprogrammer, font=FontFooter),
HorizontalGlue(),
Label(GetVersion(), font=FontFooter)
]
)
]
),
Window[PlotIt](title=TEXTtitleMAIN,
[ valign=none, inset=0, spacing=0, background=ColorBkgd,
[ background=tan,
Plotter[Asympplot](width=400, height=300)
],
Button("Close", CloseWindow(PlotIt), background=ColorCloseButton)
]
)
):Maplets[Display](HorizontalAsymptote);f, limR, limL:=(-4*x^3-3*x^2+7*x-1)/(x-4),-infinity, -infinity;rng:=10;asympplot:=plot([f, limR, limL], x=-15..15,
y=-rng..rng, discont=true,
thickness=[1, 2, 2], color=[red, blue, blue],
linestyle=[solid, dash, dash],
title=typeset(''f''(x)=f),
titlefont=[Times,italic,10],
labels=[x, ''f''(x)],
labelfont=[Times,bolditalic,10]);%;