1 | initial version |
First, be sure to define your variable using var('t')
.
To find a numerical solution, you can plot the function to help identify where the roots are.
plot(-2*sqrt(3)*sin(t)^2+2*cos(t)*sin(t)+sqrt(3),(t,-10,10))
For example, to get the first positive root, you can now use find_root
to find the root between 0 and 3.
find_root(-2*sqrt(3)*sin(t)^2+2*cos(t)*sin(t)+sqrt(3),-3,3)
which gives 2.6179938779914944.
2 | No.2 Revision |
First, be sure to define your variable using var('t')
.
To find a numerical solution, you can plot the function to help identify where the roots are.
plot(-2*sqrt(3)*sin(t)^2+2*cos(t)*sin(t)+sqrt(3),(t,-10,10))
For example, to get the first positive root, you can now use find_root
to find the root between 0 and 3.
find_root(-2*sqrt(3)*sin(t)^2+2*cos(t)*sin(t)+sqrt(3),-3,3)
which gives 2.6179938779914944.
For an analytic solution, you can do the following:
solve(-2*sqrt(3)*sin(x)^2+2*cos(x)*sin(x)+sqrt(3)==0, x,to_poly_solve ='force')
This gives: [x == 1/3*pi + pi*z1, x == -1/6*pi + pi*z2]
The z1
and z2
can be any integers.
(Interestingly, I could not get the solve to work with t as the variable. I'm not sure why.)