1

I am working on a Mathematica lab that involves the Folium of Descartes. I am trying to find vertical and horizontal tangent lines and then plot them with the folium in the same graph. I keep getting an error [Power: Infinite expression 1/0 encountered]. I have been googling solutions or ways to solve that issue but came up empty-handed. I would really appreciate if someone could take a look at it and help me figure out what's happening.

p.s How do I debug in Mathematica?

Functions

x[t_] := (12 t)/(1 + t^3)
y[t_] := (12 t^2)/(1 + t^3)

First Plot

Manipulate[
 ParametricPlot[{x[t], y[t]}, {t, -100, 100}, 
 PlotRange -> {{-10, 10}, {-10, 10}}, PerformanceGoal -> "Quality", 
 AxesLabel -> {x, y}, 
 Epilog -> {Red, PointSize -> .05, Point[{x[t1], y[t1]}]}], {t1, -5, 
 5}]

Part with a bug/and my question

(*Find values of t for vertical tangent lines*)
Solve[D[y[t], t]/D[x[t], t] == Infinity, t, Reals]
(*Find values of t for horizontal tangent lines*)
Solve[D[y[t], t]/D[x[t], t] == 0, t, Reals]
(*Find values of t for horizontal tangent lines*)
ht = Solve[{D[y[t], t] == 0, t != -1, t != 1}, t, Reals, 
 MaxExtraConditions -> 
 All] (*Exclude -1 and 1 because we get a floaitng point exception*)
(*Plot the folium and the tangent lines*)
Show[ParametricPlot[{x[t], y[t]}, {t, -100, 100}, 
 PlotRange -> {{-10, 10}, {-10, 10}}, AxesLabel -> {x, y}], 
 Epilog -> {Thick, Red, Point[{x[#], y[#]} & /@ {-1, 0, 1}], 
 Table[Line[{{-10, y[t]}, {10, y[t]}}], {t, t /. ht}]}]

Thank you in advance

EDIT:

Hi, after "debugging" that error I found out that I was making it incorrectly I changed it to

Point[({x[#], y[#]} & /@ {-1, 0, 1}) /. t -> #] &

so the points can be parameterized by t. But unfortunately, my work was not done there, I get a new error saying: Function is not a Graphics primitive or directive. After reading about it online I sort of learned that it means I am likely trying to use a function as an argument for a graphics command? I am using ParametricPlot and I don't see how that could raise an error like that. How would I resolve this?

asked Apr 7, 2023 at 3:43

1 Answer 1

2

Exclude -1 from the Point params. x[-1] & y[-1] cause the error.

(*Plot the folium and the tangent lines*)Show[
 ParametricPlot[{x[t], y[t]}, {t, -100, 100},
 PlotRange -> {{-10, 10}, {-10, 10}},
 AxesLabel -> {x, y}], Epilog -> {Thick, Red,
 Table[Line[{{-10, y[t]}, {10, y[t]}}], {t, t /. ht}],
 PointSize[Large], Orange,
 Point[{x[#], y[#]} & /@ {(*-1,*)0, 1}]}]

To debug take expressions apart. E.g. this is fine

ParametricPlot[{x[t], y[t]}, {t, -100, 100},
 PlotRange -> {{-10, 10}, {-10, 10}},
 AxesLabel -> {x, y}]

This is also fine

Table[Line[{{-10, y[t]}, {10, y[t]}}], {t, t /. ht}]

But the error is immediately revealed in

Point[{x[#], y[#]} & /@ {-1, 0, 1}]
answered Apr 7, 2023 at 8:38
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.