|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.activity.files.Lagrange
A class which generates Lagrange interpolating polynomials interpolating the co-ordinates (pn, n), given an array of integers {pn}.
The generated polynomial is defined to be of degree n-1 if there are n co-ordinates.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement |
private int |
mN
|
private int[] |
mX
|
private int[] |
mY
|
Constructor Summary | |
Lagrange(int[] vals)
Generate a new polynomial based on the given "seed integers" {pn}. |
Method Summary | |
double |
p(int x)
The function representing the Lagrange interpolating polynomial. |
double |
p(int j,
int x)
The function representing one part of the Lagrange interpolating polynomial, used by the function P(int x) . |
java.lang.String |
toString()
Return a textual representation of the array of seed integers. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private int[] mX
private int[] mY
private int mN
Constructor Detail |
public Lagrange(int[] vals)
vals
- The seed integersMethod Detail |
public java.lang.String toString()
toString
in class java.lang.Object
public double p(int x)
P(x) =def Sum of (Pj(x)), for j = 1 to n.
x
- The abscissa
public double p(int j, int x)
P(int x)
.
Pj(x) =def yj * Product of ((x - xk) / (xj - xk)), for k = 1 to n and k != j.
j
- The index j of the function Pjx
- The abscissa
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |