
python program
python program
第1 version 確認
python3 -v
Python 3.12.2
第2
あ)programa1
import numpy as np
import matplotlib.pyplot as plt
def normal(x, mu=0, sigma=1):
y = 1 / (np.sqrt(2 * np.pi) * sigma) * np.exp(-(x - mu)2 / (2 * sigma2))
return y
x = np.linspace(-5, 5, 100)
y = normal(x)
plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('y')
plt.show()
関数の定義
い)program2
import numpy as np
import matplotlib.pyplot as plt
def normal(x, mu=0, sigma=1):
y = 1 / (np.sqrt(2 * np.pi) * sigma) * np.exp(-(x - mu)2 / (2 * sigma2))
return y
x = np.linspace(-10, 10, 1000)
mu ====================
y0 = normal(x, mu=-3)
y1 = normal(x, mu=0)
y2 = normal(x, mu=5)
plt.plot(x, y0, label='$\mu$=-3')
plt.plot(x, y1, label='$\mu$=0')
plt.plot(x, y2, label='$\mu$=5')
plt.legend()
plt.xlabel('x')
plt.ylabel('y')
第3
python3 xxxx.py


第4結論
あ)python3の基礎の基礎
以上