Neural Networks, Gradient Descent.
import matplotlib.pyplot as plt # Define the function g(x) and its derivative dg(x) def g(x): return (x**2 - 16) def dg(x): return 2*x # Gradient descent algorithm def gradient_descent(dg, x_start, learning_rate, tol=1e-6, max_iter=1000): x = x_start xs = [x] for _ in range(max_iter): grad = dg(x)