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).


WorkingPrecisionsetting if this bothers you. – J. M.'s missing motivation Jan 30 '20 at 02:43SetSystemOptions["CheckMachineUnderflow"->False], this setting disable detection of machine underflow.Thank you very much. – A little mouse on the pampas Jan 30 '20 at 03:15