Skip to content

Commit 3079ead

Browse files
committed
Added mixed integer linear programming information and other minor changes
1 parent da311ea commit 3079ead

File tree

5 files changed

+395
-22
lines changed

5 files changed

+395
-22
lines changed

Intro-to-Python/00.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
{
3838
"cell_type": "code",
39-
"execution_count": 1,
39+
"execution_count": 2,
4040
"metadata": {
4141
"collapsed": false
4242
},
@@ -45,12 +45,12 @@
4545
"name": "stdout",
4646
"output_type": "stream",
4747
"text": [
48-
"The sum of ∑_i∈N i*i = 100\n"
48+
"The sum of ∑_i∈N i*i = 164\n"
4949
]
5050
}
5151
],
5252
"source": [
53-
"N={1,3,4,5,7}\n",
53+
"N={1,3,4,5,7,8}\n",
5454
"print('The sum of ∑_i∈N i*i =',sum( i**2 for i in N ) )"
5555
]
5656
},
@@ -71,7 +71,7 @@
7171
"* [06](06.ipynb) Functions\n",
7272
"* [07](07.ipynb) Classes and basic object oriented programming\n",
7373
"* [08](08.ipynb) Scipy: libraries for arrays (matrices) and plotting\n",
74-
"* [09](09.ipynb) Introduction to solving linear programs with python\n",
74+
"* [09](09.ipynb) Mixed Integer Linear Programming using the mymip library.\n",
7575
"\n",
7676
"This is a tutorial style introduction to Python. For a quick reminder / summary of Python syntax the following [Quick Reference Card](http://www.cs.put.poznan.pl/csobaniec/software/python/py-qrc.html) may be useful. A longer and more detailed tutorial style introduction to python is available from the python site at: https://docs.python.org/3/tutorial/\n"
7777
]
@@ -83,14 +83,14 @@
8383
"## Installation\n",
8484
"\n",
8585
"### Loging into the web server\n",
86-
"The easiest way to run this and other notebooks for staff and students at Monash University is to log into the Jupyter server at [https://sci-web17-v01.ocio.monash.edu.au/hub]. The steps for running notebooks are:\n",
86+
"The easiest way to run this and other notebooks for staff and students at Monash University is to log into the Jupyter server at [https://sci-web17-v01.ocio.monash.edu.au/hub](https://sci-web17-v01.ocio.monash.edu.au/hub). The steps for running notebooks are:\n",
8787
"* Log in using your monash email address. The first time you log in an empty account will automatically be set up for you.\n",
8888
"* Press the start button (if prompted by the system)\n",
8989
"* Use the menu of the jupyter system to upload a .ipynb python notebook file or to start a new notebook.\n",
9090
"\n",
9191
"### Installing \n",
9292
"\n",
93-
"Python runs on windows, linux, mac and other environments. There are many python distributions available. However the recommended way to install python under Microsoft Windows or Linux is to use the Anaconda distribution available at [https://www.continuum.io/downloads]. Make sure to get the Python *3.5* version, not 2.7. This distribution comes with the [SciPy](https://www.scipy.org/) collection of scientific python tools as well as the iron python notebook. For developing python code without notebooks consider using [spyder](https://github.com/spyder-ide/spyder) (also included with Anaconda)\n",
93+
"Python runs on windows, linux, mac and other environments. There are many python distributions available. However the recommended way to install python under Microsoft Windows or Linux is to use the Anaconda distribution available at [https://www.continuum.io/downloads](https://www.continuum.io/downloads). Make sure to get the Python *3.5* version, not 2.7. This distribution comes with the [SciPy](https://www.scipy.org/) collection of scientific python tools as well as the iron python notebook. For developing python code without notebooks consider using [spyder](https://github.com/spyder-ide/spyder) (also included with Anaconda)\n",
9494
"\n",
9595
"To open a notebook with anaconda installed, from the terminal run:\n",
9696
"\n",
@@ -139,7 +139,7 @@
139139
"name": "python",
140140
"nbconvert_exporter": "python",
141141
"pygments_lexer": "ipython3",
142-
"version": "3.5.1"
142+
"version": "3.5.2"
143143
}
144144
},
145145
"nbformat": 4,

