Fix bug #3379: recur.mac correct bug in varc2
[maxima.git] / share / trigonometry / ntrig.mac
blob62695c7bb54477589476442e551daaae1d9ce83a
1 eval_when([translate,batch,demo,load,loadfile],
2 matchdeclare(n,integerp))$
4 tellsimpafter(sin(n*%pi/10),usin(n))$
5 tellsimpafter(cos(n*%pi/10),ucos(n))$
6 tellsimpafter(tan(n*%pi/10),usin(n)/ucos(n))$
7 tellsimpafter(cot(n*%pi/10),ucos(n)/usin(n))$
8 tellsimpafter(sec(n*%pi/10),1/ucos(n))$
9 tellsimpafter(csc(n*%pi/10),1/usin(n))$
11 usin(n):= block([yuk:remainder(remainder(n,10)+10,10),
12                  sgn:if remainder(remainder(n,20)+20,20)>=10 then -1 else 1],
13 if yuk=1 or yuk=9 then sgn*(sqrt(5)-1)/4 else
14 if yuk=2 or yuk=8 then sgn*(sqrt(5)-1)*sqrt(sqrt(5)+5)/(4*sqrt(2)) else
15 if yuk=3 or yuk=7 then sgn*(sqrt(5)+1)/4 else
16 if yuk=4 or yuk=6 then sgn*sqrt(sqrt(5)+5)/(2*sqrt(2)))$
18 ucos(n):= block([yuk:remainder(remainder(n,10)+10,10),
19                  sgn:if remainder(remainder(n,20)+20,20)>5 and
20                         remainder(remainder(n,20)+20,20)<15 then -1 else 1],
21 if yuk=1 or yuk=9 then sgn*sqrt(sqrt(5)+5)/(2*sqrt(2)) else
22 if yuk=2 or yuk=8 then sgn*(sqrt(5)+1)/4 else
23 if yuk=3 or yuk=7 then sgn*(sqrt(5)-1)*sqrt(sqrt(5)+5)/(4*sqrt(2)) else
24 if yuk=4 or yuk=6 then sgn*(sqrt(5)-1)/4)$