Skip to content

Instantly share code, notes, and snippets.

@xhiroga
Created November 29, 2017 23:03
Show Gist options
  • Save xhiroga/625a41f4b0c2ca9cbb071a21721773e6 to your computer and use it in GitHub Desktop.
Save xhiroga/625a41f4b0c2ca9cbb071a21721773e6 to your computer and use it in GitHub Desktop.
黄金比のグラフを出力してくれるやつ
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
def main():
n = 30
fib_list = []
rate_list = []
for num in range(n):
if num <= 1:
fib_list.append(num)
rate_list.append(num)
else:
fib_list.append(fib_list[num-1] + fib_list[num-2])
rate_list.append(fib_list[num] / fib_list[num-1])
x = np.arange(0, n, 1)
plt.plot(x, rate_list)
plt.show()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment