# How to avoid mistakes when drawing Gaussian curvature image of explicit function?

I've got a way to calculate Gaussian curvature from here (which was written by J. M.). But when I applied it to the following function, I got a lot of error messages.

GaussianCurvature[f_, {u_, v_}] :=
Simplify[(Det[{D[f, {u, 2}], D[f, u], D[f, v]}] Det[{D[f, {v, 2}],
D[f, u], D[f, v]}] -
Det[{D[f, u, v], D[f, u],
D[f, v]}]^2)/(D[f, u].D[f, u] D[f, v].D[f,
v] - (D[f, u].D[f, v])^2)^2];

Options[gccolor]=DeleteCases[Options[ParametricPlot3D],\
ColorFunctionScaling\[Rule]_];
(gccolor[f_, {u_, ura__}, {v_, vra__}, opts : OptionsPattern[]] :=
Module[{cf = OptionValue[ColorFunction], gc},
If[cf === Automatic, cf = ColorData["ThermometerColors"]];
gc[u_, v_] = GaussianCurvature[f, {u, v}];
ParametricPlot3D[f, {u, ura}, {v, vra},
ColorFunction ->
Function[{x, y, z, u, v}, cf[1/(1 + Exp[-2 gc[u, v]])]],
ColorFunctionScaling -> False,
Evaluate[FilterRules[{opts}, Options[gccolor]]],
Lighting -> "Neutral"]]) // Quiet

gccolor[{x,
y, (x^4 - 6 x^2 y^2 + y^4)/(x^2 + y^2)^2 BesselJ[4,
17 Sqrt[x^2 + y^2]]} /. {x -> u, y -> v}, {u, -1, 1}, {v, -1, 1}]


How can I modify these codes to avoid corresponding errors (such as replacing 1 / 0. Curvature with 10 ^ 5).

• The errors you are seeing are due to a change in version 12 regarding the handling of underflow, see e.g. this. You might consider increasing the WorkingPrecision setting if this bothers you. Jan 30 '20 at 2:43
• In version 12.0, I set SetSystemOptions["CheckMachineUnderflow"->False], this setting disable detection of machine underflow.Thank you very much. Jan 30 '20 at 3:15