Message Boards Message Boards

0
|
3565 Views
|
9 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Solve trigonometric equation system?

Posted 6 years ago

Hi to everyone, I'm new to this forum and Mathematica in general. I hope you could give me an hand solving this my little problem.

I have to solve a trigonometric equation system regarding the pointing of a satellite:

decz := 50 Degree
raz := 50 Degree

XY_sp[decx_, rax_, decy_, ray_] := Cos[decx]*Cos[rax]*Cos[decy]*Cos[ray] +Cos[decx]*Sin[rax]*Cos[decy]*Sin[ray] + Sin[decx]*Sin[decy]
XZ_sp[decx_, rax_, decy_, ray_] := Cos[decx]*Cos[rax]*Cos[decz]*Cos[raz] +Cos[decx]*Sin[rax]*Cos[decz]*Sin[raz] + Sin[decx]*Sin[decz]
YZ_sp[decx_, rax_, decy_, ray_] := Cos[decy]*Cos[ray]*Cos[decz]*Cos[raz] +Cos[decy]*Sin[ray]*Cos[decz]*Sin[raz] + Sin[decy]*Sin[decz]
norm_X[decx_,rax_] := (Cos[decx]*Cos[rax])^2 + (Cos[decx]*Sin[rax])^2 + Sin[decx]^2
norm_Y[decy_,ray_] := (Cos[decy]*Cos[ray])^2 + (Cos[decy]*Sin[ray])^2 + Sin[decy]^2

Solve[{XY_sp == 0, XZ_sp == 0,YZ_sp==0,norm_X==1,norm_Y==1}, {decx, decy, rax, ray}]

Yes, I know, the equations are overabundant; however I don't think this could produce any kind of problem. Try to solving the system, Mathematica says:

Out[45]= {}

How can I obtain a solution for this system ? My unknowns are decx, rax, decy, ray ! Maybe this is a stupid question, but as I said I'm new to the whole Wolfram ecosystem ! Thanks a lot for your time ! Have a create day

EDIT: I also tries in this way, but obtaining the same result:

decz = 50 Degree
raz = 50 Degree

 In[95]:= XY_sp[decx, rax, decy, ray] =Cos[decx]*Cos[rax]*Cos[decy]*Cos[ray] + Cos[decx]*Sin[rax]*Cos[decy]*Sin[ray] + Sin[decx]*Sin[decy]

Out[95]= Cos[decx] Cos[decy] Cos[rax] Cos[ray] + Sin[decx] Sin[decy] +Cos[decx] Cos[decy] Sin[rax] Sin[ray]

In[96]:= XZ_sp[decx, rax, decy, ray] = Cos[decx]*Cos[rax]*Cos[decz]*Cos[raz] + Cos[decx]*Sin[rax]*Cos[decz]*Sin[raz] + Sin[decx]*Sin[decz]

Out[96]= Cos[40 \[Degree]] Sin[decx] +Cos[decx] Cos[rax] Sin[40 \[Degree]]^2 + Cos[decx] Cos[40 \[Degree]] Sin[40 \[Degree]] Sin[rax]

In[97]:= YZ_sp[decx, rax, decy, ray] = Cos[decy]*Cos[ray]*Cos[decz]*Cos[raz] + Cos[decy]*Sin[ray]*Cos[decz]*Sin[raz] + Sin[decy]*Sin[decz]

Out[97]= Cos[40 \[Degree]] Sin[decy] +Cos[decy] Cos[ray] Sin[40 \[Degree]]^2 + Cos[decy] Cos[40 \[Degree]] Sin[40 \[Degree]] Sin[ray]

In[98]:= norm_X[decx, rax] = (Cos[decx]*Cos[rax])^2 + (Cos[decx]*Sin[rax])^2 + Sin[decx]^2

Out[98]= Cos[decx]^2 Cos[rax]^2 + Sin[decx]^2 + Cos[decx]^2 Sin[rax]^2

In[99]:= norm_Y[decy,ray] = (Cos[decy]*Cos[ray])^2 + (Cos[decy]*Sin[ray])^2 + Sin[decy]^2

