[Solved] Polynomial equations

Discuss the spreadsheet application

[Solved] Polynomial equations

Postby Slpncrg » Thu Dec 19, 2019 2:42 am

Hello, I need to solve polynomial equations with OpenOffice Calc, but I don't understand how to do it. I have an instructional for Excel that can solve that problem, but if I use "Solver" it says "No solutions". Do you have any advices?
Last edited by Slpncrg on Fri Dec 20, 2019 10:31 am, edited 1 time in total.
OpenOffice 3.2 on Ubuntu 10.04
Slpncrg
 
Posts: 8
Joined: Thu Dec 19, 2019 2:19 am

Re: Polynomial equations

Postby RusselB » Thu Dec 19, 2019 3:30 am

Welcome to the Forums.
Are you wanting to work with single or multiple variables in the polynominal equation?
OpenOffice 4.1.7 and LibreOffice 6.3.3.2 on Windows 7 Pro & Ultimate
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
User avatar
RusselB
Moderator
 
Posts: 5854
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Polynomial equations

Postby Slpncrg » Thu Dec 19, 2019 5:00 am

RusselB wrote:Welcome to the Forums.
Are you wanting to work with single or multiple variables in the polynominal equation?

I have equations:
1. X^2 - 6x + 13 = 0
2. X^3 + 9x^2 + 33x + 65 = 0
3. X^4 + 2x^3 + 30x^2 + 74x + 725 = 0

They all have complex roots. As far as I understood, the "Solver" does not work with them.
How can I solve it without other modules or programs?
OpenOffice 3.2 on Ubuntu 10.04
Slpncrg
 
Posts: 8
Joined: Thu Dec 19, 2019 2:19 am

Re: Polynomial equations

Postby RusselB » Thu Dec 19, 2019 6:44 am

These are single variable polynomials, meaning you only have one variable, in your case, represented by X
I'm out now, but will take a better look when home.
OpenOffice 4.1.7 and LibreOffice 6.3.3.2 on Windows 7 Pro & Ultimate
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
User avatar
RusselB
Moderator
 
Posts: 5854
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Polynomial equations

Postby RusselB » Thu Dec 19, 2019 8:49 am

When I tried your equations with Solver, I also got "No solution was found", but I also got "The model is not linear"
The second message is important, as that tells me that a simple solution is not going to be found.
I tried your first formula on the website https://www.symbolab.com/solver/polynom ... calculator and it found the solution, but as i suspected, it's not a simple answer.
At this point in time, Calc, without extra programming, does not have the ability to handle these types of problems.
I seem to recall seeing another post along these same lines, but too tired to be able to think straight to try to find it. Maybe after I get up in the morning.
In the meantime, you can try your other formulas in the site referenced earlier.
OpenOffice 4.1.7 and LibreOffice 6.3.3.2 on Windows 7 Pro & Ultimate
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
User avatar
RusselB
Moderator
 
Posts: 5854
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Polynomial equations

Postby Slpncrg » Thu Dec 19, 2019 9:00 am

RusselB wrote:When I tried your equations with Solver, I also got "No solution was found", but I also got "The model is not linear"
The second message is important, as that tells me that a simple solution is not going to be found.
I tried your first formula on the website https://www.symbolab.com/solver/polynom ... calculator and it found the solution, but as i suspected, it's not a simple answer.
At this point in time, Calc, without extra programming, does not have the ability to handle these types of problems.
I seem to recall seeing another post along these same lines, but too tired to be able to think straight to try to find it. Maybe after I get up in the morning.
In the meantime, you can try your other formulas in the site referenced earlier.


Thank you for advice.
OpenOffice 3.2 on Ubuntu 10.04
Slpncrg
 
Posts: 8
Joined: Thu Dec 19, 2019 2:19 am

Re: Polynomial equations

Postby Lupp » Thu Dec 19, 2019 1:08 pm

Slpncrg wrote:...They all have complex roots.

I didn't use Excel for decades now, but I dare to doubt if it actually can work on parameters allowing (truly) complex values with the solver. Are you sure your instructional for Excel would actually work under the quoted condition?

Anyway, Calc (whether in AOO or in LibreOffice) currently not has an actually numeric type for complex values. The related functions work with texts of a specific syntax, and the related terms and explanations in the "OpenFormula" document (4.4, 6.3.10) don't look exactly clear and sufficient to me.

