cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

better way than symbolic solve?

relayman357
10-Marble

better way than symbolic solve?

Hi - in the attached Prime 9 worksheet my last line (solving for the only unknown, L subscript 4) hangs. The variable L subscript 4 is the only unknown in the equation.  Is there a better way to solve for it than what I'm doing here?

 

relayman357_2-1716470048420.png

 

thanks,

russ

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Ah, I just found the reason why the symbolic solve did not work for L4.

The reason is the angle you defined in degree. Primes symbolics does not know anything about units and so "deg" is treated as an unknown variable which makes solving symbolically quite difficult.

You can fix this by (re)defining the unit deg somewhere at the top of the sheet (at least in front of the first usage of "deg"):

Werner_E_0-1716474477623.png

Now the symbolics will also solve for L4 as fast as for the other variables.

 

Nonetheless I still think that using numeric methods should be used if all you look for is a numeric value.

 

A word of caution: You are using the "float" modifier in your symbolic evaluations. Please note that this does not only affect the display of the result but also the precision of the whole calculation.

Give it a try. After the definition of my function fun evaluate fun(L.4)= you will get a result a little different from zero. Now change "float, 6" to something like "float,26" and you will see that fun(L.4) now evaluates to zero!

 

Prime 9 file attached

 

 

View solution in original post

4 REPLIES 4

As you are just looking for a numeric result, it might be better to use Primes numeric methods rather than the symbolics.

The disadvantage of doing so is that you either have to provide a guess value or a range where the solution is expected.

I found that your equation is not very sensitive with respect to the guesses as probably any positive guess value will yield the desired result.

See the attached Prime 9 file for three different methods to get the desired value.

 

Ah, I just found the reason why the symbolic solve did not work for L4.

The reason is the angle you defined in degree. Primes symbolics does not know anything about units and so "deg" is treated as an unknown variable which makes solving symbolically quite difficult.

You can fix this by (re)defining the unit deg somewhere at the top of the sheet (at least in front of the first usage of "deg"):

Werner_E_0-1716474477623.png

Now the symbolics will also solve for L4 as fast as for the other variables.

 

Nonetheless I still think that using numeric methods should be used if all you look for is a numeric value.

 

A word of caution: You are using the "float" modifier in your symbolic evaluations. Please note that this does not only affect the display of the result but also the precision of the whole calculation.

Give it a try. After the definition of my function fun evaluate fun(L.4)= you will get a result a little different from zero. Now change "float, 6" to something like "float,26" and you will see that fun(L.4) now evaluates to zero!

 

Prime 9 file attached

 

 

Outstanding,  It seems like Prime should know the difference between my formatted result with deg, and the actual value.  Regardless, thank you very much.

 

Also, thanks for the clarification on float!!

LucMeekes
23-Emerald III
(To:relayman357)

You can solve the equations fully symbolically and then fill in the numbers so as to not loose precision. It starts with:

LucMeekes_0-1716497997131.png

The above should result in a large expression, and gives two solutions, apparently you want the (most) positive result.

Then you can fill in the numbers and calculate the result and the data for the next iteration:

LucMeekes_3-1716498214413.png

Then solve the following:

LucMeekes_1-1716498128463.png

and calculate the result and the data for the next iteration:

LucMeekes_4-1716498248667.png

Then solve the following:

LucMeekes_2-1716498168569.png

and calculate the result:

LucMeekes_5-1716498325876.png

etc.

 

Succes!
Luc

Top Tags