From: adel tekari on
Dear Matlab users

I'm trying to solve the following equation:

t=(0:pi/30:2*pi);
A=solve('4*sin(t)=tan(pi/30)*6*cos(t)-tan(pi/30)*4/3','t');

I just need the numerical (explicit) values of A. I want to see the t=0.1218 and t=-2.9506
Thanks
From: Walter Roberson on
adel tekari wrote:

> I'm trying to solve the following equation:
>
> t=(0:pi/30:2*pi);
> A=solve('4*sin(t)=tan(pi/30)*6*cos(t)-tan(pi/30)*4/3','t');
>
> I just need the numerical (explicit) values of A. I want to see the
> t=0.1218 and t=-2.9506

You won't be able to. t=-2.9506 is outside the range 0 to 2*pi that you
assign on the first line. The second value will be -2.9506 + 2*pi .

I don't know about Matlab's current symbolic engine (MuPad), but Maple
solves it fairly directly. Just skip the assignment to t.

Maple>> solve(4*sin(t)=tan(Pi/30)*6*cos(t)-tan(Pi/30)*4/3);

arctan((-8/3*sin(1/30*Pi)^2*cos(1/30*Pi) -
16/3*sin(1/30*Pi)^3*cos(1/30*Pi) + 1/3*(36*sin(1/30*Pi)^2*cos(1/30*Pi) +
72*sin(1/30*Pi)^3*cos(1/30*Pi)) * (6010/464881 +
46080/464881*sin(1/30*Pi)^3 + 99968/464881*sin(1/30*Pi)^2 -
44480/464881*sin(1/30*Pi) + 2/1394643*(456652987231 -
246369098880*sin(1/30*Pi)^3 - 486622810000*sin(1/30*Pi)^2 +
218499799000*sin(1/30*Pi) + 4777574400*sin(1/30*Pi)^6 +
20729364480*sin(1/30*Pi)^5 + 13262229504*sin(1/30*Pi)^4)^(1/2))) /
(6010/464881 + 46080/464881*sin(1/30*Pi)^3 + 99968/464881*sin(1/30*Pi)^2
- 44480/464881*sin(1/30*Pi) + 2/1394643*(456652987231 -
246369098880*sin(1/30*Pi)^3 - 486622810000*sin(1/30*Pi)^2 +
218499799000*sin(1/30*Pi) + 4777574400*sin(1/30*Pi)^6 +
20729364480*sin(1/30*Pi)^5 + 13262229504*sin(1/30*Pi)^4)^(1/2))),

arctan((-8/3*sin(1/30*Pi)^2*cos(1/30*Pi) -
16/3*sin(1/30*Pi)^3*cos(1/30*Pi) + 1/3*(36*sin(1/30*Pi)^2*cos(1/30*Pi) +
72*sin(1/30*Pi)^3*cos(1/30*Pi)) * (6010/464881 +
46080/464881*sin(1/30*Pi)^3 + 99968/464881*sin(1/30*Pi)^2 -
44480/464881*sin(1/30*Pi) - 2/1394643*(456652987231 -
246369098880*sin(1/30*Pi)^3 - 486622810000*sin(1/30*Pi)^2 +
218499799000*sin(1/30*Pi) + 4777574400*sin(1/30*Pi)^6 +
20729364480*sin(1/30*Pi)^5 + 13262229504*sin(1/30*Pi)^4)^(1/2))) /
(6010/464881 + 46080/464881*sin(1/30*Pi)^3 + 99968/464881*sin(1/30*Pi)^2
- 44480/464881*sin(1/30*Pi) - 2/1394643*(456652987231 -
246369098880*sin(1/30*Pi)^3 - 486622810000*sin(1/30*Pi)^2 +
218499799000*sin(1/30*Pi) + 4777574400*sin(1/30*Pi)^6 +
20729364480*sin(1/30*Pi)^5 + 13262229504*sin(1/30*Pi)^4)^(1/2))) - Pi
From: adel tekari on
Hi
Thank you for your answer.

> You won't be able to. t=-2.9506 is outside the range 0 to 2*pi that you
> assign on the first line. The second value will be -2.9506 + 2*pi .

Actually, what I'm trying to do is to determine the intersction between an ellipse (x=6cos(t), y=4sin(t)) and a line y=mx+p (m=tan(angle), p=yc-tan(angle)*xc; angle=pi/30 , xc=4/3 and yc=0).

