Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. import numpy as np
  2. from scipy.optimize import curve_fit
  3. import matplotlib.pyplot as plt
  4.  
  5. def g(x, c):
  6.     return (x**(1/2**20) - 1) * c
  7.  
  8. x = np.logspace(0.01, 90)
  9.  
  10. pars, cov = curve_fit(g, x, np.log10(x), p0=(2.27e5), maxfev=int(1e4))
  11.  
  12. plt.plot(x, np.log10(x))
  13. plt.plot(x, g(x, *pars))
  14. plt.semilogx();
  15.  
  16. print(f'(x^(1/2^20) - 1) * {pars[0]:.2f}')
  17. print(g(364, pars[0]), np.log10(364), g(364, 455356) - np.log10(364))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement