I'm trying to visualize Boy's surface using Bryant's parametrization, as per the MathWorld article. However, I'm not sure I understand the parametrization, and I don't know how to implement it when the parameter is complex.
z := u + vI
g1 := -(3/2) Im[(z (1 - z^4))/(z^6 + z^3 √5 - 1)]
g2 := -(3/2) Re[(z (1 + z^4))/(z^6 + z^3 √5 - 1)]
g3 := Im[(1 + z^6)/(z^6 + z^3 √5 - 1)] - 1/2
g = g1^2 + g2^2 + g3^2
ParametricPlot3D[{g1/g, g2/g, g3/g}, {u, 0, 0.5}, {v, 0, 0.5}]
Now, I understand that $z=u+v\mathrm{i}$ is the parameter, and that it must range over the closed unit disc, so $u^2+v^2\leq1$. But I don't know how do do this! (I let $u,v$ range between 0 and 0.5, for good measure, but the graphic appears empty.)
In the end, I want to end up with exactly this image, for which I've been unable to find the original code.
Edit: The 3 solutions provided here worked like a charm (with the caveat that the one using polar coordinates was weirdly sharped, and I couldn't fix that, but I'm a Mathematica newb), and I found another method:
ParametricPlot3D[Boys[u, v], {u, v} ∈ Disk[{0, 0}, 1]]
I don't know why, but using RegionFunction
the surface rendered ~30% slower, and, using Piecewise
, about %5 slower. The only issue is that the mesh is now weirdly triangulated.
Also, I compiled the actual parametric formula and performance increased threefold:
Boys = Compile[{u,
v}, {(-(3/2)
Im[((u + v I) (1 - (u + v I)^4))/((u +
v I)^6 + (u + v I)^3 Sqrt[5] - 1.)])/((-(3/2)
Im[((u + v I) (1 - (u + v I)^4))/((u +
v I)^6 + (u + v I)^3 Sqrt[5] - 1.)])^2 + (-(3/2)
Re[((u + v I) (1 + (u + v I)^4))/((u +
v I)^6 + (u + v I)^3 Sqrt[5] - 1.)])^2 + (Im[(
1 + (u + v I)^6)/((u + v I)^6 + (u + v I)^3 Sqrt[5] - 1.)] -
1/2)^2), (-(3/2)
Re[((u + v I) (1 + (u + v I)^4))/((u +
v I)^6 + (u + v I)^3 Sqrt[5] - 1.)])/((-(3/2)
Im[((u + v I) (1 - (u + v I)^4))/((u +
v I)^6 + (u + v I)^3 Sqrt[5] - 1.)])^2 + (-(3/2)
Re[((u + v I) (1 + (u + v I)^4))/((u +
v I)^6 + (u + v I)^3 Sqrt[5] - 1.)])^2 + (Im[(
1 + (u + v I)^6)/((u + v I)^6 + (u + v I)^3 Sqrt[5] - 1.)] -
1/2)^2), (Im[(
1 + (u + v I)^6)/((u + v I)^6 + (u + v I)^3 Sqrt[5] - 1.)] - 1/
2)/((-(3/2)
Im[((u + v I) (1 - (u + v I)^4))/((u +
v I)^6 + (u + v I)^3 Sqrt[5] - 1.)])^2 + (-(3/2)
Re[((u + v I) (1 + (u + v I)^4))/((u +
v I)^6 + (u + v I)^3 Sqrt[5] - 1.)])^2 + (Im[(
1 + (u + v I)^6)/((u + v I)^6 + (u + v I)^3 Sqrt[5] - 1.)] -
1/2)^2)}, Parallelization -> True];
I also tried compiling each of $g1,g2,g3,g$ separately, but performance was a bit worse.
vI
is a different variable name; you needv I
with a space in between. $\endgroup$ParametricPlot3D[With[{z = r Exp[I θ]}, (#/(#.#)) &[Re[{I z (1 - z^4), z (z^4 + 1), -(2 I/3) (z^6 + 1)}/(z^6 + Sqrt[5] z^3 - 1) + {0, 0, 1/2}]]], {r, 0, 9/10}, {θ, -π, π}, PlotPoints -> {20, 30}]
$\endgroup$