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

MathGroup Archive 2010

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

Search the Archive

Issuing Function Calls within a Plot command

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111477] Issuing Function Calls within a Plot command
  • From: Andrew DeYoung <adeyoung at andrew.cmu.edu>
  • Date: Tue, 3 Aug 2010 06:34:19 -0400 (EDT)

Hi,

It seems like Mathematica has difficulty plotting calls to other
functions.  Is this true? For example, can you help me understand why
the following does not plot?

If I write

myFunction[x_] := x^2;
Plot[D[myFunction[x], x], {x, 0, 5}]

nothing plots.

If I write

myFunction[x_] := x^2;
Plot[D[myFunction[x][x], x], {x, 0, 5}]

again, nothing plots.

However, if I compute the derivative of the function outside of the
Plot command,

myFunction[x_] := x^2;
myDerivative = D[myFunction[x], x]
Plot[myDerivative, {x, 0, 5}]

the derivative of x^2 (i.e., 2x) plots correctly.

Can anyone please help me understand why my first two tries do not
work, but my third try does?

Many thanks in advance.

Andrew DeYoung
Carnegie Mellon University
adeyoung at andrew.cmu.edu


  • Prev by Date: Ignore my past two posts
  • Next by Date: Re: ReplaceAll and ReplaceRepeated Strange Behavior
  • Previous by thread: Ignore my past two posts
  • Next by thread: Re: Issuing Function Calls within a Plot command