Advertisement
pegorino

python_prof. home_work_8

Apr 7th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. import matplotlib.pyplot as plot
  2. import numpy
  3.  
  4.  
  5. arr_1 = numpy.arange(0, 10, 1)
  6. arr_2 = numpy.arange(0, 1000, 10)
  7.  
  8.  
  9. def func_with_cos(x):
  10.     '''
  11.    :param x: rad
  12.    :return:
  13.    '''
  14.     return x ** 2 - numpy.cos(x)
  15.  
  16.  
  17. def func_with_sqrt(x):
  18.     return x ** (1 / 3) - numpy.sqrt(x)
  19.  
  20.  
  21. if __name__ == '__main__':
  22.     plot.figure(1)
  23.  
  24.     plot.subplot(211)
  25.     plot.plot(arr_1, func_with_cos(arr_1), 'b')
  26.     plot.title('with cos func')
  27.     plot.grid(True)
  28.  
  29.     plot.subplot(212)
  30.     plot.plot(arr_2, func_with_sqrt(arr_2), 'k--')
  31.     plot.title('with sqrt func')
  32.     plot.grid(True)
  33.  
  34.     plot.subplots_adjust(top=0.9, bottom=0.08, left=0.10, right=0.95, hspace=0.35,
  35.                         wspace=0.35)
  36.  
  37.     plot.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement