|
[Date Index]
[Thread Index]
[Author Index]
Re: Defining derivatives
- To: mathgroup at smc.vnet.net
- Subject: [mg87899] Re: Defining derivatives
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sat, 19 Apr 2008 23:49:23 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <fu9vnl$igu$1@smc.vnet.net>
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: A kernel, multiple notebooks, and Global?
Next by Date:
Re: NDSolve with Piecewise function
Previous by thread:
Re: Defining derivatives
Next by thread:
Re: Defining derivatives
|