Skip to content

Instantly share code, notes, and snippets.

View Rowing0914's full-sized avatar
💭
Studying

Norio Kosaka Rowing0914

💭
Studying
View GitHub Profile
@Rowing0914
Rowing0914 / main.py
Last active July 13, 2020 12:19
Linear algebraic way of Fibonacci Sequence
def f(n):
sqr_5 = 5**(1/2)
first = ((1 + sqr_5)/2)**n
second = ((1 - sqr_5)/2)**n
return int((1/sqr_5)*(first - second))
if __name__ == '__main__':
answer = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
for i in range(1, 11):
res = f(n=i)
@Rowing0914
Rowing0914 / main.py
Last active October 27, 2019 09:14
First/Second/Third order Taylor Approximation of f(x) = x ** 3
import numpy as np
from autograd import grad
import matplotlib.pyplot as plt
def f(x):
return x ** 3
def f_first(x):
return 3 * x ** 2