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


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

Dt@x@1

Started byChris Chiasson <chris.chiasson@gmail.com>
First post2011-06-01 08:33 +0000
Last post2011-06-04 10:20 +0000
Articles 7 — 4 participants

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


Contents

  Dt@x@1 Chris Chiasson <chris.chiasson@gmail.com> - 2011-06-01 08:33 +0000
    Re: Dt@x@1 "Nasser M. Abbasi" <nma@12000.org> - 2011-06-01 10:57 +0000
      Re: Dt@x@1 Chris Chiasson <chris.chiasson@gmail.com> - 2011-06-02 11:15 +0000
      Re: Dt@x@1 magma <maderri2@gmail.com> - 2011-06-02 11:14 +0000
      Re: Dt@x@1 Chris Chiasson <chris.chiasson@gmail.com> - 2011-06-02 11:14 +0000
    Re: Dt@x@1 Roland Franzius <roland.franzius@uos.de> - 2011-06-02 23:12 +0000
      Re: Dt@x@1 Chris Chiasson <chris.chiasson@gmail.com> - 2011-06-04 10:20 +0000

#2861 — Dt@x@1

FromChris Chiasson <chris.chiasson@gmail.com>
Date2011-06-01 08:33 +0000
SubjectDt@x@1
Message-ID<is4tgc$b3t$1@smc.vnet.net>
Why does Dt@x@1 return zero? I would expect it to return unevaluated.
I noticed this when trying to use expressions similar to D[x@1,y] and
kept receiving zero as the answer. The same "problem" occurs with
multidimensional input.

What should I be doing if I want to generate and symbolically work
with the Jacobian of a multidimensional coordinate transformation? Do
I have to generate unique symbols for every dimension?

I noticed that in the Jacobian article on Mathworld, the notebook uses
Subscript in the symbolic expressions (eww).

In[41]:= $Version

Out[41]= "8.0 for Microsoft Windows (32-bit) (November 7, 2010)"

Thanks,
--
http://chris.chiasson.name


[toc] | [next] | [standalone]


#2879

From"Nasser M. Abbasi" <nma@12000.org>
Date2011-06-01 10:57 +0000
Message-ID<is55ug$d2e$1@smc.vnet.net>
In reply to#2861
On 6/1/2011 1:33 AM, Chris Chiasson wrote:
> Why does Dt@x@1 return zero?


Dt[ x[1] ]

The last evaluation of x[1] in the call gave 1, and this is
what is left and is passed to Dt and then Dt[1] returns zero.

You can see that by

-----------------------

In[65]:= Remove["Global`*"]

TracePrint@Dt [ x[1] ]
During evaluation of In[65]:=  Dt[x[1]]
During evaluation of In[65]:=   Dt
During evaluation of In[65]:=   x[1]
During evaluation of In[65]:=    x
During evaluation of In[65]:=    1
During evaluation of In[65]:=  0
Out[66]= 0

------------------------------

But what I do not know, is why when typing

In[84]:= x[1]

one gets back

Out[84]= x[1]

and so, now it did not 'evaluate' to 1 like it seems to have
done inside Dt call above.

I can see that x[1] should return x[1], but I am not sure
why x[1] ended 1 inside the Dt call as shown by the trace above
and not when typing it on the top level.

This is for the experts to explain, something to do with how
different evaluation rules works in different contexts I suppose.

--Nasser

[toc] | [prev] | [next] | [standalone]


#2885

