________________________________________________________________________

This file is part of Logtalk <http://logtalk.org/>  

Logtalk is free software. You can redistribute it and/or modify it under
the terms of the FSF GNU General Public License 3  (plus some additional
terms per section 7).        Consult the `LICENSE.txt` file for details.
________________________________________________________________________


% start by loading the loading the example:

| ?- logtalk_load(functions(loader)).
...


% find the roots of some functions using each one of provided methods:

| ?- bisection::find_root(f1, 1.0, 2.3, 1.0e-15, Zero).

Zero = 2.0
yes

| ?- newton::find_root(f1, 1.0, 2.3, 1.0e-15, Zero).

Zero = 2.0
yes
| ?- muller::find_root(f1, 1.0, 2.3, 1.0e-15, Zero).

Zero = 2.0
yes

| ?- bisection::find_root(f2, 1.0, 1.3, 1.0e-15, Zero).

Zero = 1.25809265664599
yes

| ?- newton::find_root(f2, 1.0, 1.3, 1.0e-15, Zero).

Zero = 1.25809265664599
yes

| ?- muller::find_root(f2, 1.0, 1.3, 1.0e-15, Zero).

Zero = 1.25809265664599
yes

| ?- bisection::find_root(humps, -1.0, 2.0, 1.0e-15, Zero).

no

| ?- muller::find_root(humps, -1.0, 2.0, 1.0e-15, Zero).

Zero = 1.29954968258
yes

| ?- newton::find_root(humps, -1.0, 2.0, 1.0e-15, Zero).
ERROR: is/2: Arithmetic: evaluation error: `float_overflow'


% find the roots of some functions running all methods at once using multi-threading:

| ?- function_root::find_root(f1, 1.0, 2.3, 1.0e-15, Zero, Method).

Zero = 2.0
Method = bisection 
yes

| ?- function_root::find_root(f2, 1.0, 1.3, 1.0e-15, Zero, Method).

Zero = 1.25809265664599
Method = newton 
yes

| ?- function_root::find_root(f3, 0.0, 3.0, 1.0e-15, Zero, Method).

Zero = 1.4142135623731
Method = newton 
yes

| ?- function_root::find_root(f4, -1.0, 2.0, 1.0e-15, Zero, Method).

Zero = -8.88178419700125e-16
Method = bisection 
yes

| ?- function_root::find_root(humps, -1.0, 2.0, 1.0e-15, Zero, Method).

Zero = 1.29954968258482
Method = muller
yes
