![]() |
In this post, we are going to learn how to solve differential equations with odeint function of scipy module in Python. ODE stands for Ordinary Differential Equation and refers to those kinds of differential equations that involve derivatives but no partial derivatives. In other words, we only consider one independent variable in these equations. So, in this article we have used scipy, NumPy, and Matplotlib modules of python which you can install with the following command: pip install scipy numpy matplotlib The syntax of odeint functions is as follows:
A lot more other parameters are there which you can check out in the documentation but these three parameters are the main ones. Solving Differential EquationsNow let us solve some ODE with the help of the odeint function. Example 1:![]() Ordinary Differential Equation Python3
Output: ![]() Graph for the solution of ODE Example 2:![]() Ordinary Differential Equation Python3
Output: ![]() Graph for the solution of ODE Example 3:![]() Ordinary Differential Equation Let us try giving multiple initial conditions by making y0 an array. Python3
Output: ![]() Graph for the solution of ODE |
Reffered: https://www.geeksforgeeks.org
Python |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 8 |