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


Groups > comp.soft-sys.math.mathematica > #2885

Re: Dt@x@1

From Chris Chiasson <chris.chiasson@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Dt@x@1
Date 2011-06-02 11:15 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <is7rbs$rdk$1@smc.vnet.net> (permalink)
References <is4tgc$b3t$1@smc.vnet.net> <is55ug$d2e$1@smc.vnet.net>

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web