Skip to main content
1-Visitor
October 9, 2014
Solved

Solving a Polynomial Equation

  • October 9, 2014
  • 2 replies
  • 10747 views

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

Best answer by Werner_E

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.

1.png

2 replies

19-Tanzanite
October 9, 2014
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.

1-Visitor
October 9, 2014

Richard Jackson wrote:

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.

Cheers Richard,

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

Werner_E25-Diamond IAnswer
25-Diamond I
October 9, 2014

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.

1.png

19-Tanzanite
October 9, 2014

I am not sure why the numeric evaluation fails here.

Big numbers. Change CTOL to 0.1.

1-Visitor
October 9, 2014

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.