# Proving oblique asymptote of rational function for students using animation plot?

I want to plot this asymptotic $$(\Delta ):y=x+1$$ of this rational function $$f(x) := (x^2+2x+2)/( x + 1)$$ , using the below code But I didn't get it , and in the same time I want to show my students in plot that the distance between two points $$M\in (C_f)$$ , $$M' \in (\Delta )$$ go to $$0$$ or vanish for $$|x|$$ large enough, And it is good to show the animation or the motion of points $$M$$ and $$M'$$ by increasing the values of $$|x|$$ to show them the behavior of that distance

 f[x_] := (x^2+2x+2)/( x + 1);
Plot[{f[x], y==x+1}, {x, -11, 7}, Exclusions -> {y==x+1},
ExclusionsStyle -> Red, PlotStyle -> {Black, Red}, PlotRange -> 10,
AspectRatio -> Automatic,
Epilog -> {Text[y== x+1, {-5, -8}], Text[y ==x+1, {5, 2}]}]


A simple version on the subject. You can adopt this to your purposes.

f[x_]:=(x^2+2x+2)/(x+1);
a[x_]:=x+1;
Manipulate[
Plot[{f[x],a[x]},{x,-11,7},
Epilog->{Blue, Thick,Line[{{s,a[s]},{s,f[s]}}],
PointSize[.015],Point[{{s,f[s]},{s,a[s]}}]},
Exclusions->{-1},
ExclusionsStyle->Directive[Purple,Thick,Dashed],
PlotStyle->{Black,Directive[Red,Thick,Dashed]},
PlotRange->{{-10,10},{-10,10}},
AspectRatio->Automatic,
PlotLegends->{(x^2+2x+2)/(x+1),x+1},
GridLines->Table[Range[-10,10],2],
PlotLabel->"DISTANCE to ASYMPTOTE = "<>ToString[Abs[f[s]-a[s]]],
ImageSize->Large],
{{s,0,"X-COORDINATE"},-10,10,N[Pi/10^5],Appearance->"Labeled"}]

• I have copied that Code to wolfram cloud it doesn't work as yours i don't know why – zeraoulia rafik Jan 27 at 14:53
• @zeraouliarafik always good to include that you’re using wolfram cloud as opposed to a desktop version, can you clarify what problems it is having? – CA Trevillian Jan 27 at 14:59
• Can't speak on OP's behalf, but for me, in Wolfram Cloud, the blue point does not appear, and adjusting the slider makes it bug out; the slider itself vanishes, and the label displays some exposed variable (FEs776141109246748861804975270965864906424` in my case) – user170231 Jan 27 at 15:28
• What I can do to make it work ? – zeraoulia rafik Jan 27 at 15:59
• @zeraouliarafik Read about functions and simplify code, start from bare-bone in Cloud. Cloud's frontend is a bit different from desktop. I used desktop to develop sophisticated interface -- you can play with it for free getting TRIAL. If you want this to work in cloud just strip down / simplify a bit the elements of interface and it will work. But for the sake of other community users I rather keep this full version. – Vitaliy Kaurov Jan 27 at 16:01