Hello, this is the first time that I program with C++. I want create a program to able to compute the root of an equation with unknown degree. I want to use "boost" library but I don't understand which is the best function to use and how to use it.
If the degree of equation is equal to 2 or 3 the formula for solve this is known but if the degree of equation is > or = to 4 i have problems. I want create a general function.
I saw that in boost library (boost::math::tool) there are some function (i.e. bisect) for solve this problem but i don't understand how i can use this.
I don't know the bisect function, but I would assume it goes something like this.
This only applies to real roots, not complex ones.
Let a<b. By the intermediate value theorem, a continuous function that satisfies f(a)<0<f(b) or f(a)>0>f(b) must have a root between a and b. Let c = (b-a)/2 and consider the two regions [a,c] and [c,b]. One of these regions must contain the root in [a,b]. Reapply the theorem until b-a is within your desired accuracy.