Author: Not specified Language: text
Description: Not specified Timestamp: 2018-01-17 20:45:24 +0000
View raw paste Reply
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. n = np.arange(40) * 1.0
  5. h = np.exp(-n)
  6. ab = np.cos(1)
  7. est_raw = (np.sin(1+h) - np.sin(1)) / h
  8. est_new = 2 * np.cos(1+h/2) * np.sin(h/2) / h
  9. err = ab - est_new
  10.  
  11. plt.grid(True)
  12. plt.title('test')
  13. plt.loglog(n, err)
  14. plt.show()
View raw paste Reply