FromChris Chiasson <chris.chiasson@gmail.com>
Date2011-06-02 11:15 +0000
Message-ID<is7rbs$rdk$1@smc.vnet.net>
In reply to#2879
On Jun 1, 5:57 am, "Nasser M. Abbasi" <n...@12000.org> wrote:
> On 6/1/2011 1:33 AM, Chris Chiasson wrote:
>
> > Why does Dt@x@1 return zero?
>
> Dt[ x[1] ]
>
> The last evaluation of x[1] in the call gave 1, and this is
> what is left and is passed to Dt and then Dt[1] returns zero.
>
> You can see that by
>
> -----------------------
>
> In[65]:= Remove["Global`*"]
>
> TracePrint@Dt [ x[1] ]
> During evaluation of In[65]:=  Dt[x[1]]
> During evaluation of In[65]:=   Dt
> During evaluation of In[65]:=   x[1]
> During evaluation of In[65]:=    x
> During evaluation of In[65]:=    1
> During evaluation of In[65]:=  0
> Out[66]= 0
>
> ------------------------------
>
> But what I do not know, is why when typing
>
> In[84]:= x[1]
>
> one gets back
>
> Out[84]= x[1]
>
> and so, now it did not 'evaluate' to 1 like it seems to have
> done inside Dt call above.
>
> I can see that x[1] should return x[1], but I am not sure
> why x[1] ended 1 inside the Dt call as shown by the trace above
> and not when typing it on the top level.
>
> This is for the experts to explain, something to do with how
> different evaluation rules works in different contexts I suppose.
>
> --Nasser

Turning everything into symbols seems to work, but I am not sure why I
would have to do that. I also couldn't make this solution work with
the multidimensional form of Dt. I had to use Outer.

Function[{var}, (var[i_Integer] :=
     With[{char = ToString@var},
      With[{symb = Symbol[char <> ToString@i]},
       Format[symb] := Subscript[var, i]; var@i = symb]])] /@ {x, X};

Outer[Dt, x /@ Range@3, X /@ Range@3] // TraditionalForm

--
http://chris.chiasson.name

[toc] | [prev] | [next] | [standalone]


#2897

Frommagma <maderri2@gmail.com>
Date2011-06-02 11:14 +0000
Message-ID<is7ras$rcf$1@smc.vnet.net>
In reply to#2879
On Jun 1, 12:57 pm, "Nasser M. Abbasi" <n...@12000.org> wrote:
> On 6/1/2011 1:33 AM, Chris Chiasson wrote:
>
> > Why does Dt@x@1 return zero?
>
> Dt[ x[1] ]
>
> The last evaluation of x[1] in the call gave 1, and this is
> what is left and is passed to Dt and then Dt[1] returns zero.
>
> You can see that by
>
> -----------------------
>
> In[65]:= Remove["Global`*"]
>
> TracePrint@Dt [ x[1] ]
> During evaluation of In[65]:=  Dt[x[1]]
> During evaluation of In[65]:=   Dt
> During evaluation of In[65]:=   x[1]
> During evaluation of In[65]:=    x
> During evaluation of In[65]:=    1
> During evaluation of In[65]:=  0
> Out[66]= 0
>
> ------------------------------
>
> But what I do not know, is why when typing
>
> In[84]:= x[1]
>
> one gets back
>
> Out[84]= x[1]
>
> and so, now it did not 'evaluate' to 1 like it seems to have
> done inside Dt call above.
>
> I can see that x[1] should return x[1], but I am not sure
> why x[1] ended 1 inside the Dt call as shown by the trace above
> and not when typing it on the top level.
>
> This is for the experts to explain, something to do with how
> different evaluation rules works in different contexts I suppose.
>
> --Nasser

To Chris:
Dt@x@1 is grouped and parsed from right to left as Dt[x[1]].
Now x[1] is the VALUE of function x applied to the argument 1.
Unless x[1] as been defined earlier with some symbols, it is
considered a constant so its differential Dt is zero.
There is nothing strange or unusual about it, just plain math.

To Nasser:
the 1 that you see in TracePrint is the result of evaluating the
argument 1. So the result is 1. You can verify this by evaluating

TracePrint[Dt@x@2]

where you get 2 as a result of evaluating the argument 2

x[1] is left unevaluated (so the result is still x[1]) when you just
type it by itself.
hth

[toc] | [prev] | [next] | [standalone]


#2898

