From 1953827acc060365c8aae6d755ea47fe5dcebbe2 Mon Sep 17 00:00:00 2001 From: Carlos Campos <108503954+CbNx1104@users.noreply.github.com> Date: Tue, 2 Jul 2024 23:16:45 -0400 Subject: [PATCH] Update calculus-derivatives-with-python.ipynb In the lesson, there is a graph showing "Another function and its Derivative", but when opened in collab and clicked "execute all" it doesn't shows the graph that is in the lesson but the same graph as the previous part just closer (in other interval of x). So i proposed another function and its derivative declared previous to the graph so it really shows "Another function and its Derivative" and not the same function in the previous example. --- calculus-derivatives-with-python.ipynb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/calculus-derivatives-with-python.ipynb b/calculus-derivatives-with-python.ipynb index bfffcaa..65061cf 100644 --- a/calculus-derivatives-with-python.ipynb +++ b/calculus-derivatives-with-python.ipynb @@ -285,7 +285,12 @@ } ], "source": [ - "x = np.linspace(-5, 2, 1000)\n", + "x = np.linspace(-4, 2, 1000)\n" + "def f(x):\n", + " return -x**5 - 2*x**4 + 19*x**3 + 32*x**2 - 48*x", + "def df(x):\n", + " h = 0.000001\n", + " return (f(x + h) - f(x))/h" "plt.plot(x, f(x), label = '$f(x)$')\n", "plt.plot(x, df(x), label = '$f\\'(x)$')\n", "plt.axhline(color = 'black')\n",