RootFinding - Maple Programming Help

Home : Support : Online Help : Mathematics : Factorization and Solving Equations : Roots : RootFinding : RootFinding/NextZero

RootFinding

 NextZero
 find next zero of a function along the real line

 Calling Sequence NextZero(p,v) NextZero(p,v,options)

Parameters

 p - Maple function to find the zero of v - real start value for zero finding options - optional equations used to specify the behavior (see below)

Description

 • NextZero is a numerical root finder that can be used to find the next real zero of the input function to the right of a specified point up to the maximum distance past the specified point (default is $100$). It can be used to iterate through the zeros of a function along the positive axis direction.
 • The capabilities of NextZero are limited to finding zeros (and singularities) for functions that have local Laurent expansions, and as such it is unable to find zeros for pathological functions, such as exp(-1/x^2), and in fact for this example it may not even terminate.
 • There are several options available to control its behavior, and these are as follows:
 • signchange - NextZero can either locate or skip sign changes that are not zeros of a function (i.e. singularities or jump discontinuities). By default, signchange=false, and these are ignored. Passing the option signchange=true causes these to be reported instead.
 • initialDigits - NextZero uses several different computation phases. In the initial phase, lower precision is used to get a rough approximation of a zero, then in a later phase, the precision is increased to the requested precision. By default, the initial computation proceeds at 10 Digits. This can be set to a smaller value (though this is not recommended), but the option is generally provided for difficult function that do not evaluate well at 10 Digits.
 • guardDigits - Specifies the number of guard digits to use for the computation. Note that for this function to work properly, evalf must be able to compute the values of the function accurate within 0.6 ulp of the working precision. This is currently only true for atomic expressions (e.g. x, sin(x), tan(x)) but is generally false for compound expressions (e.g. x*sin(x), x+1). By default, guardDigits is set to 1. The value of guardDigits must be a non-negative integer.
 • maxdistance - Specifies the maximum distance to travel past the initial point when searching for a root. By default this is 100, meaning the search will continue up to initial point+100. In the event that no root is found up to that point, FAIL is returned.
 • abstol - Specifies the tightest resolution to use for the independent variable when finding a root. This is most useful for roots near zero, as a pure relative accuracy test will never complete. The default setting for this parameter is 1e-10/10^Digits (or 10 digits below the current setting of Digits).

Examples

 > $\mathrm{with}\left(\mathrm{RootFinding}\right):$
 > $\mathrm{r0}≔\mathrm{NextZero}\left(x→\mathrm{sin}\left(x\right),0\right)$
 ${\mathrm{r0}}{≔}{3.141592653}$ (1)
 > $\mathrm{r0}≔\mathrm{NextZero}\left(x→\mathrm{sin}\left(x\right),\mathrm{r0}\right)$
 ${\mathrm{r0}}{≔}{6.283185307}$ (2)

By default sign changes due to singularities are ignored (in this case, there is a singularity at $\frac{\mathrm{\pi }}{2}$ ~ 1.570796327)

 > $\mathrm{r1}≔\mathrm{NextZero}\left(x→\mathrm{tan}\left(x\right),0\right)$
 ${\mathrm{r1}}{≔}{3.141592653}$ (3)

Setting the option signchange to true changes this behavior

 > $\mathrm{r0}≔\mathrm{NextZero}\left(x→\mathrm{tan}\left(x\right),0,\mathrm{signchange}=\mathrm{true}\right)$
 ${\mathrm{r0}}{≔}{1.570796327}$ (4)
 > $\mathrm{r1}≔\mathrm{NextZero}\left(x→\mathrm{tan}\left(x\right),\mathrm{r0},\mathrm{signchange}=\mathrm{true}\right)$
 ${\mathrm{r1}}{≔}{3.141592653}$ (5)

An example with no root

 > $\mathrm{NextZero}\left(z→{ⅇ}^{z},0\right)$
 ${\mathrm{FAIL}}$ (6)

Examples with double roots

 > $\mathrm{NextZero}\left(z→{\left(z-0.999999\right)}^{2},0\right)$
 ${0.9999990000}$ (7)
 > $\mathrm{NextZero}\left(z→\mathrm{sin}\left(z\right)-1,0\right)$
 ${1.570796327}$ (8)

Example where abstol is relevant (root is near zero)

 > $\mathrm{Digits}≔50:$
 > $\mathrm{NextZero}\left(\mathrm{sin},-0.1\right)$
 ${1.4843057973051764659961741364226881509583208656000}{}{{10}}^{{-63}}$ (9)