I am trying to graph implicit curves. I have been able to figure this out on PreFigure with the help of Dr. Austin, but I can’t seem to create the graph in Doenet.
<setup>
<function
name="f"
variables="x y">
x^3-y^3=6xy
</function>
</setup>
<graph grid="1 1">
<curve>
$f
</curve>
</graph>
``
I don’t think your function will work like that. When I try evaluating $$f(1,2), I get an output of -7=12, which is obviously false.
I was able to get a decent (ish) graph by using the technique here: Parametrizing implicit algebraic curves
Here is how I adapted it to your function:
<graph grid="1 1">
<curve variable="m" >
(-6m/(1+m^3), 6m^2/(1+m^3))
</curve>
</graph>
It does struggle with the vertical tangent line at the origin though, not sure how to fix that.
I saw that. So the easiest into write implicit functions as parametrics?
I think so? But there is still a lot of front end work that you’ll have to do.
If you think about how an implicit relation would be graphed by hand, you’d have to:
- pick a value of x
- solve for y (maybe numerically using Newton’s method)
- Plot the point
- Repeat for a new value of x
Computers can do this much faster than we can.
The y=mx thing works, except when the slope is undefined. In your example, you still have to solve some sort of cubic equation for x, which isn’t an easy thing to do by hand. I was hoping that there was some sort of f.zeros command that could be used. That way if you set your implicit function equal to zero, you could then call on f.zeros and have it plot the “solutions”.
Doenet does not have the ability to graph implicit functions, only parametrized curves.
It appears JSXGraph supports it and apparently so does PreFigure, so it should be doable.
I made this issue.
Following up. Can we insert a Prefigure Graph into Doenet? AI says yes, but I can’t seem to figure it out.
We don’t have the ability to embed raw PreFigure graphs into Doenet. Instead, one can create <graph>s that render to PreFigure graphs by setting the attribute renderer="prefigure". This is still a work in progress, as not all graphical components translate. With this renderer, you can add PreFigure <annotation>s that are read when navigating the graph structure, but you give up the ability to drag items on the graph with the mouse.
I saw this, but following that, I get a ton of errors.
Sorry, but I’m not able to troubleshoot the problem from this information.