1

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

enter image description here

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574

1 Answers1

2

J. M. is in limbo♦ code seems to work when sections not commented out.

enter image description here

MMA v11.2

Manuel --Moe-- G
  • 1,057
  • 1
  • 8
  • 16