Book Image

Mastering SciPy

By : Francisco Javier Blanco-Silva, Francisco Javier B Silva
Book Image

Mastering SciPy

By: Francisco Javier Blanco-Silva, Francisco Javier B Silva

Overview of this book

Table of Contents (16 chapters)
Mastering SciPy
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 5. Initial Value Problems for Ordinary Differential Equations

Initial value problems for ordinary differential equations (or systems) hardly need any motivation. They arise naturally in almost all sciences. In this chapter, we will focus on mastering numerical methods to solve these equations.

Throughout the chapter, we will explore all the techniques implemented in the SciPy stack through three common examples:

  • The trivial differential equation of the first order y'(t) = y(t) with the initial condition as y(0) = 1. The actual solution is y(t) = et.

  • A more complex differential equation of first order: a Bernoulli equation ty'(t) + 6y(t) = 3ty(t)3/4, with the initial condition y(1) = 1. The actual solution is y(t) = (3t5/2 + 7)4/(10000t6).

  • To illustrate the behavior with autonomous systems (where the derivatives do not depend on the time variable), we use a Lotka-Volterra model for one predator and one prey, y0'(t) = y0(t) – 0.1 y0(t) y1(t) and y1'(t) = –1.5 y1(t) + 0.075 y0(t) y1(t...