|
[Date Index]
[Thread Index]
[Author Index]
Re: Defining derivatives
- To: mathgroup at smc.vnet.net
- Subject: [mg87884] Re: Defining derivatives
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Sat, 19 Apr 2008 03:35:35 -0400 (EDT)
- 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];
>
> Further, where is the information about derivatives stored?
>
> thank's a lot, Daniel
>
>
>
Daniel,
Surely if f[x] has a definition, it is not unreasonable that this
definition is used prior to differentiation. Without the definition all
works well:
(f^\[Prime])[x_]:=f2[x];
D[f[2x],x]
2 f2[2 x]
BTW, if you only want the definition to be used for numerical cases, you
could always use:
f[x_?NumericQ]:=f1[x]
David Bailey
http://www.dbaileyconsultancy.co.uk
Prev by Date:
Re: How to solve this simple equation?
Next by Date:
Re: Debugger
Previous by thread:
Re: Defining derivatives
Next by thread:
Re: Defining derivatives
|