Decipher Math terms in program-code?
i want to write a program which can solve math problems.
Everything related to functions should be solved by this program
e.g.:
f(x) = mx + t
f(x) = ax² + bx + c
It should show one the zeros and the inverse function, and where the functions intersect.
It isn't especially with power elements in the term and binomial formulars...
What would be the best way to realize this?
This is a very complex problem. However, if you're just considering polynomials with one variable then there is a method to do what you want. You first need a parser to analyse the equation to extract the coefficents. Then, find the eigenvalues of the matrix:
to get the roots, where the polynomial is of the form
anxn + ... + a2x2 + a1x + a0 = 0
For further reference visit Math World
Skizz
- -| -a0/an -a1/an ... -1|| 1 0 ... 0|| 0 1 ... 0|| . . ... .|| 0 0 ... 0|- -
to get the roots, where the polynomial is of the form
anxn + ... + a2x2 + a1x + a0 = 0
For further reference visit Math World
Skizz
Just code in a functional language (or at least prototype in a functional one and then interpret to C) and this kind of problem becomes a walk in the park. Objective Caml (just search it on google) is a pretty good one and comes with just such an interpreter... On the other hand, if you're doing this purely as an excercise in computer science, some appropriate reading would be in the field of numerical methods. You can probably find this stuff in any handy calc text.
Skizz, doesn't finding the eigenvalues of a matrix involve finding roots of a polynomial equation anyway?
How would you use numerical methods to find all the roots, surely a numerical method will find one root at a time. How do you know if you have a double root without factorising?
There are formula for root solving for quadratics, cubics and quartics. The cubic and quartic equations are very long indeed.
There is a method for factorising polynomials of degree 5 and above, but I skived all my lectures on Galois Theory. I got a book out of the library before the exam, but I couldn't understand it at all, and its advanced stuff.
How would you use numerical methods to find all the roots, surely a numerical method will find one root at a time. How do you know if you have a double root without factorising?
There are formula for root solving for quadratics, cubics and quartics. The cubic and quartic equations are very long indeed.
There is a method for factorising polynomials of degree 5 and above, but I skived all my lectures on Galois Theory. I got a book out of the library before the exam, but I couldn't understand it at all, and its advanced stuff.
It's been a while since I had to actual do stuff with these (not since University, 12 years back), but yes, looking at now you do end up with more polynomials.
Oops.
As an alternative, try searching google for 'root polynomial' and you'll find what you need.
Skizz
Oops.
As an alternative, try searching google for 'root polynomial' and you'll find what you need.
Skizz
Thank you guys for all the information you gave me so far. :-)
I want to write such a program only out of curiosity. I want to know if i can achieve it that the program takes a line as input e.g: 5x² + 7x +2 or x³ - 3x² - 5x + 15 and do certain calculations.
Now i'll google some more and will check out your links.
I want to write such a program only out of curiosity. I want to know if i can achieve it that the program takes a line as input e.g: 5x² + 7x +2 or x³ - 3x² - 5x + 15 and do certain calculations.
Now i'll google some more and will check out your links.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement