MathGroup Archive 2008

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

Search the Archive

Re: Defining derivatives


You can store it with Derivative. Not that

In[7]:= Attributes[Derivative]
Out[7]= {NHoldAll, ReadProtected}

does not include Protected. So:

f[x_] := f1[x]
Derivative /: Derivative[1][f] = f2

gives

f'[x]
f2[x]

Of course this still leaves the problem that

D[f[x], x]
Derivative[1][f1][x]

but, on the other hand, why are you trying to do this? Why not simply  
define:

f[x_] := f1[x]
Derivative[1][f1] = f2;

In which case we get also

D[f[x], x]
f2(x)


Andrzej Kozlowski



On 18 Apr 2008, at 20:11, 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];
>
> Further, where is the information about derivatives stored?
>
> thank's a lot, Daniel
>
>
>



  • Prev by Date: Re: Directory of Mathematica Add-Ons
  • Next by Date: Re: Scaling Plot inside Row
  • Previous by thread: Re: Defining derivatives
  • Next by thread: Re: Defining derivatives