Shifting Hyperbolic Trig FunctionsTrevor Nelligan & Remington Schugart
Math 151 Honors Section 202/201Fall 2013
Instructor: Philip YasskinSerious Semiserious:Your programing has very strange naming: checkH for the basic function. Should be something like checkB checkC for vertical shift. Should be checkV checkA for horizontal shift. Should be checkH checkF for the final function. Should be checkBI changed them. Use names that tell you what it is.
Not seriousYou need a footer in the maplet.You have the wrong title in this worksheet and in both windows of the maplet.I revised the layout so it is significantly more compact.I revised colors.You never use thexran and avar. So I deleted them.You never use the plotfunc2 proc. So I deleted it.I renamed cvar as vertvar.I made the horiz and vert shifts be -3..3 instead of [-10,-5,0,5,10].There is no need for the horizontal scale in the plots to be in multiples of Pi.So I made the plots be -5..5 by -5..5 so you can see it better.I added the other 4 hyper functions. But the the plots of coth and csch showed vert asymp which I eliminated with discont=true parameters.restart:with(Maplets[Tools]): with(Maplets[Elements]):
with(plots):
StartEngine();randomize():functions:=[x->sinh(x),x -> cosh(x),x->tanh(x),x -> coth(x),x->sech(x),x -> csch(x)]:functran:=rand(1..6):horizvertran:=rand(-3..3):rights:=["Good Job!","You should go pro!","You are the Michael Jordan of math."]:ranright:=rand(1..3):wrongs:=["You know nothin' Jon Snow.","Houston we have a problem.","Ya done goofed!"]:ranwrong:=rand(1..3):plotfunc:=proc()
global x,funh,horizvar,vertvar,Finalfunc,p1;
funh:=functions[functran()];
horizvar:=horizvertran();
vertvar:=horizvertran();
Finalfunc:=funh(x-horizvar)+vertvar;
p1:=plot(Finalfunc, x=-5..5, y=-5..5,thickness=2, color=green, discont=true);
Set(myplot=p1);
Set(TFB=""):
Set(TFV=""):
Set(TFH=""):
Set(TFF=""):
Set(MRB="",MRB(background)=white):
Set(MRV="",MRV(background)=white):
Set(MRH="",MRH(background)=white):
Set(MRF="",MRF(background)=white):
Set(reply="");
end proc:hintB:=proc()
Set(reply="");
end proc:checkB:=proc()
global funh;
local resph;
resph:=Get(TFB::trigh, corrections=true, update=true):
if resph=funh(x) then
Set(reply=rights[ranright()]):
Set(MRB="Correct",MRB(background)=green):
else
Set(reply=wrongs[ranwrong()]):
Set(MRB="Incorrect",MRB(background)=red):
end if;
end proc:showB:=proc()
global Finalfunc;
Set(TFB=funh(x)):
Set(reply="Next time try doing it yourself.");
end proc:hintV:=proc()
Set(reply="Compare the position of this function against its parent function.");
end proc:checkV:=proc()
global vertvar;
local respc;
respc:=Get(TFV::realcons, corrections=true, update=true):
if respc=vertvar then
Set(reply=rights[ranright()]):
Set(MRV="Correct",MRV(background)=green):
else
Set(reply=wrongs[ranwrong()]):
Set(MRV="Incorrect",MRV(background)=red):
end if;
end proc:showV:=proc()
global vertvar;
Set(TFV=vertvar):
Set(reply="Next time try doing it yourself.");
end proc:hintH:=proc()
Set(reply="Compare the position of this function against its parent function.");
end proc:checkH:=proc()
global horizvar;
local respa;
respa:=Get(TFH::realcons, corrections=true, update=true):
if respa=horizvar then
Set(reply=rights[ranright()]):
Set(MRH="Correct",MRH(background)=green):
else
Set(reply=wrongs[ranwrong()]):
Set(MRH="Incorrect",MRH(background)=red):
end if;
end proc:showH:=proc()
global horizvar;
Set(TFH=horizvar):
Set(reply="Next time try doing it yourself.");
end proc:hintF:=proc()
Set(reply="Remember: when shifting horizontally, you should subtract instead of add.");
end proc:checkF:=proc()
global horizvar;
local respf;
respf:=Get(TFF::anything,corrections=true,update=true):
if respf=Finalfunc then
Set(reply=rights[ranright()]):
Set(MRF="Correct",MRF(background)=green):
else
Set(reply=wrongs[ranwrong()]):
Set(MRF="Incorrect",MRF(background)=red):
end if;
end proc:showF:=proc()
global Finalfunc;
Set(TFF=Finalfunc):
Set(reply="Next time try doing it yourself.");
end proc:PlotItWindow:=Maplet(onstartup = RunWindow(MAIN),
Window[MAIN](title="Shifting Hyperbolic Trig Functions",
[ valign=none, inset=0, spacing=0,
[ halign=none,
Button("New Question", Evaluate(function = "plotfunc"), background=magenta),
HorizontalGlue(),
"Identify the hyperbolic function displayed in the graph.",
HorizontalGlue(),
Button("Good Bye", Shutdown(), background=pink)
],
[ halign=none, inset=0, spacing=0,
[ valign=none, background=tan, border=true,
caption="Plot:",
Plotter[myplot](plot(0, x=-5..5, -5..5),
width=200, height=200)
],
[ valign=none, inset=0, spacing=0,
[ halign=none, border=true,
caption="What is the parent hyperbolic function?",
TextField[TFB](width=10, background=turquoise),
HorizontalGlue(),
Button("Hint", onclick=RunWindow(BASIC6), background=Orange),
Button("Check", Evaluate(function = "checkB"), background=green),
TextField[MRB](width=6),
Button("Show", Evaluate(function = "showB"), background=yellow)
],
[ halign=none, border=true,
caption="How far has the graph been shifted vertically?",
TextField[TFV](width=10, background=turquoise),
HorizontalGlue(),
Button("Hint",Evaluate(function = "hintV"), background=Orange),
Button("Check", Evaluate(function = "checkV"), background=green),
TextField[MRV](width=6),
Button("Show", Evaluate(function = "showV"), background=yellow)
],
[ halign=none, border=true,
caption="How far has the graph been shifted horizontally?",
TextField[TFH](width=10, background=turquoise),
HorizontalGlue(),
Button("Hint",Evaluate(function = "hintH"), background=Orange),
Button("Check", Evaluate(function = "checkH"), background=green),
TextField[MRH](width=6),
Button("Show", Evaluate(function = "showH"), background=yellow)
],
[ halign=none, border=true,
caption="What is the whole function?",
TextField[TFF](width=10, background=turquoise),
HorizontalGlue(),
Button("Hint",Evaluate(function = "hintF"), background=Orange),
Button("Check", Evaluate(function = "checkF"), background=green),
TextField[MRF](width=6),
Button("Show", Evaluate(function = "showF"), background=yellow)
]
]
],
[ TextField[reply](width=50, editable=false, background=white)
],
[ halign=none, inset=0, spacing=0,
"Instructor: Philip Yasskin",
HorizontalGlue(),
"Programmers: Trevor Nelligan & Remington Schugart",
HorizontalGlue(),
"Copyright: Yasskin 2013"
]
]
),
Window[BASIC6]( title="Basic 6 Hyperbolic Trig Functions",
[ valign=none, inset=0, spacing=0,
[ halign=none,
"Look at each graph and learn its basic shape:",
HorizontalGlue(),
Button("Close", CloseWindow(BASIC6), background=pink)
],
[ halign=none, inset=0,
[ border=true,
caption="Basic functions",
Button("Show sinh(x)", background=tan, onclick=A1),
VerticalGlue(),
Button("Show cosh(x)", background=tan, onclick=A2),
VerticalGlue(),
Button("Show tanh(x)", background=tan, onclick=A3),
VerticalGlue(),
Button("Show coth(x)", background=tan, onclick=A4),
VerticalGlue(),
Button("Show sech(x)", background=tan, onclick=A5),
VerticalGlue(),
Button("Show csch(x)", background=tan, onclick=A6)
],
[ valign=none, background=tan, border=true,
caption="Plot:",
Plotter[PL6](plot(0, x=-5..5, -5..5),
width=200, height=200)
]
]
]
),
Action[A1](SetOption('PL6' = plot(sinh(x), x=-5..5, -5..5, thickness=3, color=blue))),
Action[A2](SetOption('PL6' = plot(cosh(x), x=-5..5, -5..5, thickness=3, color=blue))),
Action[A3](SetOption('PL6' = plot(tanh(x), x=-5..5, -5..5, thickness=3, color=blue))),
Action[A4](SetOption('PL6' = plot(coth(x), x=-5..5, -5..5, thickness=3, color=blue, discont=true))),
Action[A5](SetOption('PL6' = plot(sech(x), x=-5..5, -5..5, thickness=3, color=blue))),
Action[A6](SetOption('PL6' = plot(csch(x), x=-5..5, -5..5, thickness=3, color=blue, discont=true)))
):Maplets[Display]( PlotItWindow );