Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Defining derivatives

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87958] Re: Defining derivatives
  • From: dh <dh at metrohm.ch>
  • Date: Mon, 21 Apr 2008 03:26:12 -0400 (EDT)
  • References: <fu9vnl$igu$1@smc.vnet.net> <fueeme$b6g$1@smc.vnet.net>


Hi Jean-Marc,

is this a typo?: f'[x] ^:= f2[x]

this would only worj for the variable x.

Daniel



Jean-Marc Gulliet wrote:

> dh wrote:

>> Hello All,

>>

>> does anybody know how to define symbolic derivatives. E.g.:

>>

>> f[x_]:=f1[x];

>>

>> f'[x_]:=f2[x];

>>

>> this does not work because f on the lefthand side is evaluated. To 

>>

>> prevent this (do not forget to remove f before redefining it):

>>

>> f[x_]:=f1[x];

>>

>> HoldPattern[f'[x_]]:=f2[x];

>>

>> this gives no message, but f'[x] returns f1[x] instead of f2[x].

>>

>> The same thinhg happens when you change the sequence of definitions:

>>

>> f'[x_]:=f2[x];

>>

>> f[x_]:=f1[x];

> 

> <snip>

> 

> Daniel,

> 

> You should use *up values*. You can define them thanks to *UpSet[]* or 

> *UpSetDelayed[]*. For instance,

> 

> In[1]:= Remove[f]

> f[x_] := f1[x]

> f'[x] ^:= f2[x]

> f'[x]

> 

> Out[4]= f2[x]

> 

> Best regards,

> -- Jean-Marc

> 




  • Prev by Date: Re: Very Long Wait for the Kernel after Reboot
  • Next by Date: Re: NDSolve and vector functions
  • Previous by thread: Re: Defining derivatives
  • Next by thread: Re: Defining derivatives