I wrote a Prolog program to solve simple trigonometric equations. I wrote it to get the value of a trigonometric function. For example, I can obtain the value of sin(45), but I can't assign the value of sin(45) to the term sin(45). I tried the =,==,=:= operators, but they didn't work. Actually, I want to pass the value of sin(45) to the next codes of the program instead of the term sin(45).
Thanks...
arithmetic is carried on by some specialized builtins, like is/2, or (<)/2, that evaluate their right hand term as an expression, and unify the numeric value with their left hand side. The most common usage is assigning a value to a free variable, like in
?- X is sin(pi/2).
X = 1.0.
note the argument of sin/1 it's in radians. After the evaluation, you pass the variable, now bound to a numeric value, down to next code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With