> I don't know about Matlab's current symbolic engine (MuPad), but Maple
> solves it fairly directly. Just skip the assignment to t.
>
> Maple>> solve(4*sin(t)=tan(Pi/30)*6*cos(t)-tan(Pi/30)*4/3);
>
> arctan((-8/3*sin(1/30*Pi)^2*cos(1/30*Pi) -
> 16/3*sin(1/30*Pi)^3*cos(1/30*Pi) + 1/3*(36*sin(1/30*Pi)^2*cos(1/30*Pi) +
> 72*sin(1/30*Pi)^3*cos(1/30*Pi)) * (6010/464881 +
> 46080/464881*sin(1/30*Pi)^3 + 99968/464881*sin(1/30*Pi)^2 -
> 44480/464881*sin(1/30*Pi) + 2/1394643*(456652987231 -
> 246369098880*sin(1/30*Pi)^3 - 486622810000*sin(1/30*Pi)^2 +
> 218499799000*sin(1/30*Pi) + 4777574400*sin(1/30*Pi)^6 +
> 20729364480*sin(1/30*Pi)^5 + 13262229504*sin(1/30*Pi)^4)^(1/2))) /
> (6010/464881 + 46080/464881*sin(1/30*Pi)^3 + 99968/464881*sin(1/30*Pi)^2
> - 44480/464881*sin(1/30*Pi) + 2/1394643*(456652987231 -
> 246369098880*sin(1/30*Pi)^3 - 486622810000*sin(1/30*Pi)^2 +
> 218499799000*sin(1/30*Pi) + 4777574400*sin(1/30*Pi)^6 +
> 20729364480*sin(1/30*Pi)^5 + 13262229504*sin(1/30*Pi)^4)^(1/2))),
>
> arctan((-8/3*sin(1/30*Pi)^2*cos(1/30*Pi) -
> 16/3*sin(1/30*Pi)^3*cos(1/30*Pi) + 1/3*(36*sin(1/30*Pi)^2*cos(1/30*Pi) +
> 72*sin(1/30*Pi)^3*cos(1/30*Pi)) * (6010/464881 +
> 46080/464881*sin(1/30*Pi)^3 + 99968/464881*sin(1/30*Pi)^2 -
> 44480/464881*sin(1/30*Pi) - 2/1394643*(456652987231 -
> 246369098880*sin(1/30*Pi)^3 - 486622810000*sin(1/30*Pi)^2 +
> 218499799000*sin(1/30*Pi) + 4777574400*sin(1/30*Pi)^6 +
> 20729364480*sin(1/30*Pi)^5 + 13262229504*sin(1/30*Pi)^4)^(1/2))) /
> (6010/464881 + 46080/464881*sin(1/30*Pi)^3 + 99968/464881*sin(1/30*Pi)^2
> - 44480/464881*sin(1/30*Pi) - 2/1394643*(456652987231 -
> 246369098880*sin(1/30*Pi)^3 - 486622810000*sin(1/30*Pi)^2 +
> 218499799000*sin(1/30*Pi) + 4777574400*sin(1/30*Pi)^6 +
> 20729364480*sin(1/30*Pi)^5 + 13262229504*sin(1/30*Pi)^4)^(1/2))) - Pi

With Matlab, I'm able to get the same thing. But I want the values and not the numeric equations !
atan((192320/1394643*sin(1/30*pi)^3*cos(1/30*pi)-130752/464881*sin(1/30*pi)*cos(1/30*pi)-3200/1394643*cos(1/30*pi)-4000/1394643*cos(1/30*pi)^3+1/1394643*(36986982400*sin(1/30*pi)^6*cos(1/30*pi)^2-150877347840*sin(1/30*pi)^4*cos(1/30*pi)^2-1230848000*sin(1/30*pi)^3*cos(1/30*pi)^2-1538560000*sin(1/30*pi)^3*cos(1/30*pi)^4+153864769536*sin(1/30*pi)^2*cos(1/30*pi)^2+2510438400*sin(1/30*pi)*cos(1/30*pi)^2+3138048000*sin(1/30*pi)*cos(1/30*pi)^4+10240000*cos(1/30*pi)^2+25600000*cos(1/30*pi)^4+16000000*cos(1/30*pi)^6+824736084480*sin(1/30*pi)^3+107566490185-796099414880*sin(1/30*pi)+1789219116608*sin(1/30*pi)^2)^(1/2))/(2/9+(16/3*cos(1/30*pi)-32/3*sin(1/30*pi)^3*cos(1/30*pi)-16/3*sin(1/30*pi)^2*cos(1/30*pi)+32/3*sin(1/30*pi)*cos(1/30*pi))*(192320/1394643*sin(1/30*pi)^3*cos(1/30*pi)-130752/464881*sin(1/30*pi)*cos(1/30*pi)-3200/1394643*cos(1/30*pi)-4000/1394643*cos(1/30*pi)^3+1/1394643*(36986982400
*sin(1/30*pi)^6*cos(1/30*pi)^2-150877347840*sin(1/30*pi)^4*cos(1/30*pi)^2-1230848000*sin(1/30*pi)^3*cos(1/30*pi)^2-1538560000*sin(1/30*pi)^3*cos(1/30*pi)^4+153864769536*sin(1/30*pi)^2*cos(1/30*pi)^2+2510438400*sin(1/30*pi)*cos(1/30*pi)^2+3138048000*sin(1/30*pi)*cos(1/30*pi)^4+10240000*cos(1/30*pi)^2+25600000*cos(1/30*pi)^4+16000000*cos(1/30*pi)^6+824736084480*sin(1/30*pi)^3+107566490185-796099414880*sin(1/30*pi)+1789219116608*sin(1/30*pi)^2)^(1/2))))

