Skip to content

Commit caed688

Browse files
authored
Add explanation for odeint usage and output image
Added a brief explanation of the code and the usage of odeint, emphasizing its role in solving differential equations numerically. Included an output visualization as an image stored under the media folder in the docs directory for better understanding.
1 parent 6ae4c7e commit caed688

File tree

1 file changed

+6
-4
lines changed
  • content/scipy/concepts/scipy-integrate/terms/odeint

1 file changed

+6
-4
lines changed

content/scipy/concepts/scipy-integrate/terms/odeint/odeint.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,17 @@ plt.grid()
7070
plt.show()
7171
```
7272

73+
### Explanation
74+
75+
In the code, `odeint` is used to numerically solve the ODE \( \frac{dy}{dt} = -2y + 3 \) with an initial condition \( y(0) = 5 \). The `model` function defines the derivative, and `odeint` integrates this function over the specified time points, returning the solution as an array.
76+
7377
### Output
7478

7579
The plot shows the solution \( y(t) \) over time, illustrating the system's dynamics as it approaches a steady state.
7680

81+
![Output from above code](https://raw.githubusercontent.com/Codecademy/docs/main/media/odeint_solution_plot.png)
82+
7783
## Notes
7884

7985
- **`odeint()`** is ideal for many scientific and engineering applications due to its robustness and flexibility.
8086
- For more advanced control or alternative solvers, consider using **`scipy.integrate.solve_ivp()`**, which offers a more modern API.
81-
82-
## References
83-
84-
- [SciPy Documentation on `odeint`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.odeint.html)

0 commit comments

Comments
 (0)