You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
527 B

'''
Author: SJ2050
Date: 2021-10-29 19:51:52
LastEditTime: 2021-10-29 19:55:28
Version: v0.0.1
Description: Solution for homework2.2.
Copyright © 2021 SJ2050
'''
import numpy as np
from matplotlib import pyplot as plt
if __name__ == '__main__':
y_func = lambda x: np.sin(x-2)**2*np.exp(-x**2)
xs = np.linspace(0, 2)
ys = np.array([y_func(x) for x in xs])
plt.plot(xs, ys, color='blue')
plt.xlabel('x label')
plt.ylabel('y label')
plt.title('$sin^2(x-2)e^{-x^2}$')
plt.show()