1

I tried to solve a differential equation using lib odient in python, and this is what I wrote in gedit editor:

# -*- coding: utf-8  -*-
from __future__ import division 
from scipy.integrate import odeint
import matplotlib.pyplot as plt
import numpy as np
def phi(y,t):
    return 1.5*y*(1-y/6)

y0 = 1.0
t =np.linspace(0,5,201)
sol = odeint(phi,y0,t)

plt.plot(t,sol)
plt.show()

and everytime I try to execute it in terminal, here's what I get: ImportError: No module named integrate

but when I try execute it using Ipython everything goes normal, here's a screenshot: pic2

can you please help me? thanks.

9000
  • 39,899
  • 9
  • 66
  • 104
walidking
  • 19
  • 2

1 Answers1

0

You may be missing scipy module.

Please Install it first.

$ sudo pip2 install scipy

I managed to run your program after installing additional requirement

$ sudo pip2 install matplotlib
$ sudo apt install python-tk 
pinkal vansia
  • 10,240
  • 5
  • 49
  • 62