public class Polynomial
extends java.lang.Object
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
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() |
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)
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)