Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: defining a function with D

  • To: mathgroup at
  • Subject: [mg37175] Re: defining a function with D
  • From: "Allan Hayes" <hay at>
  • Date: Tue, 15 Oct 2002 04:17:48 -0400 (EDT)
  • References: <aodnti$mlg$>
  • Sender: owner-wri-mathgroup at


We have

    dfx[x_,t_]= D[f[x,t],x]

        t Cos[t x]

One advantage of using = rather than := is that it differentiates once, when
the definition is stored,


        t Cos[t x]

With := we get


        dfx[x_,t_]:= D[f[x,t],x]


         dfx[x_, t_] := D[f[x, t], x]

So the differentiation is done each time that the function dfx is evaluated.


Allan Hayes
Mathematica Training and Consulting
Leicester UK
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Jason Miller" <millerj at> wrote in message
news:aodnti$mlg$1 at
> Dear Listers,
> I find myself defining functions in terms of differentiation.  For
> 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
> 660.785.7430

  • Prev by Date: Re: Get rid of onion-like parentheses
  • Next by Date: Re: re: Accuracy and Precision
  • Previous by thread: Re: defining a function with D
  • Next by thread: Re: Re: defining a function with D