MathGroup Archive 1997

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

Search the Archive

Re: Q. How to work with derivative?

  • To: mathgroup at
  • Subject: [mg6664] Re: [mg6615] Q. How to work with derivative?
  • From: seanross at
  • Date: Wed, 9 Apr 1997 09:15:05 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Yaroslaw Bazaliy wrote:
> If any one has any experience with the following, could you please
> help?
> Suppose I have a function f[x], say f[x]=x^3. Then I want to calculate
> the derivative of say Log[f[x]] and evaluate it at some point, say x=3.
> I try:
> --------------------------------------
> Clear[f,s];
> f[x_]:=x^3;
> s[x_]:=D[Log[f[x]],x];
> s[3]
> General::"ivar": "\!\(3\) is not a valid variable."
> Out[47]=
> \!\(\[PartialD]\_3 Log[27]\)
> -------------------------------------
> Try onother approach:
> ------------------------------------------------
> Clear[f];
> f[x_]:=x^3;
> Function[x,D[Log[f[x]],x]][3]
> General::"ivar": "\!\(3\) is not a valid variable."
> Out[48]=
> \!\(\[PartialD]\_3 Log[27]\)
> ------------------------------------------------
> Both times my "3" goes into the notation for derivative, so
> it appears as if I want to differentiate with respect to "3".
> Of course I can do
> -----------------------------------------------
> Clear[f];
> f[x_]:=x^3;
> D[Log[f[x]],x]/.x->3
> Out[]=
> 1
> -----------------------------------------------
> and get the result, but I need a _function_ (which I can later
> plot for instanse). What is the possible way to do it along the lines
> of my first approach?
> Thank you for all suggestions,
> Yaroslaw.

Usually mathematica gets confused with such notation as:


It thinks all the x's are the same symbol whereas you, the user, clearly 
see that the x's in the derivative are "dummy" variabls and the x_ is a 
discrete point.  To get around this, try something like:


Under certain conditions, you may even need to do this in two lines 
using a holder symbol like:


I also notice that your examples all used the delayed equals :=.  If 
something that makes sense to you doesn't work, it is always a good idea 
to experiment around with the immediate equals =.  In this case, you 
want immediate equals.

  • Prev by Date: Re: Tracing
  • Next by Date: isocontours on sphere
  • Previous by thread: Re: Q. How to work with derivative?
  • Next by thread: Re: Q. How to work with derivative?