Message Boards Message Boards

0
|
5895 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

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

Posted 7 years ago

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
3 Replies
Posted 7 years ago

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

POSTED BY: kloun kloun
Posted 7 years 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
Posted 7 years ago

thanks alot ...its working!

POSTED BY: Ahmed Khodari
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