From c280563332fb6b6c9309d89a3927e1808005eae9 Mon Sep 17 00:00:00 2001 From: konrad-gerlach <58958090+konrad-gerlach@users.noreply.github.com> Date: Sun, 15 Jun 2025 15:51:31 +0200 Subject: [PATCH] Update convexity.py f''(x)=(f'(x+h)-f'(x))/h = ((f(x+2h)-f(x+h))/h - (f(x+h)-f(x))/h)/h = (f(x+2h)-2f(x+h)+f(x))/h^2 --- week7/convexity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/week7/convexity.py b/week7/convexity.py index 5e3c6bc..71202e9 100644 --- a/week7/convexity.py +++ b/week7/convexity.py @@ -39,7 +39,7 @@ def plot_with_secant(f, name): def second_derivative(f, x, h=1e-4): try: - return (f(x + h) - 2 * f(x) + f(x - h)) / (h ** 2) + return (f(x + 2*h) - 2 * f(x+h) + f(x)) / (h ** 2) except: return None