To visualize a rational curve $C\subset \mathbb{C}^2$ we can consider the real graph $C\cap \mathbb{R}^2$, or find rational coordinates on the curve, and embedd it in $\mathbb{R}^3$ as a complex manifold.
We'll consider only hypersurfaces. Let $C = V(f)$, where $f$ is in the polynomial ring $\mathbb{C}[x,y]$, and $V(\bullet)$ is the zero locus of the ideal generated by $f$ (or the affine variety of $f$).
To do the intersection $C\cap \mathbb{R}^2$, if $f\in \mathbb{R}[x,y]$ it's enough to do the usual Calc 1 graph by considering $y=f(x)$. To visualize it as a complex line (which is a 2D surface), we need to find rational coordinates.
It's easy to do if there is a singularity in the curve, a general procedure is found in Matt Kerr's algebraic geometry course in Chapter 3, §3.3 Stereographic projection. Below is an alternative (shorter) description.
One finds $P=(x_0,y_0)\in C$, such that $\nabla f(P) =0$. Then we let $y = t(x-x_0) +y_0$. Since $f(x_0,y_0) = 0$, $x-x_0$ divides $f$ with some multiplicity.
So, $f(x,y(x,t))= (x-x_0)^k g(x,t)$ for some $k\in \mathbb{N}$, and $g\in \mathbb{C}[x,t]$. Finally, we solve $g(x,t) = 0$ for $x$ as a function of $t$. And, we get a parametrization $G: \mathbb{P}^1\rightarrow C$ given by, $$t\mapsto (x(t),y(t))$$
Here we're going to visualize the Riemann sphere, a node, and a cusp.
The Riemann sphere $S^2$ is isomorphic to $\mathbb{P}^1$. Moreover , $S^2 = V(x^2+y^2+z^2-1)$.
The real picture is of course a circle, we get it by doing $S^2\cap \mathbb{R}^2\times{0}$.
circle((0,0),1)
The gradient is $\langle2x,2y,2z\rangle$, so the origin is the only potentially singular point on the sphere,but the origin is not a point on the sphere, so the sphere has no singular points (i.e. $S^2$ is smooth ). Not everything is lost, we can still project from the north pole to the $xy$-plane by considering all the lines passing through $P=(0,0,1)$, and $Q=(u,v,0)$. We just loose the chunk of the sphere that contains the north pole.
$\vec{PQ} = (u,v,-1)$, so $L(t) = \vec{OP}+t\vec{PQ} = \langle tu,tv,1-t\rangle$. Consider $L(t)\cap S^2$, the intersection must satisfy, $$ (tu)^2 +(tv)^2 +(1-t)^2 = 1 \implies t^2u^2+t^2v^2 +1 -2t+t^2 = 1 \implies t(tu^2+tv^2-2+t) =0 $$
If $t=0$, we're at $P$ so this is not a point of interest, therefore we can divide by $t$. Then,
$$ t = \frac{2}{u^2+v^2+1}$$This gives us the inverse stereographic projection, by plugging in $t(u,v)$ into $L(t)$. $$u+iv \mapsto \left( \frac{2u}{u^2+v^2+1},\frac{2v}{u^2+v^2+1} , 1-\frac{2}{u^2+v^2+1}\right)$$
cm = colormaps.hsv
x = lambda u,v: 2*u/(u^2+v^2+1)
y = lambda u,v: 2*v/(u^2+v^2+1)
z = lambda u,v: (u^2+v^2-1)/(u^2+v^2+1)
cf = lambda u,v: u - floor(u)
G = (x,y,z)
parametric_plot3d(G,(-10,10),(-10,10),color = (cf,cm),plot_points=200, frame= false)
Let's visualize $V(y^2-x^3-x^2)$, we see it has singularity at $0$ (this kind of singularity is called a node).
var('x y')
implicit_plot(y^2-x^3-x^2, (x,-5,5),(y,-5,5), axes = True)
Now let's visualize it as a Riemann surface.
First we need to find a parametrization for $C := V(f)$, where $f(x,y) := y^2-x^3-x^2$.
From the real graph we see that there is a singularity at $0$, so we can parametrize by the slopes there.
f = y^2-x^3-x^2
solve(derivative(f,x) == 0,x),solve(derivative(f,y)==0,y)
([x == (-2/3), x == 0], [y == 0])
We see the origin is satisfied by the curve. So, we can set $y = tx$ to parametrize the curve by the slope $t$. We see by inspection that $x^2$ divides $f(x,y(x,t))$. So, we solve.
var('t')
g = f(x=x,y=t*x)/x^2
solve(g == 0,x)
[x == t^2 - 1]
Now, we can recover the real picture.
parametric_plot((t^2-1,t*(t^2-1)), (t,-2,2))
cm = colormaps.hsv
cf = lambda u,v: ((u+i*v)*(u+i*v)^2-1).imag() - floor(((u+i*v)*(u+i*v)^2-1).imag())
G = (lambda u,v: ((u+i*v)^2-1).real(),lambda u,v: ((u+i*v)^2-1).imag(),lambda u,v: ((u+i*v)*((u+i*v)^2-1)).real())
P = parametric_plot3d(G,(-2,2),(-1,1),color = (cf,cm),plot_points=80)
P = P.add_condition(lambda x,y,z: abs(x)^2+abs(y)^2+abs(z)^2<1.618)
P.show(frame=false, viewpoint=[[-0.923,0.2764,0.2678],96.38])
Now let's visualize $V(y^2-x^3)$, we see from the real picture it has a singularity at $0$ (this kind of singularity is called a cusp).
var('x y')
implicit_plot(y^2-x^3, (x,-0.2,1),(y,-1,1), axes = True)
Now let's visualize it as a Riemann surface.
First we need to find a parametrization for $X := V(f)$, where $f(x,y) := y^2-x^3$.
From the real graph we see that there is a singularity at $\underline{0}$, so we can parametrize by the slopes there. We check the gradient vanishes there to confirm that it is indeed a singularity.
var('x,y')
f = y^2-x^3
(solve(derivative(f,x) == 0,x),solve(derivative(f,y)==0,y))
([x == 0], [y == 0])
Now, we set $y = tx$ to parametrize the curve by the slope $t$.
var('t')
g = f(x=x,y=t*x)/x^2
solve(g == 0,x)
[x == t^2]
Let's see the parametric curve that we found.
parametric_plot((t^2,t^3),(-1,1))
x = lambda u,v: (u+i*v)^2
y = lambda u,v: (u+i*v)^3
cf = lambda u,v: y(u,v).imag() -floor(y(u,v).imag())
cm = colormaps.hsv
G= (lambda u,v: x(u,v).real(),lambda u,v: x(u,v).imag(),lambda u,v: y(u,v).real())
P = parametric_plot3d(G,(-2,2),(-1,1),color = (cf,cm),plot_points=200)
P = P.add_condition(lambda x,y,z: abs(x)^2+abs(y)^2+abs(z)^2<3)
P.show(frame=false, viewpoint = [[-0.923,0.2764,0.2678],96.38])