Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Creating a function that is a derivative of another function??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86753] Re: Creating a function that is a derivative of another function??
  • From: Helen Read <read at math.uvm.edu>
  • Date: Thu, 20 Mar 2008 02:54:08 -0500 (EST)
  • References: <frqpr4$55a$1@smc.vnet.net>

Eric wrote:
> I have a function:
> 
> W[t_] := a*t + b*t^2 + c*t^3
> 
> I want the derivative of this funtion wrt t as another function.  The following seems like it works:
> 
> dW[t_] := D[W[t], t]
> 
> dW[t]
> a + 2 b t + 3 c t^2
> 
> But something isn't right??
> 
> dW[0]
> General::ivar: 0 is not a valid variable. >>
> (output line has a partial derivative symbol, subscript 0 followed by a 0)
> 
> The description of the General::ivar error isn't help either??
> 
> Any idea what's going on here??  How can I assign the derivative of a function as another funtion?!

The problem is with the set delayed in the definition of dW. When you 
substitute 0 for t, it is substituted in the definition of dW, and you 
wind up with the nonsensical D[W[t],0]

Try set instead:

dw[t_]=D[W[t],t]

and all is well.

However, there really isn't any need to do this to begin with, since 
having defined W[t], you can simply use

W'[t]

W'[0]

etc.

--
Helen Read
University of Vermont


  • Prev by Date: Re: Find roots in a limited interval
  • Next by Date: Re: Creating a function that is a derivative of another function??
  • Previous by thread: Re: Creating a function that is a derivative of another function??
  • Next by thread: Re: Creating a function that is a derivative of another function??