gives a list of numerical values listing the zeros of a function on an interval.
sollya_obj_t sollya_lib_dirtyfindzeros(sollya_obj_t, sollya_obj_t)
- f is a function.
- I is an interval.
- dirtyfindzeros(f,I) returns a list containing some zeros of f in the
interval I. The values in the list are numerical approximation of the exact
zeros. The precision of these approximations is approximately the precision
stored in prec. If f does not have two zeros very close to each other, it
can be expected that all zeros are listed. However, some zeros may be
forgotten. This command should be considered as a numerical algorithm and
should not be used if safety is critical.
- More precisely, the algorithm relies on global variables prec and points and it performs the following steps:
let n be the value of variable points and t be the value
of variable prec.
- Evaluate |f| at n evenly distributed points in the interval I.
The working precision to be used is automatically chosen in order to ensure that the sign
- Whenever f changes its sign for two consecutive points,
find an approximation x of its zero with precision t using
Newton's algorithm. The number of steps in Newton's iteration depends on t:
the precision of the approximation is supposed to be doubled at each step.
- Add this value to the list.
- The user should be aware that the list returned by dirtyfindzeros may
contain a certain floating-point number twice. These repetitions
reflect the existence of different zeros of the function the value of
which rounds to the same floating-point number in the current working
precision. In this case, increasing the working precision will end up
making the two zeros distinguishable even in rounded floating-point
Go back to the list of commands
[|-3.1415926535897932384626433832795028841971693993751, 0, 3.1415926535897932384626433832795028841971693993751|]
> length(L1); length(L2);