Re: More troubles coming from indexed variables

• To: mathgroup at smc.vnet.net
• Subject: [mg25022] Re: [mg25000] More troubles coming from indexed variables
• From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
• Date: Fri, 1 Sep 2000 21:57:30 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```I would propose a completely different approach. Define your own total
derivative as follows:

In[1]:=
datsimx = Table[x[k], {k, 1, 10}]; datsimy = datsimx /. x -> y;

In[2]:=
MyDt[f_] := Dt[f, Constants -> Join[datsimx, datsimy]];
MyDt[f_, x_] := Dt[f, x, Constants -> Join[datsimx, datsimy]]

Now:

In[3]:=
MyDt[x[3]]
Out[3]=
0

In[4]:=
MyDt[y[5]]
Out[4]=
0

In[5]:=
MyDt[u^3*y[5]*x[3], u]
Out[5]=
2
3 u  x[3] y[5]

and so on.

--
Andrzej Kozlowski
Toyama International University, JAPAN

For Mathematica related links and resources try:
<http://www.sstreams.com/Mathematica/>

on 9/1/00 6:09 AM, Barbara DaVinci at barbara_79_f at yahoo.it wrote:

> Cari MathGrouppisti
>
> Some time ago a post of mine just concerned indexed
> variables.
> (I had replies, kind an learned, from many persons -
> Matthias Bode, David Keith, Steven M. Christensen,
> Otto Linsuain and Hartmut Wolf.
> I thank them all.)
>
> Now an even worse trouble is running.
> I'm writing an educational notebook
> on least-square fit and in a subsection I must show
> how the well-known
> formula is carried out.
>
> This provides a symbolic data set :
> datsimx = Table[x[k], {k, 1, 10}]
> datsimy = datsimx /. x -> y
>
> {x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9],
> x[10]}
> {y[1], y[2], y[3], y[4], y[5], y[6], y[7], y[8], y[9],
> y[10]}
>
> Now I must declare x[1] ... x[10] and y[1] ... y[10]
> to be costants
> (otherwise D[] and Dt[] ...) .
>
> I tried two ways, both ineffective.
>
>
> (I)
> -----------------------------------------------------
>
> SetAttributes[SetAttributes, Listable];
> SetAttributes[datsimx, Constant];
> SetAttributes[datsimy, Constant];
>
> but I get
>
> Attributes[datsimx]
> {Constant}
>
> Attributes[datsimx[[1]]]
> Attributes::ssle: Symbol, string, or
> HoldPattern[symbol]
> expected at position 1 in Attributes[datsimx[[1]]]
>
> I suppose that is because
>
> x
>
>
>
> Symbol
>
> Therefore I'm not surprised seeing
>
>
> SetAttributes[#, Constant] & @ datsimx
>
> fails too.
>
> (II)
> -----------------------------------------------------
>
> I definded this function
>
> f[x_] := ToExpression[
> StringJoin[
> "Symbol[", ToString[x], "]"
> ]
> ]
> SetAttributes[f, Listable]
>
> whose aim is make x[i] "Symbol headed" ("so doing,
> maybe, SetAttributes stops shouting its warning
> messages", I deceived myself)
>
> But f[datsimx] make me howling with pain again:
>
>
> Symbol::string: String expected at position 1 in
> Symbol[x[1]].
> Symbol::string: String expected at position 1 in
> Symbol[x[2]].
> Symbol::string: String expected at position 1 in
> Symbol[x[3]].
> General::stop: Further output of Symbol::string will
> be suppressed during this calculation.
>
> (This message is rather unclear to me)
>
> -------------------------------------------
> Please, is there a way to get out alive ?
> -------------------------------------------
>
>
> Affettuosi saluti
> (The above is an Italian idiom meaning something like
> "yours sincerely")
>
> Barbara Da Vinci
>
>
> ______________________________________________________________________
> Do You Yahoo!?
> Il tuo indirizzo gratis e per sempre @yahoo.it su http://mail.yahoo.it
>
>

```

• Prev by Date: Re: ButtonBox, styles, GraphicsGenerator.nb
• Next by Date: what mathematical formula can generate a mobius strip?
• Previous by thread: More troubles coming from indexed variables
• Next by thread: Re: More troubles coming from indexed variables