• R/O
  • SSH

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

File Info

Rev. 647f7300fbc055886066d17c5278bf4481604e97
大小 722 字节
时间 2007-03-30 02:45:44
作者 iselllo
Log Message

I added the code Python-codes/ode5_solver_test.py which solves a system
of 2 coupled equations for a trivial prey-predator system. Something
along these lines could be used to study and solve numerically the eqs
for nucleation and accumulation mode presented in the paper by Vouitsis.

Content

#! /usr/bin/env python
from scipy import *
import pylab  # used to read the .csv file




#the purpose of this code is now to solve a system of 1st order ode's which are necessary for a prey-predator system


def population(y,t,a,b,c,p):
	
	return [a*y[0]-b*y[0]*y[1],-c*y[1]+p*y[0]*y[1]]
	

a=2.
b=1.e-1
c=1.e-1
p=1.e-2

y0_0=15.
y1_0=15.

y0 = [y0_0, y1_0]


t=arange(0.,100.,0.01)

print 't is', t

y = integrate.odeint(population, y0, t,args=(a,b,c,p),printmessg=1)




pylab.plot(t,y[:,0],t,y[:,1])
pylab.xlabel('Time')
pylab.ylabel('y(t)')
pylab.legend(('prey population','predator population'))
pylab.title('solution')
pylab.grid(True)
pylab.savefig('preyandpredator')

pylab.hold(False)





print 'So far so good'