In [1]:
import numpy as np
import matplotlib.pyplot as plt
In [2]:
x = np.linspace(-10, 10, 1000000)
In [21]:
f = lambda x: (4*x**2 + 12*x)/(x**2 + 4*x + 3)
In [22]:
def df(f, x):
fx = f(x)
df = np.diff(fx)
dx = np.diff(x)
dfx = df/dx
return dfx
In [23]:
fx = f(x)
dfx = df(f, x)
In [24]:
f(-2.99)
Out[24]:
In [33]:
plt.plot([-8, -6], [-1, 5], color = 'blue', label = '$f(x)$')
# plt.plot(x, fx, color = 'blue', label = '$f(x)$')
# plt.plot(x[:-1], dfx, color = 'red', label = '$df(x)$')
plt.legend()
plt.xlim([-10, 10])
plt.ylim([-10, 10])
plt.grid()
In [31]:
np.linalg.norm(np.cross([9, -2, 9], [2, 7, 1]))
Out[31]:
In [27]:
np.cross([9, -2, 9], [2, 7, 1])
Out[27]:
In [ ]: