Help with shortening a system of equations solution

1 view (last 30 days)
So far I have the code set up within MATLAB like so
syms Theta_3 Theta_4;
R_ao = 5;
R_ab = 12;
R_bc = 7;
R_co = 10;
Theta_1 = pi/2;
Theta_2 = pi/4;
[Theta_3, Theta_4] = solve(R_co*cos(Theta_1) == R_ao*cos(Theta_2)+R_ab*cos(Theta_3)+R_bc*cos(Theta_4), R_co*sin(Theta_1) == R_ao*sin(Theta_2)+R_ab*sin(Theta_3)+R_bc*sin(Theta_4));
When run, I achieve the correct answer, but the result appears as
-2*atan((114759316181987158138113425551356319758961299166929149596820363195529233712137810943804461244051732922960669174913985297608867840*2^(1/2))/143316934033725901822548563286770464491298114669805440273574734126840866325382521080753780390001133137394133798114640622541863519 - (96723423155911916606927597999321100458525785399440723785041157556939880184035260667236225416054570045060776806527407637843083360474778016311144024514055948390509222852444701293560449880786149845236376680467806700418954247264172001607183662729264863796871932/20539743580827341692322780766473995968087280504359183345295595922774230560808563728196116910040099431552393563922933445199805462405726337900133738910648802224581007002279639188333333873684854049349791437674388299235667551152818843819016350008153709223063361 -(4260036957873145810673146852348941882383732375039006861861709373833692830675818955857324308163430481209069225048060752506639372878902375053424405972571062924887544489858760990007265573219844620935711703564175161040248753357317072758267977571161311417466880*2^(1/2))/20539743580827341692322780766473995968087280504359183345295595922774230560808563728196116910040099431552393563922933445199805462405726337900133738910648802224581007002279639188333333873684854049349791437674388299235667551152818843819016350008153709223063361)^(1/2)/2 - 18509567126126950343519846702266920911021845917566156199401798161777912719780762875903113797229995938738726513144055725408911360/143316934033725901822548563286770464491298114669805440273574734126840866325382521080753780390001133137394133798114640622541863519)
when it should simply be -pi, or -3.14etc. I've looked through the Mathworks Symbolic Help Center but nothing seems to work.

Answers (1)

Walter Roberson
Walter Roberson on 5 Feb 2014
Try using
Theta_1 = sym('pi')/2;
Theta_2 = sym('pi')/4;
  2 Comments
Christopher
Christopher on 5 Feb 2014
That made the outputs significantly shorter, but they're still multiple lines long.
Walter Roberson
Walter Roberson on 10 Feb 2014
-pi is not a solution to that pair of equations, not for Theta_3 or Theta_4
There are two solutions:
Theta_3 = arctan(((-2 * sqrt(2) - 1) * sqrt(9477 - 194 * sqrt(2)) - 1127 + 49 * sqrt(2)) / (315 * sqrt(2) + 133 - 7 * sqrt(9477 - 194 * sqrt(2)))),
Theta_4 = arctan(((-4 * sqrt(2) - 2) * sqrt(9477 - 194 * sqrt(2)) + 126 - 497 * sqrt(2)) / (35 * sqrt(2) + 266 - 14 * sqrt(9477 - 194 * sqrt(2)))) - pi
and
Theta_3 = arctan(((2 * sqrt(2) + 1) * sqrt(9477 - 194 * sqrt(2)) - 1127 + 49 * sqrt(2)) / (315 * sqrt(2) + 133 + 7 * sqrt(9477 - 194 * sqrt(2)))) + pi,
Theta_4 = arctan(((4 * sqrt(2) + 2) * sqrt(9477 - 194 * sqrt(2)) + 126 - 497 * sqrt(2)) / (35 * sqrt(2) + 266 + 14 * sqrt(9477 - 194 * sqrt(2))))

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!