Module trigo

This module provides trigonometric multi precision functions. The expressions sin/3, cos/3, atan/3, exp/3 and log/3 are implemented by a range reduction and a Maclaurin respective Taylor series. The current implementation estimates the number of terms needed for the Maclaurin respective Taylor series and then applies a Horner schema.

Examples:
?- X is mp((1001/1000)**99, 30).
X = 0d1.10401168603473323514396127584

?- X is mp(4*acos(sqrt(1/2)), 30).
X = 0d3.14159265358979323846264338330

The expression atan2/4 is bootstrapped from the expression atan/3. Further the expressions asin/3 and acos/3 are then bootstrapped from the expression atan2/4. On the other hand the expression **/4 is bootstrapped from the expressions exp/3 and log/3. Speed and accuracy of the series and the bootstrapping is not yet optimized.

The following multi precision expressions are defined:
sin(X, P, Y) (multi):
The predicate succeeds in Y with sin(X) for precision P.
cos(X, P, Y) (multi):
The predicate succeeds in Y with cos(X) for precision P.
tan(X, P, Y) (multi):
The predicate succeeds in Y with tan(X) for precision P.
atan(X, P, Y) (multi):
The predicate succeeds in Y with atan(X) for precision P.
atan2(Y, X, P, Z) (multi):
The predicate succeeds in Z with atan2(Y,X) for precision P.
asin(X, P, Y) (multi):
The predicate succeeds in Y with asin(X) for precision P.
acos(X, P, Y) (multi):
The predicate succeeds in Y with acos(X) for precision P.
exp(X, P, Y) (multi):
The predicate succeeds in Y with exp(X) for precision P.
log(X, P, Y) (multi):
The predicate succeeds in Y with log(X) for precision P.
**(X, Y, P, Z) (multi):
The predicate succeeds in Z with X**Y for precision P.
pi(P, X) (multi):
The predicate succeeds in X with the circle number for precision P.
e(P, X) (multi):
The predicate succeeds in X with the Euler number for precision P.

Comments