Message Boards Message Boards

[✓] Transfer a Conditional Expression output to numerical output?

GROUPS:

hi I tried to solve it with solve and reduce functions and plot the output as a function of theta2 >>but it give me a Conditional Expression output and i cant turn it to numerical answer or a useful expression ....can anyone help me??

r1 = 100;
r2 = 30;
r3 = 70;
r4 = 90;
Theta2 = 60;
a = -r1  + r2 Cos[Theta2 ] + r3 Cos[Theta3] +  r4 Cos[Theta4] ;
b = r2 Sin[Theta2] + r3 Sin[Theta3 ] + r4 Sin[Theta4] ;
Solve[{a == 0 ,b == 0} , {Theta3, Theta4}]
Attachments:
POSTED BY: Ahmed Khodari
Answer
21 days ago

Assuming you want numerical approximations of the two solutions expressed in degrees

r1 = 100; r2 = 30; r3 = 70; r4 = 90; ϑ1 = 0; ϑ2 = 60;
a = -r1  + r2 Cos[ϑ2 ] + r3 Cos[ϑ3] + r4 Cos[ϑ4];
b = r2 Sin[ϑ2] + r3 Sin[ϑ3 ] + r4 Sin[ϑ4];
Map[{ϑ3, ϑ4}/.#&, {ToRules[N[Reduce[{a==0 && b==0} , {ϑ3, ϑ4}]/.{C[1]->0, C[2]->0}]]}]/Degree

gives you {{46.0492, -27.2805}, {-37.913, 35.4168}}

When you did not put a space between the ϑ3 or the ϑ4 and the Degree symbol it thought you meant to have names made up of those three characters.

Carefully study how my last line of code works. Try just the Reduce[ ] and look at the results. Then try the Reduce[ ]/.{ } and see how it changes. Then include N[ ] around this. Then include the {ToRules[ ]}. Then include the Map[ ]. Then include the /Degree. You are trying to learn how each of those steps were used to give you the solution in the form that you wanted.

POSTED BY: Bill Simpson
Answer
21 days ago

thanks alot ...its working!

POSTED BY: Ahmed Khodari
Answer
21 days ago

Use: Solve[{a == 0 ,b == 0} , {Theta3, Theta4}] // N

POSTED BY: kloun kloun
Answer
21 days ago

Group Abstract Group Abstract