Skip to content

Commit 5fd6bef

Browse files
committed
Version fixes
1 parent 53235bc commit 5fd6bef

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

notebook/Python-1.ipynb

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"#Introduction to Python programming.\n",
8-
"###[Gerard Gorman](http://www.imperial.ac.uk/people/g.gorman), [Christian Jacobs](http://www.imperial.ac.uk/people/c.jacobs10)"
7+
"# Introduction to Python programming.\n",
8+
"\n",
9+
"### [Gerard Gorman](http://www.imperial.ac.uk/people/g.gorman), [Christian Jacobs](http://www.imperial.ac.uk/people/c.jacobs10)"
910
]
1011
},
1112
{
1213
"cell_type": "markdown",
1314
"metadata": {},
1415
"source": [
15-
"#Lecture 1: Computing with formulas\n",
16+
"# Lecture 1: Computing with formulas\n",
1617
"\n",
17-
"##Learning objectives:\n",
18+
"## Learning objectives:\n",
1819
"\n",
1920
"* Execute a Python statement from within IPython.\n",
2021
"* Learn what a program variable is and how to express a mathematical expression in code.\n",
@@ -132,7 +133,7 @@
132133
"cell_type": "markdown",
133134
"metadata": {},
134135
"source": [
135-
"##Storing numbers in variables\n",
136+
"## Storing numbers in variables\n",
136137
"From mathematics you are already familiar with variables (e.g. $v_0=5,\\quad g=9.81,\\quad t=0.6,\\quad y = v_0t -{1\\over2}gt^2$) and you already know how important they are for working out complicated problems. Similarly, you can use variables in a program to make it easier to read and understand."
137138
]
138139
},
@@ -210,7 +211,7 @@
210211
"cell_type": "markdown",
211212
"metadata": {},
212213
"source": [
213-
"##Adding comments to code\n",
214+
"## Adding comments to code\n",
214215
"\n",
215216
"Not everything written in a computer program is intended for execution. In Python anything on a line after the '#' character is ignored and is known as a **comment**. You can write whatever you want in a comment. Comments are intended to be used to explain what a snippet of code is intended for. It might for example explain the objective or provide a reference to the data or algorithm used. This is both useful for you when you have to understand your code at some later stage, and indeed for whoever has to read and understand your code later."
216217
]
@@ -243,7 +244,7 @@
243244
"cell_type": "markdown",
244245
"metadata": {},
245246
"source": [
246-
"## <span style=\"color:blue\">Exercise: Convert from meters to British length units</span>\n",
247+
"## <span style=\"color:blue\">Exercise: Convert from meters to Imperial length units</span>\n",
247248
"Make a program where you set a length given in meters and then compute and write out the corresponding length measured in inches, in feet, in yards, and in miles. Use the fact that one inch is 2.54 cm, one foot is 12 inches, one yard is 3 feet, and one British mile is 1760 yards. As a verification, a length of 640 meters corresponds to 25196.85 inches, 2099.74 feet, 699.91 yards, or 0.3977 miles."
248249
]
249250
},
@@ -260,7 +261,7 @@
260261
"cell_type": "markdown",
261262
"metadata": {},
262263
"source": [
263-
"##Formatted printing style\n",
264+
"## Formatted printing style\n",
264265
"Often we want to print out results using a combination of text and numbers, e.g. \"'At t=0.6 s, y is 1.23 m'\". Particularly when printing out floating point numbers we should **never** quote numbers to a higher accuracy than they were measured. Python provides a *printf formatting* syntax exactly for this purpose. We can see in the following example that the *slot* `%g` was used to express the floating point number with the minimum number of significant figures, and the *slot* `%.2f` specified that only two digits are printed out after the decimal point."
265266
]
266267
},
@@ -344,7 +345,7 @@
344345
"cell_type": "markdown",
345346
"metadata": {},
346347
"source": [
347-
"##Integer division\n",
348+
"## Integer division\n",
348349
"For a bit of variation let's consider a new formula - temperature conversion. Given $C$ as a temperature in degrees Celsius, compute the corresponding temperature in degrees Fahrenheit $F$:\n",
349350
"$$ F = {9\\over5}C + 32 $$\n",
350351
"We implement this here as:"
@@ -409,7 +410,7 @@
409410
"cell_type": "markdown",
410411
"metadata": {},
411412
"source": [
412-
"##How are arithmetic expressions evaluated?\n",
413+
"## How are arithmetic expressions evaluated?\n",
413414
"Consider the random mathematical expression, ${5\\over9} + 2a^4/2$, implemented in Python as `5.0/9 + 2*a**4/2`.\n",
414415
"\n",
415416
"The rules for evaluating the expression are the same as in mathematics: proceed term by term (additions/subtractions) from the left, compute powers first, then multiplication and division. Therefore in this example the order of evaluation will be:\n",
@@ -444,7 +445,7 @@
444445
"cell_type": "markdown",
445446
"metadata": {},
446447
"source": [
447-
"##Standard mathematical functions\n",
448+
"## Standard mathematical functions\n",
448449
"What if we need to compute $\\sin x$, $\\cos x$, $\\ln x$, etc. in a program? Such functions are available in Python's *math module*. In fact there is a vast universe of functionality for Python available in modules. We just *import* in whatever we need for the task at hand.\n",
449450
"\n",
450451
"In this example we compute $\\sqrt{2}$ using the *sqrt* function in the *math* module:"

0 commit comments

Comments
 (0)