Re: defining a function with D
- To: mathgroup at smc.vnet.net
- Subject: [mg37170] Re: defining a function with D
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 15 Oct 2002 04:17:40 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <aodnti$mlg$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
f[x_, t_] := Sin[x*t]
dfx[x_, t_] := Module[{y, df},
df = D[f[y, t], y];
Block[{y = x},
df
]
]
Regards
Jens
Jason Miller wrote:
>
> Dear Listers,
>
> I find myself defining functions in terms of differentiation. For example,
>
> f[x_,t_]:=Sin[x*t]
> dfx[x_,t]:=D[Sin[y,t],y]/.y->x
>
> This works well, but it seems to me that there should be a better way
> to do this. That is, there should be a better way to define a
> 'derivative' of a previous function without going through the
> replacement contortions. I can't find the answer in the archive.
> Can someone tell me the most straightforward way to do this? Will it
> work to define a gradient vector or Jacobian matrix? A Hessian
> matrix?
>
> Thanks in advance.
> --
> Jason Miller, Ph.D.
> Division of Mathematics and Computer Science
> Truman State University
> 100 East Normal St.
> Kirksville, MO 63501
> http://vh216801.truman.edu
> 660.785.7430