Basically your task (solving polynomial equations allowing for imaginary parts in the solutions) is something for CAS software.
(Iterative algorithms working in the case of real solutions may fail.)

wxMaxima, e.g. (Be sure to not mix upper and lower case for same variable!), tells me
1. [x=3-2*%i,x=2*%i+3]
2. [x=-3*%i-2,x=3*%i-2,x=-5]
3. [x=2-5*%i,x=5*%i+2,x=-4*%i-3,x=4*%i-3]
within milliseconds.
On Windows 10: LibreOffice 6.2 and older versions, PortableOpenOffice 4.1.5 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2669
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Polynomial equations

Postby jrkrideau » Thu Dec 19, 2019 2:33 pm

Lupp wrote:
Slpncrg wrote:...They all have complex roots.

I didn't use Excel for decades now, but I dare to doubt if it actually can work on parameters allowing (truly) complex values with the solver. Are you sure your instructional for Excel would actually work under the quoted condition?



The idea that the Excel solver "has a good reputation for being fast and accurate" does not withstand an examination of the Excel solver's ability to solve the StRD nls test problems. Solver's ability is abysmal. 13 of 27 "answers" have zero accurate digits, and three more have fewer than two accurate digits -- and this is after tuning the solver to get a good answer. ... Excel solver does have the virture that it will always produce an answer, albeit one with zero accurate digits. Bruce McCullough http://r.789695.n4.nabble.com/Re-NLS-re ... 59167.html

Somehow wxMaxima looks like a better bet :)
OpenOffice 4.1.6; Ubuntu 18.04
jrkrideau
Volunteer
 
Posts: 3749
Joined: Sun Dec 30, 2007 10:00 pm
Location: Kingston Ontario Canada

Re: Polynomial equations

Postby Slpncrg » Thu Dec 19, 2019 4:15 pm

Thank you all for the help, but this is Calc homework so I can't use other programs. I tried to solve step by step, but Calc incorrectly considers the values. I know that the equation has one real root (Symbolab and Excel confirmed it), but I can’t calculate it. I think this is because Calc value (-3.21 + 2j) does not coincide with the Excel value (1.22 + 2j). The formulas are the same in both programs. How can I correct it?
For example, I inserted screenshots from Excel and Calc. The first screen Calc values and formulas, if someone needs them. In the second, show the values before and after Solver in Excel.
I calculated X^3 + 9x^2 + 33x + 65 = 0.
Attachments
2.png
Calc
1.png
Excel
OpenOffice 3.2 on Ubuntu 10.04
Slpncrg
 
Posts: 8
Joined: Thu Dec 19, 2019 2:19 am

Re: Polynomial equations

Postby Lupp » Thu Dec 19, 2019 4:55 pm

Slpncrg wrote:I know that the equation has one real root ...
There were THREE equations and only one of them has a real root. The others have one and respectively two pairs of conjugated complex solutions. I gave them all above.

In the case of the equation of degree 3 you can get the real solution by well known iterations (Newton type). Even in cases with more (2 or multiple) real solutions you will often only get one with the maximum amount (dependig on the start). Subsequently you need to reduce the degree by formally dividing the polynomial by the liner factor to the first solution. Neither Calc nor Excel are capable of doing this. It's CAS (or human's) work.

Since this was "Calc homework" we hope your teacher knew how to get it done. You are kindly invited to report the solution here.
On Windows 10: LibreOffice 6.2 and older versions, PortableOpenOffice 4.1.5 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2669
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Polynomial equations

Postby Slpncrg » Thu Dec 19, 2019 5:27 pm

Lupp wrote:
Slpncrg wrote:I know that the equation has one real root ...
There were THREE equations and only one of them has a real root. The others have one and respectively two pairs of conjugated complex solutions. I gave them all above.

In the case of the equation of degree 3 you can get the real solution by well known iterations (Newton type). Even in cases with more (2 or multiple) real solutions you will often only get one with the maximum amount (dependig on the start). Subsequently you need to reduce the degree by formally dividing the polynomial by the liner factor to the first solution. Neither Calc nor Excel are capable of doing this. It's CAS (or human's) work.

