Christina Schmidt & Nathan ParishComputing Limits By Finding the Common DenominatorMath 151 Honors- Section 201Fall 2011Instructor: Philip Yasskinrestart:with(Maplets[Tools]): with(Maplets[Elements]): with(plots):
StartEngine();randlimtype:=rand(1..2):randa:=rand(1..5):randb:=rand(-5..5):cs:=[-5,-4,-3,-2,-1,2,3,4,5]: (*If c=0, then f=0. If c=1 then lim is undefined and not +/- infinity.*)randc:=rand(1..9):ds:=[-3,-2,-1,1,2,3]:randd:=rand(1..6):randsgn:=rand(0..1):NewLimit:=proc()
global CD,f2,f3,Lim;
local limtype,a,b,c,d,e,f,num;
limtype:=randlimtype();
a:=randa();
b:=randb();
while b=a do
b:=randb();
end do;
c:=cs[randc()];
d:=ds[randd()];
if limtype=1 then
if randsgn()=0 then
f:=(d/(x-b)-d/(a-b))/(x-a);
else
f:=(d/(a-b)-d/(x-b))/(x-a);
end if;
CD:=(x-a)*(x-b)*denom(-d/(a-b));
elif limtype=2 then
e:=b+c*(a-b);
f:=d/expand((x-a)*(x-b))-(d-d*c)/expand((x-a)*(x-e));
CD:=(x-a)*(x-b)*(x-e);
end if;
num:=factor(CD*f);
f2:=num/CD;
f3:=factor(f);
Lim:=limit(f,x=a);
Set(MMLLimit=(Limit(f, x=a)));
Set(MMLf2=(Limit("", x=a)));
Set(MMLf3=(Limit("", x=a)));
Set(reply1="", reply1(background)=white);
Set(TFCD="");
Set(reply2="",reply2(background)=white);
Set(TFf2="");
Set(reply3="", reply3(background)=white);
Set(TFf3="");
Set(replyLim="", replyLim(background)=white);
Set(TFLim="");
Set(reply="", reply(background)=white);
end proc:JSFHCheckCD:=proc()
global CD,f2,f3,Lim;
local userCD;
userCD:=Get(TFCD::polynom, corrections=true, update=true);
if type(simplify(userCD/CD),realcons) then
Set(reply1="Correct",
reply1(background)=green, reply1(foreground)=black);
else
Set(reply1="Incorrect",
reply1(background)=red, reply1(foreground)=white);
end if;
end proc:ShowCD:=proc()
global CD,f2,f3,Lim;
Set(TFCD=CD):
Set(reply1="Shown",
reply1(background)=yellow, reply1(foreground)=black):
end proc:HintCD:=proc()
global CD,f2,f3,Lim, limtype;
Set (reply="Find all denominators in the limit and multiply them together.", reply(background)="Orange", reply(foreground)=black):
end proc:Checkf2:=proc()
global CD,f2,f3,Lim;
local userf2;
userf2:=Get(TFf2::ratpoly(rational, x), corrections=true, update=true);
if simplify(userf2-f2)=0 then
Set(reply2="Correct",
reply2(background)=green, reply2(foreground)=black);
else
Set(reply2="Incorrect",
reply2(background)=red, reply2(foreground)=white);
end if;
end proc:Showf2:=proc()
global CD,f2,f3,Lim;
Set(TFf2=f2):
Set(reply2="Shown",
reply2(background)=yellow, reply2(foreground)=black):
end proc:Hintf2:=proc()
global CD, f2,f3,Lim;
Set (reply="Multiply the top and bottom of each term in the limit by appropriate factors so the denominators can be combined.", reply(background)="Orange", reply(foreground)=black):
end proc:Checkf3:=proc()
global CD,f2,f3,Lim;
local userf3;
userf3:=Get(TFf3::ratpoly(rational, x), corrections=true, update=true);
if simplify(userf3-f3)=0 then
Set(reply3="Correct",
reply3(background)=green, reply3(foreground)=black);
else
Set(reply3="Incorrect",
reply3(background)=red, reply3(foreground)=white);
end if;
end proc:Showf3:=proc()
global CD,f2,f3,Lim;
Set(TFf3=f3):
Set(reply3="Shown",
reply3(background)=yellow, reply3(foreground)=black):
end proc:Hintf3:=proc()
global CD, f2,f3,Lim;
Set (reply="Factor the numerator and cancel with the factor in the denominator which goes to zero.", reply(background)="Orange", reply(foreground)=black):
end proc:JSFHCheckLim:=proc()
global CD,f2,f3,Lim;
local userLim;
userLim:=Get(TFLim::ratpoly(rational, x), corrections=true, update=true);
if simplify(userLim-Lim)=0 then
Set(replyLim="Correct",
replyLim(background)=green, replyLim(foreground)=black);
else
Set(replyLim="Incorrect",
replyLim(background)=red, replyLim(foreground)=white);
end if;
end proc:ShowLim:=proc()
global CD,f2,f3,Lim;
Set(TFLim=Lim):
Set(replyLim="Shown",
replyLim(background)=yellow, replyLim(foreground)=black):
end proc:HintLim:=proc()
global CD, f2,f3,Lim;
Set (reply="Plug in the value for x and evaluate the limit.", reply(background)="Orange", reply(foreground)=black):
end proc:JSFHLimitByCommonDenom:=Maplet(onstartup = RunWindow(MAIN),
Window[MAIN](title="Computing Limits By Finding the Common Denominator",
[
[
Button("New Limit", Evaluate(function="NewLimit"), background=magenta),
Button("Good Bye", Shutdown(), background=pink)
],
[ border=true, halign=none,
caption="Compute the Limit:",
" ",
" ",
" ",
"L =",
MathMLViewer[MMLLimit](value=Limit('f'(x), x='a'), width=300, height=75),
" ",
" ",
" "
],
[ border=true, halign=none,
caption="Step 1: Find the Common Denominator",
"CD =",
TextField[TFCD](width=25, background=turquoise),
HorizontalGlue(),
Button("Hint", Evaluate(function="HintCD"), background="Orange"),
Button("Check", Evaluate(function="CheckCD"), background=green),
TextField[reply1](width=7, editable=false, background=white),
Button("Show", Evaluate(function="ShowCD"), background=yellow)
],
[ border=true, halign=none,
caption="Step 2: Rewrite the Limit Using the Common Denominator",
"L =",
MathMLViewer[MMLf2](value= Limit("", x=a), width=50, height=40),
TextField[TFf2](width=25, background=turquoise),
HorizontalGlue(),
Button("Hint", Evaluate(function="Hintf2"), background="Orange"),
Button("Check", Evaluate(function="Checkf2"), background=green),
TextField[reply2] (width=7, editable=false, background=white),
Button("Show", Evaluate(function="Showf2"), background=yellow)
],
[ border=true, halign=none,
caption="Step 3: Cancel",
"L =",
MathMLViewer[MMLf3](value=Limit("", x='a'), width=50, height=40),
TextField[TFf3](width=25, background=turquoise),
HorizontalGlue(),
Button("Hint", Evaluate(function="Hintf3"), background="Orange"),
Button("Check", Evaluate(function="Checkf3"), background=green),
TextField[reply3](width=7, editable=false, background=white),
Button("Show", Evaluate(function="Showf3"), background=yellow)
],
[ border=true, halign=none,
caption="Step 4: Evaluate the Limit",
"L =",
TextField[TFLim](width=25, background=turquoise),
HorizontalGlue(),
Button("Hint", Evaluate(function="HintLim"), background="Orange"),
Button("Check", Evaluate(function="CheckLim"), background=green),
TextField[replyLim](width=7, editable=false, background=white),
Button("Show", Evaluate(function="ShowLim"), background=yellow)
],
[ border=true,
TextBox[reply](height=3, width=34)
],
[ inset=0, spacing=0,
"Instructor: Philip Yasskin",
"Programmers: Christina Schmidt & Nathan Parish",
"Copyright: Yasskin 2011"
]
]
)):Maplets[Display](LimitByCommonDenom);