Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. from math import sin
  2. D1=float(input('Введите начало отсчета: '))
  3. D2=float(input('Введите конец отсчета: '))
  4. step=float(input('Введите шаг цикла: '))
  5. max=-99999
  6. min=99999
  7. x=D1
  8. while D1<=x<=D2:
  9. if x>max:
  10. max=x
  11. if x<min:
  12. min=x
  13. x+=step
  14. while D2<=x<=D1:
  15. if x>max:
  16. max=x
  17. if x<min:
  18. min=x
  19. x-=step
  20. Fmin=sin(min)
  21. Fmax=sin(max)
  22. print(end='\n')
  23. print(end='\n')
  24. print(end='\n')
  25. print(' '*2,'y')
  26. print(' '*5,'{:.2}'.format(float(Fmin)),' '*20,end='')
  27. print('{:.2}'.format(float(Fmax)))
  28. print(' '*7,'|_','_'*24,'|',sep='')
  29. x=D1
  30. print('x')
  31. print(end='\n')
  32. Sr=[]
  33. Sr.append(Fmin)
  34. Sr.append(Fmax)
  35. x=D1
  36. while D1<=x<=D2:
  37. Fx=sin(x)
  38. if Sr[0]<0:
  39. m=(-Fmin)/(Fmax-Fmin)+1
  40. elif Sr[0]>0 and Sr[1]<0:
  41. m=(-Fmin)/(Fmax-Fmin)+1
  42. print(' '*20,'|')
  43. m=(Fx-Fmin)/(Fmax-Fmin)+1
  44. print(x,' '*int(m)*12,' *')
  45. x+=step
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement