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}]}]

enter image description here

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

Epilog->{Blue, Thick,Line[{{s,a[s]},{s,f[s]}}],
PlotLabel->"DISTANCE to ASYMPTOTE = "<>ToString[Abs[f[s]-a[s]]],
  • $\begingroup$ I have copied that Code to wolfram cloud it doesn't work as yours i don't know why $\endgroup$ – zeraoulia rafik Jan 27 '20 at 14:53
  • $\begingroup$ @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? $\endgroup$ – CA Trevillian Jan 27 '20 at 14:59
  • $\begingroup$ 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 (FE`s$$776141109246748861804975270965864906424 in my case) $\endgroup$ – user170231 Jan 27 '20 at 15:28
  • $\begingroup$ What I can do to make it work ? $\endgroup$ – zeraoulia rafik Jan 27 '20 at 15:59
  • $\begingroup$ @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. $\endgroup$ – Vitaliy Kaurov Jan 27 '20 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.