       Re: Re: Defining derivatives

• To: mathgroup at smc.vnet.net
• Subject: [mg88025] Re: [mg87996] Re: Defining derivatives
• From: "W_Craig Carter" <ccarter at mit.edu>
• Date: Tue, 22 Apr 2008 06:27:47 -0400 (EDT)
• References: <fu9vnl\$igu\$1@smc.vnet.net> <fueeme\$b6g\$1@smc.vnet.net>

```>  >      Derivative[f1] = f2;
>  >
>
>  What can one _do_ with this construction?

>  Can one then plot or evaluate f1, without further ado?

Fun, amusement, education, research, profit, ego... Here is an example
that satisfies 4/6.

(*caveat pedants, this is intended as a pedagogical exercise, lifted
from my course notes, flames ignored*)

GraphFunction[x_, y_] := ((x - y) (x + y))/(1 + (x + y)^2) (*simple
graph f(x,y) )

\$Assumptions =  {x \[Element] Reals, y \[Element] Reals}; (*give
simplify a hint *)

CurvatureOfGraph[f_, x_, y_] :=  (*def. of curvature of f(x,y)*)
FullSimplify[ (*silly to call simplify each time the function is
called? not always*)
Module[{dfdx = D[f[x, y], x], dfdy = D[f[x, y], y],
d2fdx2 = D[f[x, y], {x, 2}], d2fdy2 = D[f[x, y], {y, 2}],
d2fdxdy = D[f[x, y], x, y]} ,
Return[((1 + dfdx^2) d2fdx2 -
2 dfdx dfdy d2fdxdy + (1 + dfdy^2) d2fdy2)/
Sqrt[1 + dfdx^2 + dfdy^2]]]]

CurvFunc =  (*mysterious function definition for out particular surface*)
Function[{x, y}, Evaluate[CurvatureOfGraph[GraphFunction, x, y]]]

(*enigmatic defintions for partials on our surface*)
dfdx = Function[{x, y}, Evaluate[FullSimplify[D[GraphFunction[x, y], x]]]]
dfdy = Function[{x, y}, Evaluate[FullSimplify[D[GraphFunction[x, y], y]]]]

angle[x_] := ((Pi/2 + ArcTan[x])/Pi)

(*plot of function showing height, curvature, and normals, all in one go*)

plotcurvature =
Plot3D[GraphFunction[x, y], {x, -3, 3}, {y, 3, -3},
MeshFunctions -> (CurvFunc[#1, #2] &),
MeshStyle -> Thick,
PlotLabel -> "Curvatures(level sets) and Normals(color variation)",
ColorFunction -> (Glow[
RGBColor[angle[dfdx[#1, #2]], angle[dfdy[#1, #2]], 0.75]]
&),ColorFunctionScaling -> False, Lighting -> None]

(*I think that's something*)
--
W. Craig Carter

```

• Prev by Date: installing Playe rPro killed using Mathematica itself: BEWARE!
• Next by Date: matrix of vectors - super slow
• Previous by thread: Re: Defining derivatives
• Next by thread: Re: Defining derivatives