2

I'm trying to plot a elliptic curve in a projective Space. I got inspired by this thread. Here one can find the code.

Now the point is, that the author of the thread only plotted a 2d Version of an elliptic curve. I wanted to plot this 3d equation: z*y^2=x^3-3*x*z^2+3*z^3 ( This is the projective form of the affin equation y^2 = x^3 -3x + 3 )

It already was a big problem to find plotters only, that can handle this. I finally got this result:enter image description here

Can someone help me plotting this with using tikz?

Titanlord
  • 541
  • So you already have the result!? From where. Show your code, and you also need to try to do it in TikZ - and show the code - otherwise it is impossible to know what you need help with. – hpekristiansen May 11 '20 at 16:29
  • I made the plot with this. But i have no idea how to plot it with tikz. I already plotted elliptic curves with commands like \addplot [] {-sqrt((x^3+3*x+3))}; I have no idea to plot such complex equations as mentioned above. – Titanlord May 11 '20 at 16:33
  • 1
    For such complex 3D plots, asymptote may be more appropriate – BambOo May 11 '20 at 16:38
  • @BambOo is it possible with gnuplot, too? If yes, does someone has a tipp for me, how to plot 3d polynoms of the form f(x,y,z) = ... ? – Titanlord May 11 '20 at 16:41
  • I do not know how to use neither gnuplot nor asymptote, it is just a suggestion – BambOo May 11 '20 at 16:48
  • You have already solved the constraint for one variable so you can plot \documentclass[tikz,border=3mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.17} \begin{document} \begin{tikzpicture} \begin{axis}[ymin=0,ymax=4] \addplot3 [mesh,color=orange,domain=-2:2,domain y=-2:2] (x,{sqrt((x^3-3*x*y^2+3*y^3)/y)},y); \end{axis} \end{tikzpicture} \end{document}. However, this is a mess. You'd need to carefully distinguish many cases. There is a reason why there is an extended literature on elliptic functions... –  May 11 '20 at 16:51
  • Go to a Sage Cell Server. Copy/paste the 3 lines :1 var("y,z") 2 F = zy^2-x^3+3xz^2-3z^3 3 implicit_plot3d(F, (x,-2,2), (y,-2,2), (z,-2,2), color='palevioletred') (don't include numbers) then press Enter. You'll have a 3d surface that you can rotate. This uses SAGE which has some documentation here. SAGE has a sagetex package to link it to LaTeX so you'll get the output seen. It might be possible to push the data through to Tikz. That's probably not easy, though. – DJP May 11 '20 at 19:09

1 Answers1

3

This isn't tikz, it's the graphics from a computer algebra system, SAGE. If you're going to consider gnuplot or asymptote then it makes sense to consider SAGE. The coding is simple to do:

\documentclass{article}
\usepackage{graphicx}
\usepackage{sagetex}
\begin{document}
\begin{sagesilent}
var("y,z")
F = z*y^2-x^3+3*x*z^2-3*z^3
p = implicit_plot3d(F, (x,-2,2), (y,-2,2), (z,-2,2), color='palevioletred')
\end{sagesilent}
The elliptic curve $\sage{F}$ can be plotted using SAGE:
\begin{center}
\sageplot[width=4in][pdf]{p, frame=True}
\end{center}
\end{document}

The output from Cocalc is: enter image description here

SAGE is not part of your LaTeX distribution so it needs to be installed on your machine and linked to LaTeX, which can sometimes be tricky. Another way is through a free Cocalc account. You can find more information about the sagetex package, which allows you to put SAGE code into your LaTeX document, here. Installing SAGE on your computer gives you a SAGE notebook to run your code. It's like the Sage Cell Server I commented on above, with a little more functionality.

enter image description here

After clicking on the circle in the bottom left hand corner, a right click on the figure will bring up the options menu. This will let you add axes, chage colors, export the file, and so on. You can rotate the figure and pick the angle that suits you before exporting the picture.

By default, the graphics are framed in a 3d box. Changing True to False in the LaTeX code I've posted will remove the frame and numbers, leaving only the surface.

DJP
  • 12,451