MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Bypassing built-in functions in differentiation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62640] Re: Bypassing built-in functions in differentiation
  • From: Peter Pein <petsie at dordos.net>
  • Date: Wed, 30 Nov 2005 00:06:23 -0500 (EST)
  • References: <dmh8hi$8n7$1@smc.vnet.net> <dmhfcv$bfj$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Ofek Shilon schrieb:
> 
> Hi Peter .
> 
> The results
> 
> In[3]:= Dt[Transpose[a]]
> Out[3]= Dt[a]
> 
> Are EXACTLY what I wish to avoid. ( as I wrote, I'm already able to
> reproduce them). what I hope to accomplish is smthng like -
> 
> In[2345]:= Dt[Transpose[a]]
> Out[2345]:=Transpose[Dt[a]]
> 
> That is, I cannot waive the Transpose head on the derivative.
> 
Oops, I didn't read carefully - sorry.

> Since my former post, I started using the following hack:
> 
> In[1]:= Transpose'[x_]:=Transpose[Dt[x]] / Dt[x]
> 
> Which compensates 'manually' for the Dt[x] factor formed by direct
> differentiation, but is still unsatisfactory - since it fails whenever
> Dt[x] is set externally to zero.

I'm currently testing
Unprotect[Transpose, Dt];
Dt[Transpose[x_]] := Transpose[Dt[x]];
Derivative[1][Transpose][x_] :=
   If[Dt[x] === 0, 0, Transpose[Dt[x]]/Dt[x]];

but have got difficulties to understand the meaning of Transpose[0] (or 
any other scalar).

> 
> 
> I often encounter seemingly strange behaviour from differentiation-
> heads. My overall experience is that Dt resists manual intervention in
> many ways that produce unpredictable results. Try the following input:
> 
> In[25]:=
> ScalarQ[Dt[f_,y_]]:=True /;TrueQ[ScalarQ[f]]
> ScalarQ[TestHead[f_,y_]]:=True /;TrueQ[ScalarQ[f]]
> 
> In[31]:=
> ScalarQ[x]=True
> 
> In[33]:=
> ScalarQ[Dt[x,y]]
> ScalarQ[TestHead[x,y]]
> 
> Out[33]=
> ScalarQ[Dt[x,y]]
> 
> Out[34]=
> True
> 
> Maybe Dt and its cousins (Derivative, D) undergo unconventional
> evaluation that I'm unaware of?

It is the pattern Dt[f_,y_] which evaluates to
Dt[f, y_]*Derivative[1, 0][Pattern][f, _], because 
FullForm[HoldPattern[Dt[f_,y_]]] is
HoldPattern[Dt[Pattern[f, Blank[]], Pattern[y, Blank[]]]].

ScalarQ behaves as expected, when it is defined via HoldPattern:

ScalarQ[HoldPattern[Dt[f_, y_]]] := True /; TrueQ[ScalarQ[f]]
ScalarQ[TestHead[f_, y_]] := True /; TrueQ[ScalarQ[f]]

> 
> 
> Ofek
> 

Regards,
   Peter


  • Prev by Date: 3D Plot of frequency data
  • Next by Date: Re: storage, compatibility and HP98xx
  • Previous by thread: Re: Bypassing built-in functions in differentiation
  • Next by thread: Re: Bypassing built-in functions in differentiation