<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://nemenmanlab.org/~ilya/index.php?action=history&amp;feed=atom&amp;title=Physics_212%2C_2017%3A_Lecture_7</id>
	<title>Physics 212, 2017: Lecture 7 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://nemenmanlab.org/~ilya/index.php?action=history&amp;feed=atom&amp;title=Physics_212%2C_2017%3A_Lecture_7"/>
	<link rel="alternate" type="text/html" href="https://nemenmanlab.org/~ilya/index.php?title=Physics_212,_2017:_Lecture_7&amp;action=history"/>
	<updated>2026-05-17T09:39:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://nemenmanlab.org/~ilya/index.php?title=Physics_212,_2017:_Lecture_7&amp;diff=677&amp;oldid=prev</id>
		<title>Ilya: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://nemenmanlab.org/~ilya/index.php?title=Physics_212,_2017:_Lecture_7&amp;diff=677&amp;oldid=prev"/>
		<updated>2018-07-04T16:28:44Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 16:28, 4 July 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Ilya</name></author>
		
	</entry>
	<entry>
		<id>https://nemenmanlab.org/~ilya/index.php?title=Physics_212,_2017:_Lecture_7&amp;diff=676&amp;oldid=prev</id>
		<title>nemenman&gt;Ilya at 13:51, 21 February 2017</title>
		<link rel="alternate" type="text/html" href="https://nemenmanlab.org/~ilya/index.php?title=Physics_212,_2017:_Lecture_7&amp;diff=676&amp;oldid=prev"/>
		<updated>2017-02-21T13:51:50Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{PHYS212-2017}}&lt;br /&gt;
&lt;br /&gt;
Here we start a new module, where we will explore how to model and solve dynamical systems in more detail. In this lecture we discussed a few important concepts in programming, some specific to Python, and some not. &lt;br /&gt;
&lt;br /&gt;
# We discussed the importance of encapsulating the code that you use repeatedly into either a script or a function.&lt;br /&gt;
# We discussed the difference between scripts (no inputs and no outputs) and functions (have inputs and outputs). &lt;br /&gt;
# We did the book section 5.1 -- Writing your own functions, and we wrote our first functions -- various growth rates for bacterial growth and solvers of the corresponding differential equations.&lt;br /&gt;
# We started talking about variable types, and importance of type checking, and how Python figures out which type is a variable that has been passed to a function; we will return to this later. &lt;br /&gt;
# We wrote our own loadable modules, and discussed the important of using the reload function.&lt;br /&gt;
# Finally, we discussed some common coding mistakes that we all do when working with python, and specifically:&lt;br /&gt;
:# Appending list or arrays instead of pre-allocating arrays -- appending arrays causes creation of new arrays, and then copying numbers, which takes time.&lt;br /&gt;
:# Doing loops instead of vectorizing your math and operating on arrays -- doing loops causes Python to do type checking of variables at every step of the way, which is costly.&lt;br /&gt;
# Finally, we talked about &amp;lt;math&amp;gt;O(dt^n)&amp;lt;/math&amp;gt; notation, and we saw, by writing the scripts that I have uploaded below that the simple Euler method of solving differential equations has an error of &amp;lt;math&amp;gt;O(dt)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Scripts for this Module:&lt;br /&gt;
::[[media:GrowthFunctions_v2.txt | GrowthFunctions]] -- module defining different growth functions.&lt;br /&gt;
::[[media:Integrators_v2.txt | Integrators]] -- module defining different integrators (Euler and Runge-Kutta second order).&lt;br /&gt;
::[[media:Module2_v2.txt | Module 2]] -- catch-all scripts I used during the class.&lt;br /&gt;
&lt;br /&gt;
I also asked you to show that the numerical error is dependent largely (but not fully) on the solving method, not the equation being solved. For this you needed to define a different growth function, solvee the growth equation, and  [https://docs.google.com/forms/d/e/1FAIpQLSeNvrPddCgvMfHdlSA8uYDddBFqLK81Rrr4l7jfozud6J7iww/viewform submit your work].&lt;/div&gt;</summary>
		<author><name>nemenman&gt;Ilya</name></author>
		
	</entry>
</feed>