restart: with(Maplets[Elements]):with(Maplets[Tools]): StartEngine(); lightorange:="#FFB300": randomize(): 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 genious. ", " 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! ", " That's krunk! " ]: randgreat := rand(1..nops(great)): nextquest := [ "Keep it up.", "Keep going.", "On to the next problem.", "Try another function.", "Identify another shifted function." ]: randnext := rand(1..nops(nextquest)): 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. ", " Close, but no cigar. ", " Slightly off. ", " 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. ", " Yikes! Really close. You'll get it next time. ", " Pucha! 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. ", " Ooooh...close. ", " A swing and a miss. ", " Better luck next time. ", " Oops. ", " Tilt. Play again. ", " I know you can do better. ", " Sorry Charlie. ", " Better luck next time. ", " Tisk, tisk. It's a tough one. ", " It takes a lot of wrongs to make a right. ", " Even Einstein didn't get everything right. ", " Oh man, you were so close. ", " Today's not your lucky day. ", " Don't quit your day job. ", " You're colder than a polar bear's toenail. " ]: randsorry := rand(1..nops(sorry)): tryagain := [ "Fix your answer and check it again.", "Give it another try.", "Try again.", "Please try again." ]: randtry := rand(1..nops(tryagain)): showit := [ " 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." ]: randshow := rand(1..nops(showit)): func:=[ x -> 2^x, x -> log[2](x), x -> sin(x), x -> tan(x), x -> sec(x) ]: randfunc := rand(1..nops(func)): rand3:=rand(-3..3): Show_Shifted_Graph := proc() local p1, myfunc; global hshift, vshift, answer, x, func, randfunc, rand3; options `Copyright 2002-04, Philip B. Yasskin, Texas A&M Univ.`; vshift := rand3(); myfunc:=func[randfunc()]; if myfunc(x) in {sin(x), tan(x), sec(x)} then hshift := Pi/6*rand3(); Set('reply' = "This is the graph of one of the 5 basic transcendental functions shifted up or down by an integer amount and/or left or right by a multiple of Pi/6.\n\nEnter its formula below.", reply(background)=white, reply(foreground)=black): else hshift := rand3(); Set('reply' = "This is the graph of one of the 5 basic transcendental functions shifted up or down and/or left or right by integer amounts.\n\nEnter its formula below.", reply(background)=white, reply(foreground)=black): end if: answer := myfunc(x - hshift) + vshift; p1:=plot(answer, x=-5..5, `f(x)`=-5..5, discont=true, scaling=constrained, xtickmarks=9, ytickmarks=9, color=blue, numpoints=99, discont=true): Set('PL1' = plots[display](p1)): Set('TF1' = ""): Set('Bcheck'(enabled)=true, 'Bcheck'(background)=turquoise); Set('Bshow'(enabled)=true, 'Bshow'(background)=turquoise); end proc: Check_Answer := proc() local user_answer, p1, p2; global answer, x, great, randgreat, sorry, randsorry; options `Copyright 2002-04, Philip B. Yasskin, Texas A&M Univ.`; user_answer := Get('TF1'::algebraic, corrections=true, update=true): if simplify(normal(answer - user_answer))<> 0 then p1:=plot(answer, x=-5..5, `f(x)`=-5..5, discont=true, scaling=constrained, xtickmarks=9, ytickmarks=9, color=blue, numpoints=99, discont=true): p2:=plot(user_answer, x=-5..5, `f(x)`=-5..5, discont=true, scaling=constrained, xtickmarks=9, ytickmarks=9, color=red, numpoints=99, discont=true): Set('PL1' = plots[display]( p1,p2 )): Set('reply' = cat(sorry[randsorry()], "The new plot shows the ORIGINAL FUNCTION in BLUE and YOUR ANSWER in RED. Modify your answer and Check Your Answer again."), reply(background)=red, reply(foreground)=white): else p1:=plot(answer, x=-5..5, `f(x)`=-5..5, discont=true, scaling=constrained, xtickmarks=3, ytickmarks=3, color=green, numpoints=99, xtickmarks=9, ytickmarks=9): Set('PL1' = plots[display]( p1 )): Set('reply' = cat(great[randgreat()], nextquest[randnext()], " Click on Show Shifted Graph."), reply(background)=green, reply(foreground)=black): end if; end proc: Show_Answer := proc() global answer, x, showit, randshow; options `Copyright 2002-04, Philip B. Yasskin, Texas A&M Univ.`; Set('TF1' = answer): Set('reply' = showit[randshow()], 'reply'(background)=lightorange, reply(foreground)=black): end proc: Shift_Transcendental := Maplet(onstartup = RunWindow(MAIN), Font[helv10]("helvetica",10), Window[MAIN]( 'title'="Shifting Transcendental Functions", 'defaultbutton'='Bcheck', BoxColumn( halign=none, background=wheat, BoxRow( background=wheat, inset=0, spacing=0, BoxColumn( background=wheat, inset=0, spacing=0, border=true, halign=none, Button['BShowShiftGraph']("Show\nShifted Graph", Evaluate('function' = "Show_Shifted_Graph"), background=turquoise), Button("Show 5 Basic\nTranscendental Functions", onclick=RunWindow(BASIC5), background=turquoise) ), BoxColumn( background=wheat, inset=0, spacing=0, border=true, halign=none, Plotter['PL1'](plot(0, x=-5..5, `f(x)`=-5..5, xtickmarks=9, ytickmarks=9), 'width'=275, 'height'=275) ) ), BoxRow( background=wheat, inset=0, spacing=0, border=true, TextBox['reply']("Click on Show 5 Basic Transcendental Functions to see the graphs of 5 basic transcendental functions.\n\nClick on Show Shifted Graph to see one of the 5 basic transcendental functions shifted up or down and/or left or right.", 'width'=50, 'height'=6, 'editable' = 'false', background=white) ), BoxRow( background=wheat, "Answer = ", TextField['TF1']('width'=20, background=turquoise) ), BoxRow( background=wheat, inset=0, spacing=0, border=true, HorizontalGlue(), Button['Bcheck']("Check Answer", Evaluate('function' = "Check_Answer"), enabled=false), HorizontalGlue(), Button['Bshow']("Show Answer", Evaluate(function = 'Show_Answer'), enabled=false), HorizontalGlue(), Button("Quit", Shutdown(), background=pink), HorizontalGlue() ), BoxRow('background'="#DDFFFF", 'inset'=0, 'spacing'=0, Label("Programmers: Fawcett / Shaper", 'font'=helv10), " ", HorizontalGlue(), Label("Copyright 2006, D.B. Meade and P.B. Yasskin", 'font'=helv10), " ", HorizontalGlue(), Label("v. 1.2a May 2006", 'font'=helv10) ) )), # Window[BASIC5]( 'title'="Basic 5 Transcendental Functions", BoxColumn( halign=none, background=wheat, inset=0, spacing=0, [ background=wheat, inset=15, "Look at each graph and learn its basic shape:", HorizontalGlue(), Button("Close", CloseWindow(BASIC5), background=pink) ], BoxRow( background=wheat, inset=0, BoxColumn( background=wheat, inset=0, spacing=0, border=true, caption="Basic functions", Button("Show 2^x", width=120, background=turquoise, onclick=A1), Button("Show log_2(x)", width=120, background=turquoise, onclick=A2), Button("Show sin(x)", width=120, background=turquoise, onclick=A3), Button("Show tan(x)", width=120, background=turquoise, onclick=A4), Button("Show sec(x)", width=120, background=turquoise, onclick=A5) ), BoxColumn(background=wheat, inset=0, spacing=0, border=true, caption="Plot", Plotter['PL7'](plot(0, x=-5..5, -5..5, xtickmarks=9, ytickmarks=9), 'width'=275, 'height'=275) ) ), BoxRow(background=wheat, inset=0, spacing=0, border=true, caption="Syntax tutorial", HorizontalGlue(), "Type", TextField['function'](" ", 'editable'=false, 'width'=10, background=white), " for", MathMLViewer[MML]('value'=MathML[Export](" "), 'width'=100, 'height'=55), HorizontalGlue() ), BoxRow('background'="#DDFFFF", 'inset'=0, 'spacing'=0, Label("Programmers: Fawcett / Shaper", 'font'=helv10), " ", HorizontalGlue(), Label("Copyright 2006, D.B. Meade and P.B. Yasskin", 'font'=helv10), " ", HorizontalGlue(), Label("v. 1.2a May 2006", 'font'=helv10) ) )), Action[A1](SetOption('PL7' = plot(2^x, x=-5..5, -5..5, color=blue, xtickmarks=9, ytickmarks=9)), SetOption('function' = " 2^x"), SetOption('MML'('value') = MathML[Export](` `*2^x))), Action[A2](SetOption('PL7' = plot(log[2](x), x=-5..5, -5..5, color=blue, xtickmarks=9, ytickmarks=9)), SetOption('function' = " ln(x)/ln(2)"), SetOption('MML'('value') = MathML[Export](` `*` log`[2](x)))), Action[A3](SetOption('PL7' = plot(sin(x), x=-5..5, -5..5, color=blue, xtickmarks=9, ytickmarks=9)), SetOption('function' = " sin(x)"), SetOption('MML'('value') = MathML[Export](` `*sin(x)))), Action[A4](SetOption('PL7' = plot(tan(x), x=-5..5, -5..5, color=blue, xtickmarks=9, ytickmarks=9, discont=true)), SetOption('function' = " tan(x)"), SetOption('MML'('value') = MathML[Export](` `*tan(x)))), Action[A5](SetOption('PL7' = plot(sec(x), x=-5..5, -5..5, color=blue, xtickmarks=9, ytickmarks=9, discont=true)), SetOption('function' = " sec(x)"), SetOption('MML'('value') = MathML[Export](` `*sec(x)))) ): Maplets[Display]( Shift_Transcendental );