atan((192320/1394643*sin(1/30*pi)^3*cos(1/30*pi)-130752/464881*sin(1/30*pi)*cos(1/30*pi)-3200/1394643*cos(1/30*pi)-4000/1394643*cos(1/30*pi)^3-1/1394643*(36986982400*sin(1/30*pi)^6*cos(1/30*pi)^2-150877347840*sin(1/30*pi)^4*cos(1/30*pi)^2-1230848000*sin(1/30*pi)^3*cos(1/30*pi)^2-1538560000*sin(1/30*pi)^3*cos(1/30*pi)^4+153864769536*sin(1/30*pi)^2*cos(1/30*pi)^2+2510438400*sin(1/30*pi)*cos(1/30*pi)^2+3138048000*sin(1/30*pi)*cos(1/30*pi)^4+10240000*cos(1/30*pi)^2+25600000*cos(1/30*pi)^4+16000000*cos(1/30*pi)^6+824736084480*sin(1/30*pi)^3+107566490185-796099414880*sin(1/30*pi)+1789219116608*sin(1/30*pi)^2)^(1/2))/(2/9+(16/3*cos(1/30*pi)-32/3*sin(1/30*pi)^3*cos(1/30*pi)-16/3*sin(1/30*pi)^2*cos(1/30*pi)+32/3*sin(1/30*pi)*cos(1/30*pi))*(192320/1394643*sin(1/30*pi)^3*cos(1/30*pi)-130752/464881*sin(1/30*pi)*cos(1/30*pi)-3200/1394643*cos(1/30*pi)-4000/1394643*cos(1/30*pi)^3-1/1394643*(36986982400
*sin(1/30*pi)^6*cos(1/30*pi)^2-150877347840*sin(1/30*pi)^4*cos(1/30*pi)^2-1230848000*sin(1/30*pi)^3*cos(1/30*pi)^2-1538560000*sin(1/30*pi)^3*cos(1/30*pi)^4+153864769536*sin(1/30*pi)^2*cos(1/30*pi)^2+2510438400*sin(1/30*pi)*cos(1/30*pi)^2+3138048000*sin(1/30*pi)*cos(1/30*pi)^4+10240000*cos(1/30*pi)^2+25600000*cos(1/30*pi)^4+16000000*cos(1/30*pi)^6+824736084480*sin(1/30*pi)^3+107566490185-796099414880*sin(1/30*pi)+1789219116608*sin(1/30*pi)^2)^(1/2))))-pi

Any help?
From: Matt Fig on
For numeric values, you could also use FZERO.

f = @(t) 4*sin(t)-tan(pi/30)*6*cos(t)+tan(pi/30)*4/3;
fzero(f,.1218) % See the help for FZERO.
From: Walter Roberson on
adel tekari wrote:

