Fifth-degree equation solving app

Hello everyone!

I have a school project relating to MIT App Inventor in which we have to make an app that can solve (approximately) a fifth-degree equation of this formating: α5 x 5 +α4 x 4 +α3x 3 +α2 x 2+α1 x +α0 = 0 . While also allowing the user to enter a value for the deviation margin, allowing the user to enter the two ends of an interval where a solution will be sought, allowing the user to enter the step of changing values ​​from the left end to the right “end”, and finally calculates the value of x using the above method. If no value of x satisfies the deviation criterion, displays the message “No solution found!”.

However, our professor has not taken the time to teach us any of this, expecting us to know it despite it being above our grade level. Which is why I have come here for answers. I can do the coding part just fine, my issue is the math segment. I have no idea regarding how I would even go about calculating a solution, and everything I’ve looked up has only given me theories on why it is not possible to do this…

Any help at all is appreciated!

Because your formula is continuous, you could try binary search to find zero crossings.

If y(x1) has an opposite sign (+/-) to y(x2) then there must be a zero crossing between x1 and x2.

Apply that test to the midpoint between x1 and x2 then home in on the side with the crossing.

Repeat until you have a tiny difference.

P.S. Two numbers have opposite signs if and only if their product is negative.

If you would like to read more about the method and learn about it, here are a couple links:

Newton's method - Wikipedia
Newton Raphson Method - GeeksforGeeks

Here is a discussion about solving a 4th degree equation using App Inventor that may help you.

I forgot to mention that AI2 has an easy to use charts component that can be used to plot y(x) in your given domain.

It makes it easier to spot roots, places where y crosses the x axis.

Here's a starter kit with input, a y function, and a graph.

It does not include the root seeking part, but should get you started.


polynomial_finder.aia (3.9 KB)

Designer:

2 Likes

One last thing you will need for this ...

An extra global variable to remember the previous y value from the walk across the x values,, for use in recognizing the x axis crossing.

So, did you find your roots?