This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |