Re: Partial derivative function definitions
- To: mathgroup at smc.vnet.net
- Subject: [mg127544] Re: Partial derivative function definitions
- From: "Mat' G\." <ellocomateo at free.fr>
- Date: Fri, 3 Aug 2012 04:15:40 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <jvdf8c$c4p$1@smc.vnet.net>
2012-08-02 10:54, Mat' G. scripsit: > Hello, > Can someone please explain me why the following partial derivative > function definitions do not work? I get errors like: > General::ivar: -6.28229 is not a valid variable. >> > General::ivar: -5.38469 is not a valid variable. >> > General::ivar: -4.48709 is not a valid variable. >> > General::stop: Further output of General::ivar will be suppressed during > this calculation. >> > > Thanks for helping! > Mat > > > > > XFunction[x_, y_] := Sin[x] Sin[y]; > YFunction[x_, y_] := Cos[x] Cos[y]; > dXFunctiondx[x_, y_] := D[XFunction[x, y], x]; > dXFunctiondy[x_, y_] := D[XFunction[x, y], y]; > dYFunctiondx[x_, y_] := D[YFunction[x, y], x]; > dYFunctiondy[x_, y_] := D[YFunction[x, y], y]; > > Grid[{ > { > DensityPlot[ > XFunction[x, y], {x, -2 \[Pi], 2 \[Pi]}, {y, -2 \[Pi], 2 \[Pi]}] > , DensityPlot[ > YFunction[x, y], {x, -2 \[Pi], 2 \[Pi]}, {y, -2 \[Pi], 2 \[Pi]}] > } > , { > DensityPlot[ > dXFunctiondx[x, y], {x, -2 \[Pi], 2 \[Pi]}, {y, -2 \[Pi], 2 \[Pi]}] > , DensityPlot[ > dYFunctiondx[x, y], {x, -2 \[Pi], 2 \[Pi]}, {y, -2 \[Pi], 2 \[Pi]}] > } > , { > DensityPlot[ > dXFunctiondy[x, y], {x, -2 \[Pi], 2 \[Pi]}, {y, -2 \[Pi], 2 \[Pi]}] > , DensityPlot[ > dYFunctiondy[x, y], {x, -2 \[Pi], 2 \[Pi]}, {y, -2 \[Pi], 2 \[Pi]}] > } > }] > Thank you David Park for providing the answer: replacing the SetDelayed for the derivative function by Set! It does work now. I can plot the derivative, but I get a very poor resolution, that I cannot improve with MaxRecursion. Can anyone help me understand why please? How can I improve the derivative graphs resolution? My current file is to be found on: http://www.sendspace.com/file/haksg8 Thanks for helping!