Class : Polynom - VadimKachevski/OOP_Ex1 GitHub Wiki
This class can hold a collection of Monom.
Each polynom is as a series of monoms Represented by the shape of a(1)X^b(1)+a(2)X^b(2).....+a(N)X^b(N)
The class Polynom is implementing Polynom_able interface.
You can build Polynoms using a String represneting a valid Polynom. Good Examples:
- "0-22x^2+35x-5+23x"
- "200-2-0-002"
- "2-x^2-4x0"
- "22x^2+35x-5+23x+2x^2"
- "x-24x^2+35x+5+2x"
- "3x^2+2x+3x^2-5x+3x^2+3x+5x+x"
- "2-4"
Bad Examples:
- "5x^2.2 -a5"
- "(5x^2)-4"
- "()5x-44"
The methods that can be used with a Polynom object
- f(x) - returns the value Y of the Polynom with the given x.
- add(Polynom_able p1) - adds to the current Polynom the given Polynom_able.
- add(Monom m1) - adds to the current Polynom the given Monom.
- substract(Polynom_able p1) - substructing from the current Polynom the given Polynom_able.
- multiply(Polynom_able p1) - Multiplying the current Polynom by the given Polynom_able.
- equals(Object p1) - returns a boolean value if the current Polynom is equal logically to the Other object,must be a Function.
- isZero() - returns a boolean value if the current Polynom is equal to Zero.
- area(double x0, double x1, double eps) - using Riemann integral returns the area in the region of the plane under the graph of the current Polynom and above the interval [x0, x1].
- copy() - returns a function that is a deep copy of the current Polynom.
- derivative() - returns a Polynom_able that is the derivative of the current Polynom.
- root(double x0, double x1, double eps) - returns the X value between x0 and x1 where the Y is as close as EPS to Zero.
- iteretor() - returns the iterator of the collection.
- multiply(Monom m1) - Mulitply the current Polynom by a given Monom.
- toString() - returns the String value that represent the Current Polynom.
- initFromString(String s) - returns a function created from the given String.