MathGroup Archive 1995

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

Search the Archive

Specifying derivatives of functions

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1177] Specifying derivatives of functions
  • From: mrj at cs.su.oz.au (Mark James)
  • Date: Sat, 20 May 1995 04:43:32 -0400

I have a function that can't be differentiated symbolically, so
I want to specify the derivative explicitly so that it is matched
and used whenever the derivative is requested.

Here is a simple example using a function whose derivative can be found:

------

f[x_,y_] := x y				(* The function *)
D[ Literal[f[x_,y_]], y_ ] ^:= 2x	(* Specify a different derivative *)
Derivative[0,1][Literal[f[x_,y_]]] ^:= 2x	(* Another way, equivalent? *)

?f	(* Look at the rules we've got *)

D[ f[1,y], y ]			(* Use    normal derivative, output = 1 *)
D[ Unevaluated[f[1,y]], y ]	(* Use alternate derivative, output = 2 *)

(* How can I ensure the alternative derivative is always picked up,
   e.g if I take the derivative of a function based on it. *)

g[y_] = f[1,y];
g'[1]			(* Want output = 2 *)

(* How can I force unevaluation of f whenever it is wrapped by
   the D function and get the alternate rule to match? *)

-----

One solution may be to remove the Unevaluated and Literal, and match
on "x y".  But I am using interpolated functions and I don't think
pattern matching on these objects goes too well.

I would appreciate any hints.  Thanks.

Mark James                                   |  EMAIL : mrj at cs.su.oz.au  |
Basser Department of Computer Science, F09   |  PHONE : +61-2-351-4276   |
The University of Sydney NSW 2006 AUSTRALIA  |  FAX   : +61-2-351-3838   |


  • Prev by Date: Re: BackGround Job
  • Next by Date: Re: Find the center!
  • Previous by thread: BackGround Job
  • Next by thread: Question from Blind User