## How to calculate sin(%pi/12); document.SUBSCRIPTION_OPTIONS = { "thing": "thread", "subscribed": false, "url": "subscribe", "icon": { "css": "fa fa-envelope-o" } };

2014-03-10
2014-03-18
• daviodan daviodan - 2014-03-10

Hi,
Could you tell me how I can calculate sin(%pi/12) using wxmaxima, please?

• Joseph Cusumano - 2014-03-11

float(sin(%pi/12));

goin' mobile

On Mar 10, 2014, at 11:59 AM, "daviodan daviodan" daviodan@users.sf.net wrote:

Hi,
Could you tell me how I can calculate sin(%pi/12) using wxmaxima, please?

How to calculate sin(%pi/12);

Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/wxmaxima/discussion/435775/

To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

• daviodan daviodan - 2014-03-11

I want to calculate cos (%pi/12) or sin(%pi/12). The result is:cos (%pi/12)= (sqrt(6)+sqrt(2))/4 or sqrt(sqrt(3)+2)/2. Maxima does not show any of
these results. I know that the result can be used float to approximate .
https://www.wolframalpha.com/input/?i=cos(pi%2F12)

• Joseph Cusumano - 2014-03-11

daviodan daviodan wrote the following on 3/11/2014 8:56 AM:

I want to calculate cos (%pi/12) or sin(%pi/12). The result is:cos
(%pi/12)= (sqrt(6)+sqrt(2))/4 or sqrt(sqrt(3)+2)/2. Maxima does not
show any of
these results. I know that the result can be used float to approximate .
https://www.wolframalpha.com/input/?i=cos(pi%2F12)

Maxima automatically simplifies sin(%pi/n) and cos(%pi/n) when
n=1,2,3,4,6. Otherwise, it doesn't automatically know what to do (see
%piargs), and you have to do some manipulation with trig identities.

This will work in your case, however:

(%i1) halfangles:true\$
cos(x/2)\$
rootscontract(subst(x=%pi/6,%));

sqrt(3) + 2

(%o3) sqrt(-----------)
4

Hope that helps.

• daviodan daviodan - 2014-03-11

• Albrecht Mueller - 2014-03-10

I guess you want to tell wxmaxima to do numerical instead of symbolic calculations. There is a menu entry that toggles the numerical flag. Another way to control this behaviour is to set the flag using the assignment statements "numer:true" or "numer:false".

Last edit: Albrecht Mueller 2014-03-10
• Aleksas - 2014-03-18

(%i1) x=sin(%pi/12);
(%o1) x=sin(%pi/12)
(%i2) asin(%);
(%o2) asin(x)=%pi/12
(%i3) %12;
(%o3) 12
asin(x)=%pi
(%i4) sin(%);
(%o4) sin(12asin(x))=0
(%i5) trigexpand(%);
(%o5) 12
x(1-x^2)^(11/2)-220x^3(1-x^2)^(9/2)+792x^5(1-x^2)^(7/2)-792x^7(1-x^2)^(5/2)+220x^9(1-x^2)^(3/2)-12x^11*sqrt(1-x^2)=0
(%i6) spr:solve(%,x);
(%o6) [x=-sqrt(3)/2,x=sqrt(3)/2,x=-sqrt(sqrt(3)+2)/2,x=sqrt(sqrt(3)+2)/2,x=-sqrt(2-sqrt(3))/2,x=sqrt(2-sqrt(3))/2,x=-1/2,x=1/2,x=-1/sqrt(2),x=1/sqrt(2),x=-1,x=1,x=0]
(%i7) ats:sublist(spr,lambda([e],is(abs(rhs(e)-sin(%pi/12))<10^(-10))));
Solution:
(%o7) [x=sqrt(2-sqrt(3))/2]
(%i8) float(%), numer;
(%o8) [x=0.25881904510252]

With my package "trigtools":
(%o9) "C:/Users/Aleksas/maxima/trigtools.mac"
(%i10) trigeval(sin(%pi/12));
(%o10) (sqrt(3)-1)/2^(3/2)
(%i11) float(%), numer;
(%o11) 0.25881904510252

Other examples of trigeval:

(%i4) sin(%pi/120);
(%o4) sin(%pi/120)
(%i5) trigeval(%),rootscontract,ratsimp;
(%o5) sqrt(4-sqrt(2sqrt(sqrt(6sqrt(5)+30)+sqrt(5)+7)+8))/2^(3/2)
(%i6) float(%), numer;
(%o6) 0.026176948307872
(%i11) float(sin(%pi/120));
(%o11) 0.026176948307873
(%i12) sin(%pi/128);
(%o12) sin(%pi/128)
(%i13) trigeval(%);
(%o13) sqrt(2-sqrt(sqrt(sqrt(sqrt(sqrt(2)+2)+2)+2)+2))/2
(%i14) cos(%pi/128);
(%o14) cos(%pi/128)
(%i15) trigeval(%);
(%o15) sqrt(sqrt(sqrt(sqrt(sqrt(sqrt(2)+2)+2)+2)+2)+2)/2

best

Aleksas D