Everything works fine in version 10, but in Version 11.20 there is a slice taken out of the Klein Bottle image…It does this no matter what version of the code I use in Version 11.2. It also does it while making a stylized Klein Bottle described here…
Here is an example of code that makes a faulty output…Can someone come up with code that makes a proper Klein Bottle without a slice taken out out it in Version 11.20?
klein[u_, v_] := Module[{
bx = 6 Cos[u] (1 + Sin[u]),
by = 16 Sin[u],
rad = 4 (1 - Cos[u]/2),
X, Y, Z},
X = If[Pi < u <= 2 Pi, bx + rad Cos[v + Pi], bx + rad Cos[u] Cos[v]];
Y = If[Pi < u <= 2 Pi, by, by + rad Sin[u] Cos[v]];
Z = rad Sin[v];
{X, Y, Z}
]
ParametricPlot3D[klein[u, v], {u, 0, 2 Pi}, {v, 0, 2 Pi},
Axes -> False, Boxed -> False, ViewPoint -> {1.4, -2.6, -1.7}]
For those interested, Wolfram tech support got back to me and gave the solution…In version 11 one must add… “Exclusions->None” to the ParemetricPlot3D command…Tech Support said…“Exclusions were re-worked internally in Version 11, and this seems to be a regression from doing so.”
Support may have said it’s a regression, but really, I believe it is an advance: The exclusions-processing capabilities now recognize the switch between formulas at u == Pi. (The next step in exclusion-processing will be, or at least could be, recognizing when such a switch is a true discontinuity or not. That’s my opinion, by the way. There may be no intention at WRI to develop in that direction.)
Another workaround is to hide the symbolic parametrization with _?NumericQ:
klein[u_?NumericQ, v_?NumericQ] :=
Module[{bx = 6 Cos[u] (1 + Sin[u]), by = 16 Sin[u],
rad = 4 (1 - Cos[u]/2), X, Y, Z},
X = If[Pi < u <= 2 Pi, bx + rad Cos[v + Pi], bx + rad Cos[u] Cos[v]];
Y = If[Pi < u <= 2 Pi, by, by + rad Sin[u] Cos[v]];
Z = rad Sin[v];
{X, Y, Z}]
ParametricPlot3D[klein[u, v], {u, 0, 2 Pi}, {v, 0, 2 Pi},
Axes -> False, Boxed -> False, ViewPoint -> {1.4, -2.6, -1.7}]