Get Help

Turn on suggestions

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

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Solving a Polynomial Equation

Options

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

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

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-09-2014
10:31 AM

10-09-2014
10:31 AM

I have been playing around using different methods to solve a polynomial equation and need the help of one of the 'symbolic guru's on here.

I have managed to solve the equation and evaluated numerically, but have the following queries:

- Can I force the symbolic result to return only real values

- Is 'float' required to evaluate the symbolic expression numerically

- Is there a more elegant way to solve this equation.

Thanks,

Mike

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-09-2014
11:59 AM

10-09-2014
11:59 AM

Mike Armstrong wrote:

I have been playing around using different methods to solve a polynomial equation and need the help of one of the 'symbolic guru's on here.

I have managed to solve the equation and evaluated numerically, but have the following queries:

- Can I force the symbolic result to return only real values

Not in an easy and natural way ("assume" does not work for this). See attachment.

- Is 'float' required to evaluate the symbolic expression numerically

I guess to evaluate the LambertW function numerically its a requirement. This function can only be evaluated symbolically and thats the reason you can't use the result of the symbolics directly in numeric evaluations without first symbolically evaluate it by using float and turning it that way into numeric results.

- Is there a more elegant way to solve this equation.

Probably the symbolically evaluated solve block is the better solution. I am not sure why the numeric evaluation fails here.

24 REPLIES 24

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-09-2014
11:28 AM

10-09-2014
11:28 AM

Re: Solving a Polynomial Equation

Can I force the symbolic result to return only real values

In general, I think no.

Is 'float' required to evaluate the symbolic expression numerically

You can put a floating point number somewhere in your expression, then you will get a floating point answer (for example, put k.6*1.0). If you do use float then 8 digits is not enough though. Remember that float does not just affect the displayed answer, it affects the precision of the calculations. Check how much error you have in your equality with float 8: about 6,000,000. With float 20 the error is 0.03.

Is there a more elegant way to solve this equation.

I would automate the picking of the real root.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-09-2014
11:59 AM

10-09-2014
11:59 AM

Mike Armstrong wrote:

I have been playing around using different methods to solve a polynomial equation and need the help of one of the 'symbolic guru's on here.

I have managed to solve the equation and evaluated numerically, but have the following queries:

- Can I force the symbolic result to return only real values

Not in an easy and natural way ("assume" does not work for this). See attachment.

- Is 'float' required to evaluate the symbolic expression numerically

I guess to evaluate the LambertW function numerically its a requirement. This function can only be evaluated symbolically and thats the reason you can't use the result of the symbolics directly in numeric evaluations without first symbolically evaluate it by using float and turning it that way into numeric results.

- Is there a more elegant way to solve this equation.

Probably the symbolically evaluated solve block is the better solution. I am not sure why the numeric evaluation fails here.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-09-2014
12:14 PM

10-09-2014
12:14 PM

Re: Solving a Polynomial Equation

I am not sure why the numeric evaluation fails here.

Big numbers. Change CTOL to 0.1.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-09-2014
12:32 PM

10-09-2014
12:32 PM

Re: Solving a Polynomial Equation

Richard Jackson wrote:

I am not sure why the numeric evaluation fails here.

Big numbers. Change CTOL to 0.1.

That only works when the guess value is close to the actual value of V.b.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-09-2014
12:32 PM

10-09-2014
12:32 PM

Re: Solving a Polynomial Equation

Richard Jackson wrote:

Can I force the symbolic result to return only real valuesIn general, I think no.

Is 'float' required to evaluate the symbolic expression numericallyYou can put a floating point number somewhere in your expression, then you will get a floating point answer (for example, put k.6*1.0). If you do use float then 8 digits is not enough though. Remember that float does not just affect the displayed answer, it affects the precision of the calculations. Check how much error you have in your equality with float 8: about 6,000,000. With float 20 the error is 0.03.

Is there a more elegant way to solve this equation.I would automate the picking of the real root.

Cheers Richard,

I thought you and Werner would be the first to offer an explanation.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-09-2014
12:34 PM

10-09-2014
12:34 PM

Re: Solving a Polynomial Equation

Richard Jackson wrote:

I am not sure why the numeric evaluation fails here.

Big numbers. Change CTOL to 0.1.

Ah yes! I see. Thanks

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-09-2014
12:40 PM

10-09-2014
12:40 PM

Re: Solving a Polynomial Equation

Its seems to work for guess value in the range from 580 to 10^11.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-09-2014
12:43 PM

10-09-2014
12:43 PM

Re: Solving a Polynomial Equation

Werner Exinger wrote:

Mike Armstrong wrote:

I have managed to solve the equation and evaluated numerically, but have the following queries:

- Can I force the symbolic result to return only real values
Not in an easy and natural way ("assume" does not work for this). See attachment.

Why though. That was baffling me all afternoon.

Werner Exinger wrote:

- Is 'float' required to evaluate the symbolic expression numerically
I guess to evaluate the LambertW function numerically its a requirement. This function can only be evaluated symbolically and that's the reason you can't use the result of the symbolic's directly in numeric evaluations without first symbolically evaluate it by using float and turning it that way into numeric results

I get it thanks. Is there a way to assess beforehand if a function can be evaluated numerically?

Thanks for spotted the error with the Minerr example. However, the numerical processor is still dependant on the guess values from the user. Sorry for sounding stupid, but why can the symbolic processor solve it?

Werner Exinger wrote:

- Is there a more elegant way to solve this equation.
Probably the symbolically evaluated solve block is the better solution. I am not sure why the numeric evaluation fails here.

Yes is much neater and it does not rely on the guess value.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-09-2014
12:51 PM

10-09-2014
12:51 PM

Re: Solving a Polynomial Equation

Oh, forgot to mention. I like your REALONLY function