Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. import math
  2. import matplotlib.pyplot as plt
  3. import numpy as np
  4.  
  5. u1 = []
  6. u2 = []
  7. x = []
  8. i = 0
  9. a = 0.0
  10. b = 1.0
  11. h = 0.05
  12. n = (b-a)/h
  13. k = 0.0
  14.  
  15. u1.append(0.0)
  16. u2.append(1.0)
  17. x.append(0.0)
  18.  
  19. while i < n:
  20. u1.append(u1[i]+h*u2[i])
  21. u2.append(u2[i]+h*(-2*(math.tan(k))*u2[i]-(1.0-math.tan(k))*u1[i]+(1.0-math.tan(k))*(math.asin(math.tan(k)))))
  22. i+=1
  23. k+=h
  24. x.append(k)
  25.  
  26. print(u1,x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement