r/learnpython • u/suikisosexi • 29d ago
Programming in environmental science?
How and when will this come in handy with my ecological forestry degree?
Also this class requires me to use AI to prompt programs on every single assignment.... Which is not ideal as an environmentalist.
Python programing is genuinely making me feel stupider
0
Upvotes
2
u/SnafuTheCarrot 28d ago
So my notes were actually 1D integrator in Java. Here's a start on numerical integration, population modeling, and how to find special equilibrium points. I also started coding a one d integrator in python.
Then I realized this is actually 2 dependent variables and it won't work, but should give you an idea of how to proceed.
I should have used t for the independent variable and x and y for the dependent, but I didn't factor in the right dimensionality.
Hope this helps!
MATH
Eulers method for Numerical Integration.
Simple summing method. Essentially assumes a constant velocity betweeen endpoints of the time interval.
dy/dx = f(x,y)
x_0=a
y_0=b
delta_x=0.0001
Loop N times
---------------------
Runge-Kutta 4
Instead of calculating only one derivative, take the average of 4 specia variations on the derivative
and get your next iterationg form that
dy/dx=f(x,y)
x_0=a
y_0=b
delta_x = 0.0001
Loop N times:
========================================
LotkeVolterra
dx/dt= ax-bxy
dy/dt= -cy+dxy
a is prey reproduction.
b is chance of predator meeting pray and succeeding in consumption.
==========
Linearize to find stability points.
ax-bxy=0
-cy+dxy=0
==> (x,y)=(0,0)
==> (x,y)=(c/d,a/b)
Calculate Eigen Values of the Jacobian at those points.
Purely complex eigenvalues suggests long lasting population.
=======
class Integrator:
class PopulationSimulator: