Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11172 > unrolled thread
| Started by | "Mat' G\." <ellocomateo@free.fr> |
|---|---|
| First post | 2012-08-02 08:54 +0000 |
| Last post | 2012-08-04 10:05 +0000 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Partial derivative function definitions "Mat' G\." <ellocomateo@free.fr> - 2012-08-02 08:54 +0000
Re: Partial derivative function definitions "Mat' G\." <ellocomateo@free.fr> - 2012-08-03 08:34 +0000
Re: Partial derivative function definitions Bob Hanlon <hanlonr357@gmail.com> - 2012-08-04 10:05 +0000
| From | "Mat' G\." <ellocomateo@free.fr> |
|---|---|
| Date | 2012-08-02 08:54 +0000 |
| Subject | Partial derivative function definitions |
| Message-ID | <jvdf8c$c4p$1@smc.vnet.net> |
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] | [next] | [standalone]
| From | "Mat' G\." <ellocomateo@free.fr> |
|---|---|
| Date | 2012-08-03 08:34 +0000 |
| Message-ID | <jvg2e0$rnt$1@smc.vnet.net> |
| In reply to | #11172 |
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!
[toc] | [prev] | [next] | [standalone]
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Date | 2012-08-04 10:05 +0000 |
| Message-ID | <jvis4p$2uh$1@smc.vnet.net> |
| In reply to | #11172 |
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];
The fuzziness is caused by the smoothness of the functions. You might
want to use a Mesh or just use ContourPlot rather than DensityPlot.
ContourPlot also provides tooltips.
Partition[DensityPlot[#[x, y],
{x, -2 Pi, 2 Pi}, {y, -2 Pi, 2 Pi},
Mesh -> 9,
MeshFunctions -> (#3 &)] & /@
{XFunction, YFunction,
dXFunctiondx, dYFunctiondx,
dXFunctiondy, dYFunctiondy}, 2] // Grid
Partition[ContourPlot[#[x, y],
{x, -2 Pi, 2 Pi}, {y, -2 Pi, 2 Pi}] & /@
{XFunction, YFunction,
dXFunctiondx, dYFunctiondx,
dXFunctiondy, dYFunctiondy}, 2] // Grid
Bob Hanlon
On Fri, Aug 3, 2012 at 4:15 AM, Mat' G. <ellocomateo@free.fr> wrote:
> 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!
>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web