Sigma ($ \ Sigma $): Sum of multiple numbers
import numpy as np
a = np.array([1, 2, 3, 4, 5])
print(np.sum(a))
Execution result
15
Napier number $ e $
This formula has a very convenient feature that the formula does not change even if it is differentiated.
import numpy as np
def get_exp(x):
return np.exp(x)
print(get_exp(1))
Execution result
2.718281828459045
↓ Please refer to the article I wrote earlier for graph display. #Python basics (#matplotlib)
import numpy as np
import matplotlib.pyplot as plt
def get_exp(x):
return np.exp(x)
x = np.linspace(-3, 3, num=100)
y = get_exp(x)
#Axis label
plt.xlabel("x val")
plt.ylabel("y val")
#axis
plt.axhline(0, color = "gray")
plt.axvline(0, color = "gray")
#plt.hlines(y=[0], colors='b', linestyles='dashed', linewidths=1)
#Graph title
plt.title("Graph Name")
#Specify plot legend and line style
plt.plot(x, y, label="y")
plt.legend() #Show legend
plt.show()
When
import numpy as np
def get_log(x):
return np.log(x)
print(get_log(1))
# 0.0
import numpy as np
import matplotlib.pyplot as plt
def get_log(x):
return np.log(x)
x = np.linspace(0.001, 3, num=1000)
y = get_log(x)
#Axis label
plt.xlabel("x val")
plt.ylabel("y val")
#axis
plt.axhline(0, color = "gray")
plt.axvline(0, color = "gray")
#Graph title
plt.title("Graph Name")
#Specify plot legend and line style
plt.plot(x, y, label="y")
plt.legend() #Show legend
plt.show()
Recommended Posts