FromChris Chiasson <chris.chiasson@gmail.com>
Date2011-06-02 11:14 +0000
Message-ID<is7rb6$rcq$1@smc.vnet.net>
In reply to#2879
On Jun 1, 5:57 am, "Nasser M. Abbasi" <n...@12000.org> wrote:
> On 6/1/2011 1:33 AM, Chris Chiasson wrote:
>
> > Why does Dt@x@1 return zero?
>
> Dt[ x[1] ]
>
> The last evaluation of x[1] in the call gave 1, and this is
> what is left and is passed to Dt and then Dt[1] returns zero.
>
> You can see that by
>
> -----------------------
>
> In[65]:= Remove["Global`*"]
>
> TracePrint@Dt [ x[1] ]
> During evaluation of In[65]:=  Dt[x[1]]
> During evaluation of In[65]:=   Dt
> During evaluation of In[65]:=   x[1]
> During evaluation of In[65]:=    x
> During evaluation of In[65]:=    1
> During evaluation of In[65]:=  0
> Out[66]= 0
>
> ------------------------------
>
> But what I do not know, is why when typing
>
> In[84]:= x[1]
>
> one gets back
>
> Out[84]= x[1]
>
> and so, now it did not 'evaluate' to 1 like it seems to have
> done inside Dt call above.
>
> I can see that x[1] should return x[1], but I am not sure
> why x[1] ended 1 inside the Dt call as shown by the trace above
> and not when typing it on the top level.
>
> This is for the experts to explain, something to do with how
> different evaluation rules works in different contexts I suppose.
>
> --Nasser

Just shooting from the hip:
The 1 that you are seeing is just Mathematica attempting to evaluate
the argument of a function before looking for DownValues of x. I.e.
x[1+1] would see {1+1,2} in its evaluation chain, or 1+1 newline 2 at
the same indentation level in the TracePrint.

[toc] | [prev] | [next] | [standalone]


#2914

FromRoland Franzius <roland.franzius@uos.de>
Date2011-06-02 23:12 +0000
Message-ID<is95cc$61r$1@smc.vnet.net>
In reply to#2861
Am 01.06.2011 10:33, schrieb Chris Chiasson:
> Why does Dt@x@1 return zero? I would expect it to return unevaluated.

The chain rule for Dt acting on a chain of functions of a single 
argument says

Dt@x@1 = x'[1] Dt[1]  ~  Dt[1]=0

Compare

Trace[Dt[x[y[w[u]]], Constants -> {u, v}]] // TreeForm

Trace[Dt[x[y[w[z]]], Constants -> {u, v}]] // TreeForm

to see that Dt[mostinnnerargument]->0 is used as a rule without 
calulating superflous inner derivatives x', y', w' first.

Its of course the simplifying use of those general cancelling rules, 
easy to recognize and to apply, that makes the CAS working at all (in a 
limited collection of cases in finite time ;-( ).

-- 

Roland Franzius

[toc] | [prev] | [next] | [standalone]


#2933

FromChris Chiasson <chris.chiasson@gmail.com>
Date2011-06-04 10:20 +0000
Message-ID<isd0u6$1op$1@smc.vnet.net>
In reply to#2914
On Jun 2, 6:12 pm, Roland Franzius <roland.franz...@uos.de> wrote:
> Am 01.06.2011 10:33, schrieb Chris Chiasson:
>
> > Why does Dt@x@1 return zero? I would expect it to return unevaluated.
>
> The chain rule for Dt acting on a chain of functions of a single
> argument says
>
> Dt@x@1 = x'[1] Dt[1]  ~  Dt[1]=0
>
> Compare
>
> Trace[Dt[x[y[w[u]]], Constants -> {u, v}]] // TreeForm
>
> Trace[Dt[x[y[w[z]]], Constants -> {u, v}]] // TreeForm
>
> to see that Dt[mostinnnerargument]->0 is used as a rule without
> calulating superflous inner derivatives x', y', w' first.
>
> Its of course the simplifying use of those general cancelling rules,
> easy to recognize and to apply, that makes the CAS working at all (in a
> limited collection of cases in finite time ;-( ).
>
> --
>
> Roland Franzius

Thank you for the explanation Roland. I appreciate it. In another
reply, I posted a method to get x[1] to behave as a symbol (i.e. as if
the computer understood x to have SubValues).

[toc] | [prev] | [standalone]


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


csiph-web