diff --git a/Week 5/9 Ordinary Differential Equations.ipynb b/Week 5/9 Ordinary Differential Equations.ipynb index c9eee81..4866df5 100644 --- a/Week 5/9 Ordinary Differential Equations.ipynb +++ b/Week 5/9 Ordinary Differential Equations.ipynb @@ -139,21 +139,22 @@ "source": [ "def integrator(x, y0, f, phi):\n", " \"\"\"\n", - " Numerically solves the initial value problem given by ordinary differential equation\n", - " f(x, y) = y' with initial value y0 using the integration scheme provided by phi.\n", + " Numerically solves the initial value problem (IVP) given by ordinary differential\n", + " equation (ODE) f(x, y) = y' with initial value y0 using the integration scheme\n", + " provided by phi.\n", "\n", " Args:\n", " x: size n + 1 numerical array\n", " y0: an initial value to the function f\n", " f: a callable function with signature (x, y), with x and y the current state\n", - " of the system\n", + " of the system, and f such that f(x, y) = y' in the ODE\n", " phi: a callable function with signature (x, y, f, i), with x and y the current state\n", " of the system, i the step number, and f as above, representing the integration\n", " scheme to use\n", "\n", " Returns:\n", - " An n + 1 numerical array representing an approximate solution to y' = f(x, y)\n", - " given initial value y0 and steps from x\n", + " An n + 1 numerical array representing an approximate solution to y in y' = f(x, y)\n", + " given initial value y0, steps from x, and using integration scheme phi.\n", " \"\"\"\n", " \n", " eta = np.zeros(len(x))\n", @@ -187,20 +188,18 @@ "source": [ "def phi_euler(x, y, f, i):\n", " \"\"\"\n", - " Numerically solves the initial value problem given by ordinary differential equation\n", - " f(x, y) = y' with initial value y0 using the Euler method.\n", + " Returns the integrator phi = f(x, y) for the Euler method to solve the ODE\n", + " y' = f(x, y).\n", "\n", " Args:\n", - " x: a size n + 1 numerical array\n", - " y: a size n + 1 numerical array with y[0] the initial value corresponding to x[0]\n", + " x: current x value for f\n", + " y: current y value for f\n", " f: a callable function with signature (x, y), with x and y the current state\n", - " of the system\n", - " i: a callable function with signature (x, y, f, i), with x and y the current state\n", - " of the system, i the step number, and f as above\n", + " of the system, and f such that f(x, y) = y' in the ODE\n", + " i: the step number of the IVP solving algorithm (not used)\n", "\n", " Returns:\n", - " An n + 1 numerical array representing an approximate solution to y' = f(x, y)\n", - " given initial value y0 and steps from x\n", + " The integrator phi(x, y, f, i) = f(x, y).\n", " \"\"\"\n", " \n", " return f(x, y)\n", @@ -260,7 +259,7 @@ { "data": { "text/plain": [ - "[]" + "[]" ] }, "execution_count": 4,