Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily.
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

May 23, 2024
09:16 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 23, 2024
09:16 AM

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?

thanks,

russ

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

May 23, 2024
10:31 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 23, 2024
10:31 AM

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"):

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

4 REPLIES 4

May 23, 2024
10:17 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 23, 2024
10:17 AM

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.

May 23, 2024
10:31 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 23, 2024
10:31 AM

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"):

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

May 23, 2024
10:52 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 23, 2024
10:52 AM

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!!

May 23, 2024
05:06 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

May 23, 2024
05:06 PM

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

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:

Then solve the following:

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

Then solve the following:

and calculate the result:

etc.

Succes!

Luc