MathGroup Archive 1997

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

Search the Archive

Re: ? ? ? ! ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8270] Re: ? ? ? ! ?
  • From: "P.J. Hinton" <paulh>
  • Date: Sat, 23 Aug 1997 01:59:10 -0400
  • Organization: Wolfram Research, Inc.
  • Sender: owner-wri-mathgroup at wolfram.com

Lou Talman wrote:
> 
> Can anyone explain what v3.0 of Mathematica thinks it's doing when it
> executes
> 
>      Plot[Abs'[x], {x, -3/10, 3/10}]
> 
> ???
> 
> Note the prime:  The first argument of Plot was Abs'[x], not Abs[x].

The strange plot you are observing is being caused by artifcats
introduced by the numerical approximation of D[Abs[x],x].  

The kernel does not evaluate D[Abs[x],x] /. x -> x0 with the 
analytical formula (which I think you're expecting)

Which[x < 0, -1, x > 0, 1, x == 0, Indeterminate]

Rather it's taking finite difference approximations as one would do
with the ND function in NumericalMath`NLimit`.  The discontinuity
in the derivative of Abs[x] at x == 0 throws a wrench into the
machinery.

A way to compensate for your problem is to do the following.

In[1]:= <<NumericalMath`NLimit`

In[2]:= Plot[ND[Abs[x],x,x0,Scale -> 0.001],{x0,-3/10,3/10}]

The Scale option in ND forces the kernel to approximate the derivative
with a smaller stepsize, which reduces the prominence of the artifact
at x==0.

--
P.J. Hinton	
Mathematica Programming Group		paulh at wolfram.com
Wolfram Research, Inc.			http://www.wolfram.com/~paulh/


  • Prev by Date: Help required
  • Next by Date: Re: FindMinimum
  • Previous by thread: ? ? ? ! ?
  • Next by thread: Re: ? ? ? ! ?