0
$\begingroup$

I'm new to Mathematica and I'm trying to solve this set of trig equations (I'm not exactly sure if the syntax looks correct):

Solve[Tan[(delta + beta)/2] == nz*Tan[theta/2] && 
  ny*Tan[(delta - beta)/2] == nx && 
  Cos[(delta + beta)/2]*Cos[gamma/2] == Cos[theta/2], {delta, beta, 
  gamma}, Reals]

The goal is to solve for delta, beta and gamma. I want to substitute different values of nx,ny,nz,theta into these equations and get the solutions. How can I substitute those values in there? Thanks a lot for the help:)

$\endgroup$
3
  • $\begingroup$ Do you have conditions on the variables? If so maybe you can stick these into the system of equations and locate a possible general solution. Additionally, if you have all numerical inputs, then you should use NSolve. $\endgroup$ Mar 15, 2021 at 20:49
  • $\begingroup$ @CA Trevillian Thanks for the comment! Yeah I'm hoping to make all the variables range from [-pi,pi] i.e. principal values. Is there a way I can do that? $\endgroup$
    – ZR-
    Mar 15, 2021 at 20:53
  • 1
    $\begingroup$ So you will want a solution that is valid for this region? If you wish to go numeric route you’ll need to choose a level of discretization. Look up Assumptions If you want to stay analytical and NSolve with Table, if you want to use numerics. $\endgroup$ Mar 15, 2021 at 20:58

1 Answer 1

2
$\begingroup$

Assuming that you have nz, nx and ny reals, try this:

sol1 = Simplify[
   Solve[Tan[(delta + beta)/2] == nz*Tan[theta/2] /. 
      delta + beta -> x, x][[1, 1]], {C[1] == 0}] /. x -> delta + beta

(*  beta + delta -> 2 ArcTan[nz Tan[theta/2]]  *)

sol2 = Simplify[
   Solve[ny*Tan[(delta - beta)/2] == nx /. delta - beta -> y, y][[1, 
     1]], {C[1] == 0}] /. y -> delta - beta

(* -beta + delta -> 2 ArcTan[nx/ny]  *)

Simplify[Solve[Cos[(delta + beta)/2]*Cos[gamma/2] == Cos[theta/2], 
    gamma][[1, 1]], {C[1] == 0}] /. sol1

(*  gamma -> -2 ArcCos[Cos[theta/2] Sqrt[1 + nz^2 Tan[theta/2]^2]]  *)

And then

eq1 = Equal @@ sol1;
eq2 = Equal @@ sol2;
Solve[{eq1, eq2}, {beta, delta}]

(*  {{beta -> -ArcTan[nx/ny] + ArcTan[nz Tan[theta/2]], 
  delta -> ArcTan[nx/ny] + ArcTan[nz Tan[theta/2]]}}    *)

Have fun!

$\endgroup$
1
  • $\begingroup$ Thanks so much! That's really helpful:) $\endgroup$
    – ZR-
    Mar 17, 2021 at 2:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.