|
[Date Index]
[Thread Index]
[Author Index]
Re: Dt@x@1
- To: mathgroup at smc.vnet.net
- Subject: [mg119399] Re: Dt@x@1
- From: magma <maderri2 at gmail.com>
- Date: Thu, 2 Jun 2011 07:14:40 -0400 (EDT)
- References: <is4tgc$b3t$1@smc.vnet.net> <is55ug$d2e$1@smc.vnet.net>
On Jun 1, 12:57 pm, "Nasser M. Abbasi" <n... at 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
Prev by Date:
Re: Mapping to Create Nested Loops
Next by Date:
Re: Pure functions and Select[] sequential elements of list
Previous by thread:
Re: Dt@x@1
Next by thread:
Re: Dt@x@1
|