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: [mg87890] Re: [mg87851] Defining derivatives
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sat, 19 Apr 2008 03:36:41 -0400 (EDT)
  • References: <200804181111.HAA18885@smc.vnet.net>

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