Calculating The Golden Ratio Convergence in Java

In this tutorial, the golden ratio is calculated using the fibonacci numbers and the golden ratio convergence is examined as the number of iterations increases

Calculating The Golden Ratio Convergence in Java

Similar Tutorial: Calculating The Golden Ratio Convergence in Microsoft Excel

Convergence of the golden ratio obtained by dividing the fibonacci numbers with each other as the number of iterations increases:

int[] fibonacci=new int[19];
 
fibonacci[0]=1;
fibonacci[1]=1;

System.out.println("Fibonacci Number\tRatio");
System.out.println("");

for (int i=2; i<=18; i++)
{
	fibonacci[i]+=fibonacci[i-1]+fibonacci[i-2];
	double ratio=(double)fibonacci[i]/fibonacci[i-1];
	System.out.println(fibonacci[i]+"\t\t\t"+ratio);
}

golden ratio fibonacci numbers java