Prolog Operators

Prolog Lists

Built-In Predicates

Miscellaneous

Prolog - Scientific Predicates



Following are the scientific predicates −

Predicates Description
sin(X). Sine of X where X is in radians.
cos(X). Cosine of X where X is in radians.
tan(X). Tangent of X where X is in radians.
asin(X). Arcsine of X where X is in radians.
acos(X). Arccosine of X where X is in radians.
atan(X) Arctangent of X where X is in radians.
sinh(X) Hyperbolic Sine of X where X is in radians.
cosh(X). Hyperbolic Cosine of X where X is in radians.
tanh(X) Hyperbolic Tangent of X where X is in radians.
asinh(X). Hyperbolic Arcsine of X where X is in radians.
acosh(X) Hyperbolic Arccosine of X where X is in radians.
atanh(X) Hyperbolic Arctangent of X where X is in radians.
log(X) Log of X
log10(X) Log10 of X
exp(X) Exponential of X

Now let us see some of these functions in action using Prolog programs.

Example

| ?- X is sin(0)
.

X = 0.0

yes
| ?- X is sin(1).

X = 0.8414709848078965

yes
| ?- X is cos(0).

X = 1.0

yes
| ?- X is cos(1).

X = 0.54030230586813977

yes
| ?- X is tan(0).

X = 0.0

yes
| ?- X is tan(1).

X = 1.5574077246549023

yes
| ?- 

Example

| ?- X is asin(1).

X = 1.5707963267948966

yes
| ?- X is sinh(1).

X = 1.1752011936438014

yes
| ?- X is asinh(1).

X = 0.88137358701954305

yes
| ?- 

Example

| ?- X is log(10).

X = 2.3025850929940459

yes
| ?- X is log10(10).

X = 1.0

yes
| ?- X is exp(2).

X = 7.3890560989306504

yes
| ?-
Advertisements