Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from scipy.optimize import curve_fit
- import matplotlib.pyplot as plt
- def g(x, c):
- return (x**(1/2**20) - 1) * c
- x = np.logspace(0.01, 90)
- pars, cov = curve_fit(g, x, np.log10(x), p0=(2.27e5), maxfev=int(1e4))
- plt.plot(x, np.log10(x))
- plt.plot(x, g(x, *pars))
- plt.semilogx();
- print(f'(x^(1/2^20) - 1) * {pars[0]:.2f}')
- print(g(364, pars[0]), np.log10(364), g(364, 455356) - np.log10(364))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement