|
@ -0,0 +1,10 @@ |
|
|
|
|
|
# Program 02b: The logistic equation; example 4-ch2. |
|
|
|
|
|
from sympy import dsolve, Eq, Function, symbols, pprint |
|
|
|
|
|
t, b, d = symbols('t beta sigma') |
|
|
|
|
|
P = symbols('P', cls=Function) |
|
|
|
|
|
dPdt = P(t).diff(t) |
|
|
|
|
|
de = Eq(dPdt, P(t)*(b-d*P(t))) |
|
|
|
|
|
print('program 02b:\n') |
|
|
|
|
|
pprint(de) |
|
|
|
|
|
sol = dsolve(de, P(t)) |
|
|
|
|
|
pprint(sol) |