False Positive Algorithm
The Method of False Positive works similar to the Bisection method as it
still aims at finding the real root of the equation f(x) = 0 on an interval [a, b].
The difference is in the method if choosing the bounding intervals, [a1, b1], [a2, b2], [a3, b3], ... [ai, bi], which will be done by partitioning the current interval in the ratio f(ai)/f(bi) of the function values at both ends. When iterating it is repeating and substituting false test values to find improved approximations of the solution.
----------------------------------------------------------------------------------------
Starting with the double func function, we have a function that is f(x) = x⁵+6x³-4 .
Next function is the FalsePositive function, which will start out by taking a
function which will be our func function, the minimum interval value, the maximum interval value
and a reference variable which will be our root. All taken as parameters.
We will initialize similar variables as the Bisection method,
having a variable for epsilon, maximum iteration count and functions of a, b and the root.
Then all of our parameters we set are gonna run through some conditions:
1. If f(a) = 0, it will return a zero, which in our main we have programmed it so it will directly display the root a.
2. If f(b) = 0, it will return a zero, which in our main we have programmed it so it will directly display the root b.
3. If f(a)f(b) > 0, it will return a one, which in our main we have programmed it so it will not display anything.
4. The bounds have a limitation of <= epsilon*|f(x)|.
5. |f(x)| <= epsilon
-------------------------------------------------------------------------------------------------
Before main be sure to setup your function calls accordingly.
In main it starts by defining all of the variables for the bounds, bounding increment, root and a falsePositive check.
The while loop checks to see if the lower bound is smaller than the higher bound.
Inside the loop we define the expanding bound, our falsePositive variable and an if statement to see what the variable (falsePositive) returns.
Once those conditions pass, display the result.
As you can see the result of our function is: x ≈ 0.84168.
Checking it on wolfram alpha we obtain the same approximate solution.