MathGroup Archive 2006

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

Search the Archive

Re: Points sampled by N[Derivative[]]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71968] Re: Points sampled by N[Derivative[]]
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Wed, 6 Dec 2006 06:04:01 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <ej72s5$ita$1@smc.vnet.net>

In article <ej72s5$ita$1 at smc.vnet.net>,
 "Andrew Moylan" <andrew.j.moylan at gmail.com> wrote:

> I am trying to understand the way in which Mathematica automatically
> computes numerical approximations to derivatives which cannot be
> differentiated symbolically. Consider the following function:
> 
> f[(x_)?NumericQ] := (Sow[x];
>    1/(x - 1)^2)
> 
> By supplying a numerical argument to Derivative[f], we can see the
> points at which f is sampled by Mathematica when approximating the
> derivative:
> 
> Reap[f'[0.5]]
>   gives:
> {15.997945911907477,
>   {{0.5, 0.5526315789473684,
>     0.6052631578947368,
>     0.6578947368421053,
>     0.7105263157894737,
>     0.763157894736842,
>     0.8157894736842105,
>     0.868421052631579,
>     0.9210526315789473,
>     0.4473684210526316,
>     0.39473684210526316,
>     0.34210526315789475,
>     0.2894736842105263,
>     0.2368421052631579,
>     0.1842105263157895,
>     0.13157894736842107,
>     0.07894736842105265}}}
> 
> It's useful to see the points relative the central point (0.5):
> 
> %[[2]] - 0.5
>   gives:
> {{0., 0.05263157894736836,
>    0.10526315789473684,
>    0.1578947368421053,
>    0.21052631578947367,
>    0.26315789473684204,
>    0.3157894736842105,
>    0.368421052631579,
>    0.42105263157894735,
>    -0.05263157894736842,
>    -0.10526315789473684,
>    -0.15789473684210525,
>    -0.21052631578947367,
>    -0.2631578947368421,
>    -0.3157894736842105,
>    -0.3684210526315789,
>    -0.42105263157894735}}
> 
> Why does the number 0.05263157894736836 appear here? A little testing
> shows that this constant appears frequently when Mathematica
> automatically computes numerical approximations to derivatives.

Rationalize 0.05263157894736836 and you obtain 1/19 -- and so you may be 
able to work out what is happening here. If you multiply your list by 19 
the sampling pattern is clear.

Cheers,
Paul

_______________________________________________________________________
Paul Abbott                                      Phone:  61 8 6488 2734
School of Physics, M013                            Fax: +61 8 6488 1014
The University of Western Australia         (CRICOS Provider No 00126G)    
AUSTRALIA                               http://physics.uwa.edu.au/~paul


  • Prev by Date: Re: (revision) NIntegrate that upper limit is infinite
  • Next by Date: Re: Re: Run option
  • Previous by thread: Re: Relatively simple, but problematic, non-linear ODE
  • Next by thread: Re: Points sampled by N[Derivative[]]