Since this was "Calc homework" we hope your teacher knew how to get it done. You are kindly invited to report the solution here.


Maybe I don't understand you, but I have already solved two equations. The first through discriminant, the second through Solver, but in Excel. In the second equation there are three roots and I found them all: -5, -2 + 3i, -2 - 3i. I can't do the same in Calc because (I think) Calc incorrectly considers the values. Can I fix the values (increase calculation accuracy) ​​in Calc or IMPOWER() algorithm in programs different and this is impossible?
OpenOffice 3.2 on Ubuntu 10.04
Slpncrg
 
Posts: 8
Joined: Thu Dec 19, 2019 2:19 am

Re: Polynomial equations

Postby jrkrideau » Thu Dec 19, 2019 5:43 pm

the second through Solver, but in Excel


I would refer you to my earlier post. It seems that Excel will give you a solution.

Whether the solution has any relationship to to problem is another question. Does the Excel solution agree with Lupp's solution?
OpenOffice 4.1.6; Ubuntu 18.04
jrkrideau
Volunteer
 
Posts: 3749
Joined: Sun Dec 30, 2007 10:00 pm
Location: Kingston Ontario Canada

Re: Polynomial equations

Postby lader » Thu Dec 19, 2019 6:00 pm

SolverNLP.ods
(22.67 KiB) Downloaded 6 times
Added conditions. The minimized cell must be in square.
LibreOffice 6 on Ubuntu 18.04LTS
lader
 
Posts: 18
Joined: Mon Jul 02, 2018 6:10 pm

Re: Polynomial equations

Postby Slpncrg » Thu Dec 19, 2019 6:26 pm

jrkrideau wrote:
the second through Solver, but in Excel


I would refer you to my earlier post. It seems that Excel will give you a solution.

Whether the solution has any relationship to to problem is another question. Does the Excel solution agree with Lupp's solution?

The second equation and one of the third equation's root coincides with Lupp's solution.I understood that I didn't correctly search for the other two roots, I'll think about it.
OpenOffice 3.2 on Ubuntu 10.04
Slpncrg
 
Posts: 8
Joined: Thu Dec 19, 2019 2:19 am

Re: Polynomial equations

Postby Slpncrg » Thu Dec 19, 2019 6:31 pm

lader wrote:
SolverNLP.ods
Added conditions. The minimized cell must be in square.

Wow, thank you very much for the solution, but I totally forgot to write that I can't use macros. I’ll check the code tomorrow and I hope the thought comes how to solve it only with the help of built-in functions.
OpenOffice 3.2 on Ubuntu 10.04
Slpncrg
 
Posts: 8
Joined: Thu Dec 19, 2019 2:19 am

Re: Polynomial equations

Postby lader » Thu Dec 19, 2019 10:02 pm

Newton method:
Polynomial equation - Newton.ods
(11.64 KiB) Downloaded 6 times
LibreOffice 6 on Ubuntu 18.04LTS
lader
 
Posts: 18
Joined: Mon Jul 02, 2018 6:10 pm

Re: Polynomial equations

Postby Slpncrg » Fri Dec 20, 2019 10:29 am

Thank you all for your help in solving the problem.
As for the solution in the field of complex numbers, I understood that Solver cannot find complex roots.
The teacher did not say how to solve them using the built-in functions, but said to solve it in Excel (where complex roots are not quite correctly calculated if you do not know the exact restrictions).
In the end, I was able to solve only two of the three equations. The first using discriminant, the second using the Horner's Method.
I attached the first equation's solution to the message. A document with the second equation( if I have time) I will post it later (maybe not .ods, but .xlsx). If you need, I attached screenshots with the second equation's solution.

Thanks again to all of you. I learned a lot of new things :) .
Attachments
1.ods
X^2 - 6x + 13 = 0
(9.02 KiB) Downloaded 3 times
111.png
X^3 + 9x^2 + 33x + 65 = 0 (1)
11.png
X^3 + 9x^2 + 33x + 65 = 0 (2)
11.png (9.24 KiB) Viewed 237 times
OpenOffice 3.2 on Ubuntu 10.04
Slpncrg
 
Posts: 8
Joined: Thu Dec 19, 2019 2:19 am


Return to Calc

Who is online

Users browsing this forum: No registered users and 4 guests