Phi series

one of the most striking phi facts is that a series formed by adding the two previous numbers, such as 2 , 3 , 5 , 8 , 13 , 21… always ends up with

\lim_{n \to \infty} u_{n+1}/u_n=\phi

no matter which two numbers are used for the first two terms.

Here is an excel visual basic demonstration. The test sub asks the user for two integers. The series is computed, the 20th term is divided by the 19th term, and the result displayed to the screen. Phi is subtracted from the result to show the difference. All 20 terms and the results are also written to the debug window.

Sub test_phi_converge()
Dim num1 As Long
Dim num2 As Long
num1 = InputBox("enter first integer:")
num2 = InputBox("enter second integer:")
Call phi_converge(num1, num2)
End Sub

Sub phi_converge(numa As Long, numb As Long)
Dim numc As Long
Dim i As Integer

Debug.Print numa
Debug.Print numb

'this will make a series of 20
'and divide term_20 by term_19
For i = 3 To 19
numc = numa + numb
'c becomes b and b becomes a for the next iteration
numa = numb
numb = numc
Debug.Print numc
Next i

'term_20
numc = numa + numb
Debug.Print numc

Dim result As Double, diff As Double
result = numc / numb
diff = result - 1.61803398874989
MsgBox result & " " & Format(diff, "#0.00000000000000")

Debug.Print result
Debug.Print Format(diff, "#0.00000000000000")
End Sub

a sample run

3
13
16
29
45
74
119
193
312
505
817
1322
2139
3461
5600
9061
14661
23722
38383
62105
1.61803402548003
0.00000003673014

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s