Re: Re: Differentiation problem/bug?

• To: mathgroup at smc.vnet.net
• Subject: [mg69886] Re: [mg69783] Re: Differentiation problem/bug?
• From: Arturas Acus <acus at itpa.lt>
• Date: Tue, 26 Sep 2006 05:21:40 -0400 (EDT)
• References: <eevrea\$gfd\$1@smc.vnet.net> <200609230844.EAA22439@smc.vnet.net> <1159172183.1427.12.camel@acus.itpa.lt> <p06230900c13d8b8eea88@[130.95.49.83]>

```> >For example, using Dt I should explicitly write down rules not only for
> >independent variables, but for model parameters also. Thus model
> >variables and parameters mixes up, which for my opinion doesn't look
> >nice from the point of view of logical consistence.
>
> No. Use
>
>    SetAttributes[{a, b, c, ...}, Constant]
>
> for (constant) model parameters.
>
> So, for example, for model parameters a and b,
>
>    SetAttributes[{a, b}, Constant]
>
> and for independent variables x and y,
>
>    Dt[y, x] ^= 0; Dt[x, y] ^= 0
>
> then compute
>
>    Dt[a x + b y, x]

Well, what then is difference between You approach and  Dt[a x,x,
Constants->a], which is like oposite approach of D[expr, Nonconstants
->aaaa]. I would guess, that the main point is the use of Attribute.
This actually affects evaluation procedure, and most probably positively
(rezulting in faster evaluation). Nice.

The only problem I see is how to define diferential operators using Your
approach, where differentiation variables are unknown in advance. For
example in my approach definition of one of nabla operator component (in
circular basis -1,0,1) was easy:

SetAttributes[\[EmptyDownTriangle], {HoldFirst}];
Options[\[EmptyDownTriangle]]={NonConstants->{{F},{},{}},Variables->{r,
\[Theta],\[CurlyPhi]}};

\[EmptyDownTriangle]/:
\[EmptyDownTriangle][expr_,1,opts___?OptionQ]:=Module[{vars,re,th,ph,nonCon},
vars = Variables /. {opts} /. Options[\[EmptyDownTriangle],
Variables];
re = vars[[1]]; th = vars[[2]]; ph = vars[[3]];

NonConstants]}]];

((-1/Sqrt[2])*Exp[I*ph]*(Sin[th]*D[expr,re,nonCon[[1]]]+(Cos[th]/re)*D[expr,th,nonCon[[2]]]+(I/(re*Sin[th]))*D[expr,ph,nonCon[[3]]]))
]

But when I have to deal with rules like  Dt[th, r] ^= 0 ; Dt[ph, r] ^= 0
etc... in operator definition, then I have in some way to temporary
isolate them in Block or Module. Would it work nice?

>
> Cheers,
> Paul
--
Arturas Acus <acus at itpa.lt>

```

• Prev by Date: Re: Mapping Functions That Take More Than One Argument
• Next by Date: Re: problem evaluating a function on a list
• Previous by thread: Re: Re: Differentiation problem/bug?
• Next by thread: Re: Differentiation problem/bug?