|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softsynth.math.Polynomial
public class Polynomial
Polynomial
Implement polynomial using Vector as coefficient holder.
Element index is power of X, value at a given index is coefficient.
Constructor Summary | |
---|---|
Polynomial()
create a polynomial with no terms |
|
Polynomial(double c0)
create a polynomial with one term of specified constant |
|
Polynomial(double c1,
double c0)
create a polynomial with two terms with specified coefficients |
|
Polynomial(double c2,
double c1,
double c0)
create a polynomial with specified coefficients |
|
Polynomial(double c3,
double c2,
double c1,
double c0)
create a polynomial with specified coefficients |
|
Polynomial(double c4,
double c3,
double c2,
double c1,
double c0)
create a polynomial with specified coefficients |
Method Summary | |
---|---|
void |
addTerm(double coefficient,
int power)
Add the coefficient of given term to the specified coefficient. |
void |
appendTerm(double coefficient)
Append a term with specified coefficient. |
double |
evaluate(double x)
Evaluate this polynomial for x |
double |
get(int power)
|
static void |
main(java.lang.String[] args)
|
static Polynomial |
minus(Polynomial p1,
Polynomial p2)
Subtract polynomial from another. |
static Polynomial |
mult(double scaler,
Polynomial p1)
Multiply a Polynomial by a scaler |
static Polynomial |
mult(Polynomial p1,
Polynomial p2)
Multiply two Polynomials |
static Polynomial |
plus(Polynomial p1,
Polynomial p2)
Add two polynomials together |
void |
setTerm(double coefficient,
int power)
Set the coefficient of given term |
int |
size()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Polynomial()
public Polynomial(double c0)
public Polynomial(double c1, double c0)
public Polynomial(double c2, double c1, double c0)
public Polynomial(double c3, double c2, double c1, double c0)
public Polynomial(double c4, double c3, double c2, double c1, double c0)
Method Detail |
---|
public void appendTerm(double coefficient)
public void setTerm(double coefficient, int power)
public void addTerm(double coefficient, int power)
public double get(int power)
public int size()
public static Polynomial plus(Polynomial p1, Polynomial p2)
public static Polynomial minus(Polynomial p1, Polynomial p2)
public static Polynomial mult(Polynomial p1, Polynomial p2)
public static Polynomial mult(double scaler, Polynomial p1)
public double evaluate(double x)
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |