vadimk772336

Untitled

Nov 11th, 2019
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. from sympy import *
  2.  
  3.  
  4.  
  5. def MaxBerivative(a):
  6.     i = -2
  7.     max = a.subs(x,i)
  8.     while (i <= 2):
  9.         if (max < a.subs(x,i)):
  10.             max = a.subs(x,i)
  11.         i += 0.01
  12.     print(max)
  13.     return str(max)
  14.  
  15.  
  16. f = open('D:\\Degree_Derivative.txt', 'r', encoding="utf-8")
  17. Degree = f.readline()
  18. f.close()
  19. print(Degree)
  20.  
  21. x, y, z = symbols('x y z')
  22. init_printing(use_unicode=True)
  23. Berivative = diff(x/(x*x+1), x, Degree)
  24.  
  25.        
  26. max = MaxBerivative(Berivative)
  27. max = str(round(float(max),2))
  28.  
  29. print(max)
  30.  
  31. g = open('D:\\test1.txt','w', encoding="utf-8")
  32. g.write(max)
  33. g.close()
Advertisement
Add Comment
Please, Sign In to add comment