Re: Anomaly? or at least a surprise.

• To: mathgroup at smc.vnet.net
• Subject: [mg90286] Re: Anomaly? or at least a surprise.
• From: Bill Rowe <readnews at sbcglobal.net>
• Date: Fri, 4 Jul 2008 03:59:50 -0400 (EDT)

On 7/3/08 at 6:12 AM, stevebg at roadrunner.com (Steve Gray) wrote:

>Doing D[ArcTan[x], x] gives 1/(x^2+1) as expected. Doing
>Plot[D[ArcTan[x]],{x,-10,10},PlotRange->Full] with no variable to
>differentiate by gives a correct plot (!) This is surprising - Help
>says nothing about leaving out the independent variable even when
>the function is of only one variable.

If you do D[5.] you will see what is happening here. And note

Plot[D[ArcTan[x]],{x,-10,10}]

results in exactly the same graphic as

Plot[ArcTan[x], {x,-10,10}]

>Now, doing Plot[D[ArcTan[x],
>x], {x, -10, 10}, PlotRange -> Full] gives error messages such as

>General::ivar: -9.18326 is not a valid variable. >> General::ivar:
>-9.59143 is not a valid variable. >>, etc.

>I thought that D[ArcTan[x], x] and 1/(x^2+1) should behave
>identically in the Plot statement.

This doesn't work as you expect because of the way Plot works.
Plot first substitutes a numerical value for x then attempts to
evaluate the expression using that numeric value. Since an
expression like D[ArcTan[.5],.5] makes no sense, you get the
error messages.

The way to avoid this is to tell Mathematica to evaluate the
expression before Plot substitutes numeric values for x. This is
done by

Plot[Evaluate@D[ArcTan[x],x],{x,-10,10}]

• Prev by Date: Re: Anomaly? or at least a surprise.
• Next by Date: Re: Re: Problem with parametric minimization
• Previous by thread: Re: Anomaly? or at least a surprise.
• Next by thread: Re: Anomaly? or at least a surprise.