0

I'm new to eclipse CLP and I want to implement a predicate that gets all the angles equivalent to a specific sinusoidal function, something like

:- lib(ic).
solve(L) :-
L = [X,Y,Z],
L::[-180..180],
cos(X) #= sin(Y) + sin(Z),
labeling(L).

I know that this scheme probably works for integral values of the variables; so I need an alternative solution that also uses CLP.

false
  • 10,264
  • 13
  • 101
  • 209
Poka Yoke
  • 373
  • 3
  • 8
  • 27

2 Answers2

1

Ok I figured it out,

:-lib(ic).
solve(V):-
V = [X,Y,Z],
V::[0 .. 180],
cos(X*pi/180) $= sin(Y*pi/180) + sin(Z*pi/180),
labeling(V).

N.B: the cos and sin predicates work with radians

Poka Yoke
  • 373
  • 3
  • 8
  • 27
0

Trigonometric function arguments are in radians.

Use the formula Rad = Degree * pi / 180 to convert.

fferri
  • 18,285
  • 5
  • 46
  • 95