|
333 | 333 | "cell_type":"markdown", |
334 | 334 | "metadata": {}, |
335 | 335 | "source": [ |
336 | | -"Write a function that takes an initial angle, $\\theta_0$, and integrates the system and returns the solution. For the parameters that are part of the `rhs()` function, you'll need to use the `set_f_params()` method.\n", |
| 336 | +"Write a function that takes an initial angle, $\\theta_0$, and integrates the system and returns the solution.\n", |
| 337 | +"\n", |
| 338 | +"Note, the righthand side function, `rhs`, takes additional arguments that you need to pass through the integrator. The preferred method to do this with the `solve_ivp()` interface appears to be to use `functools.partial()`, as:\n", |
| 339 | +"```\n", |
| 340 | +"from functools import partial\n", |
| 341 | +"\n", |
| 342 | +"r = solve_ivp(partial(rhs, q=q, omega_d=omega_d, b=b), ...)\n", |
| 343 | +"```\n", |
337 | 344 | "\n", |
338 | 345 | "Some values of $b$ will show very non-periodic behavior. To see chaos, integrate two different pendula that are the same except for $\\theta_0$, with only a small difference between then (like 60 degrees and 60.0001 degrees. You'll see the solutions track for a while, but then diverge." |
339 | 346 | ] |
|