F
F
FVoyager2017-11-27 23:31:16
Prolog
FVoyager, 2017-11-27 23:31:16

Prolog. Realization of expansion of geometric formulas?

The procedure should reveal the formulas for the sines and cosines of the sum

sin(A+B) = sin A cos B + cos A sin B,
cos(A+B) = cos A cos B – sin A sin B.
Пример работы
?- simplify(sin(x+cos(3+x)),X).
X = sin(x)*cos(cos(3)*cos(x)-sin(3)*sin(x))+
cos(x)*sin(cos(3)*cos(x)-sin(3)*sin(x))

The main question is how exactly to pass the expression, and the function in it, i.e., something like
func(expr), if func == sin ? sin(expr) : cos(expr)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question