> With Matlab, I'm able to get the same thing. But I want the values and
> not the numeric equations !
> atan((192320/1394643*sin(1/30*pi)^3*cos(1/30*pi)-130752/464881*sin(1/30*pi)*cos(1/30*pi)-3200/1394643*cos(1/30*pi)-4000/1394643*cos(1/30*pi)^3+1/1394643*(36986982400*sin(1/30*pi)^6*cos(1/30*pi)^2-150877347840*sin(1/30*pi)^4*cos(1/30*pi)^2-1230848000*sin(1/30*pi)^3*cos(1/30*pi)^2-1538560000*sin(1/30*pi)^3*cos(1/30*pi)^4+153864769536*sin(1/30*pi)^2*cos(1/30*pi)^2+2510438400*sin(1/30*pi)*cos(1/30*pi)^2+3138048000*sin(1/30*pi)*cos(1/30*pi)^4+10240000*cos(1/30*pi)^2+25600000*cos(1/30*pi)^4+16000000*cos(1/30*pi)^6+824736084480*sin(1/30*pi)^3+107566490185-796099414880*sin(1/30*pi)+1789219116608*sin(1/30*pi)^2)^(1/2))/(2/9+(16/3*cos(1/30*pi)-32/3*sin(1/30*pi)^3*cos(1/30*pi)-16/3*sin(1/30*pi)^2*cos(1/30*pi)+32/3*sin(1/30*pi)*cos(1/30*pi))*(192320/1394643*sin(1/30*pi)^3*cos(1/30*pi)-130752/464881*sin(1/30*pi)*cos(1/30*pi)-3200/1394643*cos(1/30*pi)-4000/1394643*cos(1/30*pi)^3+1/1394643*(36986982400
> *sin(1/30*pi)^6*cos(1/30*pi)^2-150877347840*sin(1/30*pi)^4*cos(1/30*pi)^2-1230848000*sin(1/30*pi)^3*cos(1/30*pi)^2-1538560000*sin(1/30*pi)^3*cos(1/30*pi)^4+153864769536*sin(1/30*pi)^2*cos(1/30*pi)^2+2510438400*sin(1/30*pi)*cos(1/30*pi)^2+3138048000*sin(1/30*pi)*cos(1/30*pi)^4+10240000*cos(1/30*pi)^2+25600000*cos(1/30*pi)^4+16000000*cos(1/30*pi)^6+824736084480*sin(1/30*pi)^3+107566490185-796099414880*sin(1/30*pi)+1789219116608*sin(1/30*pi)^2)^(1/2))))
>
> atan((192320/1394643*sin(1/30*pi)^3*cos(1/30*pi)-130752/464881*sin(1/30*pi)*cos(1/30*pi)-3200/1394643*cos(1/30*pi)-4000/1394643*cos(1/30*pi)^3-1/1394643*(36986982400*sin(1/30*pi)^6*cos(1/30*pi)^2-150877347840*sin(1/30*pi)^4*cos(1/30*pi)^2-1230848000*sin(1/30*pi)^3*cos(1/30*pi)^2-1538560000*sin(1/30*pi)^3*cos(1/30*pi)^4+153864769536*sin(1/30*pi)^2*cos(1/30*pi)^2+2510438400*sin(1/30*pi)*cos(1/30*pi)^2+3138048000*sin(1/30*pi)*cos(1/30*pi)^4+10240000*cos(1/30*pi)^2+25600000*cos(1/30*pi)^4+16000000*cos(1/30*pi)^6+824736084480*sin(1/30*pi)^3+107566490185-796099414880*sin(1/30*pi)+1789219116608*sin(1/30*pi)^2)^(1/2))/(2/9+(16/3*cos(1/30*pi)-32/3*sin(1/30*pi)^3*cos(1/30*pi)-16/3*sin(1/30*pi)^2*cos(1/30*pi)+32/3*sin(1/30*pi)*cos(1/30*pi))*(192320/1394643*sin(1/30*pi)^3*cos(1/30*pi)-130752/464881*sin(1/30*pi)*cos(1/30*pi)-3200/1394643*cos(1/30*pi)-4000/1394643*cos(1/30*pi)^3-1/1394643*(36986982400
> *sin(1/30*pi)^6*cos(1/30*pi)^2-150877347840*sin(1/30*pi)^4*cos(1/30*pi)^2-1230848000*sin(1/30*pi)^3*cos(1/30*pi)^2-1538560000*sin(1/30*pi)^3*cos(1/30*pi)^4+153864769536*sin(1/30*pi)^2*cos(1/30*pi)^2+2510438400*sin(1/30*pi)*cos(1/30*pi)^2+3138048000*sin(1/30*pi)*cos(1/30*pi)^4+10240000*cos(1/30*pi)^2+25600000*cos(1/30*pi)^4+16000000*cos(1/30*pi)^6+824736084480*sin(1/30*pi)^3+107566490185-796099414880*sin(1/30*pi)+1789219116608*sin(1/30*pi)^2)^(1/2))))-pi

Call double() passing in the symbolic expression to be evaluated.