Intro-to-Python/01.ipynb

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,258 @@
9191
"\"modules\", \"keywords\", \"symbols\", or \"topics\". Each module also comes\n",
9292
"with a one-line summary of what it does; to list the modules whose name\n",
9393
"or summary contain a given string such as \"spam\", type \"modules spam\".\n",
94+
"\n",
95+
"help> keywords\n",
96+
"\n",
97+
"Here is a list of the Python keywords. Enter any keyword to get more help.\n",
98+
"\n",
99+
"False def if raise\n",
100+
"None del import return\n",
101+
"True elif in try\n",
102+
"and else is while\n",
103+
"as except lambda with\n",
104+
"assert finally nonlocal yield\n",
105+
"break for not \n",
106+
"class from or \n",
107+
"continue global pass \n",
108+
"\n",
109+
"help> False\n",
110+
"Help on bool object:\n",
111+
"\n",
112+
"class bool(int)\n",
113+
" | bool(x) -> bool\n",
114+
" | \n",
115+
" | Returns True when the argument x is true, False otherwise.\n",
116+
" | The builtins True and False are the only two instances of the class bool.\n",
117+
" | The class bool is a subclass of the class int, and cannot be subclassed.\n",
118+
" | \n",
119+
" | Method resolution order:\n",
120+
" | bool\n",
121+
" | int\n",
122+
" | object\n",
123+
" | \n",
124+
" | Methods defined here:\n",
125+
" | \n",
126+
" | __and__(self, value, /)\n",
127+
" | Return self&value.\n",
128+
" | \n",
129+
" | __new__(*args, **kwargs) from builtins.type\n",
130+
" | Create and return a new object. See help(type) for accurate signature.\n",
131+
" | \n",
132+
" | __or__(self, value, /)\n",
133+
" | Return self|value.\n",
134+
" | \n",
135+
" | __rand__(self, value, /)\n",
136+
" | Return value&self.\n",
137+
" | \n",
138+
" | __repr__(self, /)\n",
139+
" | Return repr(self).\n",
140+
" | \n",
141+
" | __ror__(self, value, /)\n",
142+
" | Return value|self.\n",
143+
" | \n",
144+
" | __rxor__(self, value, /)\n",
145+
" | Return value^self.\n",
146+
" | \n",
147+
" | __str__(self, /)\n",
148+
" | Return str(self).\n",
149+
" | \n",
150+
" | __xor__(self, value, /)\n",
151+
" | Return self^value.\n",
152+
" | \n",
153+
" | ----------------------------------------------------------------------\n",
154+
" | Methods inherited from int:\n",
155+
" | \n",
156+
" | __abs__(self, /)\n",
157+
" | abs(self)\n",
158+
" | \n",
159+
" | __add__(self, value, /)\n",
160+
" | Return self+value.\n",
161+
" | \n",
162+
" | __bool__(self, /)\n",
163+
" | self != 0\n",
164+
" | \n",
165+
" | __ceil__(...)\n",
166+
" | Ceiling of an Integral returns itself.\n",
167+
" | \n",
168+
" | __divmod__(self, value, /)\n",
169+
" | Return divmod(self, value).\n",
170+
" | \n",
171+
" | __eq__(self, value, /)\n",
172+
" | Return self==value.\n",
173+
" | \n",
174+
" | __float__(self, /)\n",
175+
" | float(self)\n",
176+
" | \n",
177+
" | __floor__(...)\n",
178+
" | Flooring an Integral returns itself.\n",
179+
" | \n",
180+
" | __floordiv__(self, value, /)\n",
181+
" | Return self//value.\n",
182+
" | \n",
183+
" | __format__(...)\n",
184+
" | default object formatter\n",
185+
" | \n",
186+
" | __ge__(self, value, /)\n",
187+
" | Return self>=value.\n",
188+
" | \n",
189+
" | __getattribute__(self, name, /)\n",
190+
" | Return getattr(self, name).\n",
191+
" | \n",
192+
" | __getnewargs__(...)\n",
193+
" | \n",
194+
" | __gt__(self, value, /)\n",
195+
" | Return self>value.\n",
196+
" | \n",
197+
" | __hash__(self, /)\n",
198+
" | Return hash(self).\n",
199+
" | \n",
200+
" | __index__(self, /)\n",
201+
" | Return self converted to an integer, if self is suitable for use as an index into a list.\n",
202+
" | \n",
203+
" | __int__(self, /)\n",
204+
" | int(self)\n",
205+
" | \n",
206+
" | __invert__(self, /)\n",
207+
" | ~self\n",
208+
" | \n",
209+
" | __le__(self, value, /)\n",
210+
" | Return self<=value.\n",
211+
" | \n",
212+
" | __lshift__(self, value, /)\n",
213+
" | Return self<<value.\n",
214+
" | \n",
215+
" | __lt__(self, value, /)\n",
216+
" | Return self<value.\n",
217+
" | \n",
218+
" | __mod__(self, value, /)\n",
219+
" | Return self%value.\n",
220+
" | \n",
221+
" | __mul__(self, value, /)\n",
222+
" | Return self*value.\n",
223+
" | \n",
224+
" | __ne__(self, value, /)\n",
225+
" | Return self!=value.\n",
226+
" | \n",
227+
" | __neg__(self, /)\n",
228+
" | -self\n",
229+
" | \n",
230+
" | __pos__(self, /)\n",
231+
" | +self\n",
232+
" | \n",
233+
" | __pow__(self, value, mod=None, /)\n",
234+
" | Return pow(self, value, mod).\n",
235+
" | \n",
236+
" | __radd__(self, value, /)\n",
237+
" | Return value+self.\n",
238+
" | \n",
239+
" | __rdivmod__(self, value, /)\n",
240+
" | Return divmod(value, self).\n",
241+
" | \n",
242+
" | __rfloordiv__(self, value, /)\n",
243+
" | Return value//self.\n",
244+
" | \n",
245+
" | __rlshift__(self, value, /)\n",
246+
" | Return value<<self.\n",
247+
" | \n",
248+
" | __rmod__(self, value, /)\n",
249+
" | Return value%self.\n",
250+
" | \n",
251+
" | __rmul__(self, value, /)\n",
252+
" | Return value*self.\n",
253+
" | \n",
254+
" | __round__(...)\n",
255+
" | Rounding an Integral returns itself.\n",
256+
" | Rounding with an ndigits argument also returns an integer.\n",
257+
" | \n",
258+
" | __rpow__(self, value, mod=None, /)\n",
259+
" | Return pow(value, self, mod).\n",
260+
" | \n",
261+
" | __rrshift__(self, value, /)\n",
262+
" | Return value>>self.\n",
263+
" | \n",
264+
" | __rshift__(self, value, /)\n",
265+
" | Return self>>value.\n",
266+
" | \n",
267+
" | __rsub__(self, value, /)\n",
268+
" | Return value-self.\n",
269+
" | \n",
270+
" | __rtruediv__(self, value, /)\n",
271+
" | Return value/self.\n",
272+
" | \n",
273+
" | __sizeof__(...)\n",
274+
" | Returns size in memory, in bytes\n",
275+
" | \n",
276+
" | __sub__(self, value, /)\n",
277+
" | Return self-value.\n",
278+
" | \n",
279+
" | __truediv__(self, value, /)\n",
280+
" | Return self/value.\n",
281+
" | \n",
282+
" | __trunc__(...)\n",
283+
" | Truncating an Integral returns itself.\n",
284+
" | \n",
285+
" | bit_length(...)\n",
286+
" | int.bit_length() -> int\n",
287+
" | \n",
288+
" | Number of bits necessary to represent self in binary.\n",
289+
" | >>> bin(37)\n",
290+
" | '0b100101'\n",
291+
" | >>> (37).bit_length()\n",
292+
" | 6\n",
293+
" | \n",
294+
" | conjugate(...)\n",
295+
" | Returns self, the complex conjugate of any int.\n",
296+
" | \n",
297+
" | from_bytes(...) from builtins.type\n",
298+
" | int.from_bytes(bytes, byteorder, *, signed=False) -> int\n",
299+
" | \n",
300+
" | Return the integer represented by the given array of bytes.\n",
301+
" | \n",
302+
" | The bytes argument must be a bytes-like object (e.g. bytes or bytearray).\n",
303+
" | \n",
304+
" | The byteorder argument determines the byte order used to represent the\n",
305+
" | integer. If byteorder is 'big', the most significant byte is at the\n",
306+
" | beginning of the byte array. If byteorder is 'little', the most\n",
307+
" | significant byte is at the end of the byte array. To request the native\n",
308+
" | byte order of the host system, use `sys.byteorder' as the byte order value.\n",
309+
" | \n",
310+
" | The signed keyword-only argument indicates whether two's complement is\n",
311+
" | used to represent the integer.\n",
312+
" | \n",
313+
" | to_bytes(...)\n",
314+
" | int.to_bytes(length, byteorder, *, signed=False) -> bytes\n",
315+
" | \n",
316+
" | Return an array of bytes representing an integer.\n",
317+
" | \n",
318+
" | The integer is represented using length bytes. An OverflowError is\n",
319+
" | raised if the integer is not representable with the given number of\n",
320+
" | bytes.\n",
321+
" | \n",
322+
" | The byteorder argument determines the byte order used to represent the\n",
323+
" | integer. If byteorder is 'big', the most significant byte is at the\n",
324+
" | beginning of the byte array. If byteorder is 'little', the most\n",
325+
" | significant byte is at the end of the byte array. To request the native\n",
326+
" | byte order of the host system, use `sys.byteorder' as the byte order value.\n",
327+
" | \n",
328+
" | The signed keyword-only argument determines whether two's complement is\n",
329+
" | used to represent the integer. If signed is False and a negative integer\n",
330+
" | is given, an OverflowError is raised.\n",
331+
" | \n",
332+
" | ----------------------------------------------------------------------\n",
333+
" | Data descriptors inherited from int:\n",
334+
" | \n",
335+
" | denominator\n",
336+
" | the denominator of a rational number in lowest terms\n",
337+
" | \n",
338+
" | imag\n",
339+
" | the imaginary part of a complex number\n",
340+
" | \n",
341+
" | numerator\n",
342+
" | the numerator of a rational number in lowest terms\n",
343+
" | \n",
344+
" | real\n",
345+
" | the real part of a complex number\n",
94346
"\n"
95347
]
96348
}

Intro-to-Python/08.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"source": [
3535
"The numpy supports arrays and matrices with many of the features that would be familiar to matlab users. See here quick summary of [numpy for matlab users](https://docs.scipy.org/doc/numpy-dev/user/numpy-for-matlab-users.html).\n",
3636
"\n",
37-
"Appart from the convenience, the numpy methods are also much faster at performing operations on matrices or arrays than performing arithmetic with numbers stored in lists. "
37+
"Appart from the convenience, the numpy methods are also much faster at performing operations on matrices or arrays than performing arithmetic with numbers stored in lists. \n"
3838
]
3939
},
4040
{
@@ -328,7 +328,7 @@
328328
"name": "python",
329329
"nbconvert_exporter": "python",
330330
"pygments_lexer": "ipython3",
331-
"version": "3.5.1"
331+
"version": "3.5.2"
332332
}
333333
},
334334
"nbformat": 4,

0 commit comments

Comments
 (0)