# Physics 212, 2017: Lectures 5, 6

Back to the main Teaching page.

In this lecture, we continue learning the basics of computational modeling and Python language using the simple linear (,malthusian) growth model.

## Finishing up from the previous lecture

explore how the solution spends on dt. Output results only when t is an integer.

## New Python constructions

• Objects -- mutable (arrays and lists) vs. immutable (numbers)
• Object attributes and object methods, using dir()
• Variables vs. objects
• Lists vs. Numpy arrays
• Why np.zeros((2,4)) and not np.zeros(2,4)?
• Creation, concatenation (stacking).
• Slicing -- doesn't create new arrays
• Flatten copies data, ravel and reshape does not
• Strings
• Loops
• Vector math is always faster than element-by-element math

## Our simplest model

A real environment won't have resources that are capable of supporting an infinite bacterial population. Thus as the population grows, the growth rate should decrease. The simplest assumption is that it decreases linearly ${\displaystyle r(n)=r_{0}-r_{1}n}$. This gives for the growth: ${\displaystyle {\frac {dn}{dt}}=(r_{0}-r_{1}n)n=r_{0}n\left(1-{\frac {n}{r_{0}/r_{1}}}\right)}$. Or, in other words, ${\displaystyle {\frac {dn}{dt}}=r_{0}n\left(1-{\frac {n}{N_{0}}}\right)}$, where ${\displaystyle N_{0}}$ is the carrying capacity -- the number of bacteria where there growth rate is equal to 0, and the population stabilizes.
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 4, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}