|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.analysis.sequence.Fibonacci
public class Fibonacci
Construct a Fibonacci sequence.
A Fibonacci sequence starts with 0 and 1 as the first two numbers. Each subsequent number is the sum of the previous two.
For example, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
| Field Summary | |
|---|---|
int |
length
length of the sequence |
| Constructor Summary | |
|---|---|
Fibonacci(int length)
Construct a Fibonacci sequence. |
|
| Method Summary | |
|---|---|
double |
get(int index)
Get the index-th Fibonacci number, counting from 1. |
double[] |
getAll()
Get the whole (finite) sequence in a double[] array. |
int |
length()
Get the number of computed terms in the sequence. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public int length
| Constructor Detail |
|---|
public Fibonacci(int length)
length - the number of terms to generate| Method Detail |
|---|
public int length()
Sequence
length in interface Sequencepublic double get(int index)
index-th Fibonacci number, counting from 1.
get in interface Sequenceindex - an index ≤ length
index-th Fibonacci numberpublic double[] getAll()
length Fibonacci numbers in a double[] array.
getAll in interface Sequencelength Fibonacci numbers
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||