Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11191 > unrolled thread

Re: Partial derivative function definitions

Started byBob Hanlon <hanlonr357@gmail.com>
First post2012-08-03 08:21 +0000
Last post2012-08-03 08:21 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Partial derivative function definitions Bob Hanlon <hanlonr357@gmail.com> - 2012-08-03 08:21 +0000

#11191 — Re: Partial derivative function definitions

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-08-03 08:21 +0000
SubjectRe: Partial derivative function definitions
Message-ID<jvg1m0$rl3$1@smc.vnet.net>
You want the derivatives carried out while x and y are symbolic rather
than numeric, use Set rather than SetDelayed.

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];

Partition[DensityPlot[#[x, y],
     {x, -2 Pi, 2 Pi}, {y, -2 Pi, 2 Pi}] & /@
   {XFunction, YFunction,
    dXFunctiondx, dYFunctiondx,
    dXFunctiondy, dYFunctiondy}, 2] //
 Grid


Bob Hanlon


On Thu, Aug 2, 2012 at 4:50 AM, Mat' G. <ellocomateo@free.fr> wrote:
> 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]}]
>     }
>    }]
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web