Out[99]= Cos[decy]^2 Cos[ray]^2 + Sin[decy]^2 + Cos[decy]^2 Sin[ray]^2

In[100]:= Solve[{XY_sp == 0, XZ_sp == 0, norm_X == 1, norm_Y == 1}, {decx, decy, rax, ray}]

Out[100]= {}

Thanks again, Regards Enrico

POSTED BY: Enrico Catanzani
9 Replies

I'm going to study your fantastic response. Thanks a lot ! Your help has been really precious.

In case of any doubt I'll let you know. Thanks again. Have a great day

Best Regards Enrico

POSTED BY: Enrico Catanzani
POSTED BY: Daniel Lichtblau

Ok, I got it. The strange thing is that both using "Solve" and "NSolve" Mathematica says to be running but, after hours, ho results has been communicated.

NSolve[{XYip[decx, rax, decy, ray] == 0, XZip[decx, rax] == 0, YZip[decy, ray] == 0, uXn[decx, rax] == 1, uYn[decy, ray] == 1}, {decx, decy, rax, ray}]

Solve[{XYip[decx, rax, decy, ray] == 0, XZip[decx, rax] == 0, YZip[decy, ray] == 0, uXn[decx, rax] == 1, uYn[decy, ray] == 1}, {decx, decy, rax, ray}]

Should I use some particular function or option ?

Thanks a lot for your particularly precious help. Have a great day, thanks again

Best Regards Enrico

POSTED BY: Enrico Catanzani

For some reason my post was corrupted. I wrote that you don’t need to change anything but be aware if you try to use the definitions in other ways.

POSTED BY: Neil Singer
POSTED BY: Neil Singer

mmmm... I see. I just need to solve the system, analytically or not. Should you think I need to change my function definitions ?

POSTED BY: Enrico Catanzani
POSTED BY: Neil Singer

Thanks a lot for your precious reply. I immediately followed your instructions and I realised that code:

In[159]:= decz := 50 Degree
In[160]:= raz := 50 Degree

In[161]:= XYip[decx, rax, decy, ray] := Cos[decx]*Cos[rax]*Cos[decy]*Cos[ray] + Cos[decx]*Sin[rax]*Cos[decy]*Sin[ray] + Sin[decx]*Sin[decy]

In[162]:= XZip[decx, rax] := Cos[decx]*Cos[rax]*Cos[decz]*Cos[raz] + Cos[decx]*Sin[rax]*Cos[decz]*Sin[raz] + Sin[decx]*Sin[decz]

In[163]:= YZip[decy, ray] :=Cos[decy]*Cos[ray]*Cos[decz]*Cos[raz] + Cos[decy]*Sin[ray]*Cos[decz]*Sin[raz] + Sin[decy]*Sin[decz]

In[164]:= uXn[decx, rax] := (Cos[decx]*Cos[rax])^2 + (Cos[decx]*Sin[rax])^2 + Sin[decx]^2

In[165]:= uYn[decy, ray] := (Cos[decy]*Cos[ray])^2 + (Cos[decy]*Sin[ray])^2 + Sin[decy]^2

In[166]:= Solve[{XYip[decx, rax, decy, ray] == 0, XZip[decx, rax] == 0, YZip[decy, ray] == 0, uXn[decx, rax] == 1, uYn[decy, ray] == 1}, {decx, decy, rax, ray}]

I'm waiting for an analytical solution. I'm studying, however, how to obtain a numerical one, usually interesting. I'll post some updates ;-)

Thanks a lot again, Regards

Enrico

POSTED BY: Enrico Catanzani

Enrico,

You can't use underscores in function names, i.e. XY_sp is illegal (it is triggering a pattern match operation). You also must provide the arguments to functions when you use them. For example: XYsp[x,y,z] -- you can't use XYsp == 0. You will also likely have trouble getting a closed form solution of trigonometric equations like that. Numerical solutions should work well.

Regards,

Neil

POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract