Find zeros of continueous functions

degree of difficulty: 2

If zeros exists for a continueous function f: R -> R then at least to real numbers a and b exists such that f(a)f(b) < 0 holds: Exact one of both values is negativ the other positive. Because f is continueous, there must be a zero between a und b.

Implement a binary partition algorithm, that finds the zero of a continueous function f in the given intervall [a, b] with a certain precision. f can be a fixed coded Java function. Test your programm with f(x) = 2x3 - 5x2 + 7x + 2, a = -1, b = 1 ( f(1) = 2 - 5 + 7 = 6, f(-1) = -2 - 5 - 7 = -14).

Solution. In my solution the function is given as an abstract data type (interface) to be more flexible in the choice of f.

Implement Newton's method

Schwierigkeit 2

Implement a method that calculates a zero of a continous, derivable function f with Newton's method.

Newton's method starts with an arbitrary value x0 and calculates the sequence xn+1 := xn - f(xn)/f'(xn). This sequence converges (in most cases) to a zero of f.

If you alreay solved the exercise to implement polynomials, then you can use your implementation to test Newton's method. If not, then define and implement a class (or interface) with two methods: one for calculating f(x) and one for the first derivation of f with value x.