Skip to content

Commit e9b5bd2

Browse files
committed
01-setup.md really needs to be index.md!
1 parent e2f1668 commit e9b5bd2

3 files changed

Lines changed: 21 additions & 36 deletions

File tree

docs/02-basics.md

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -229,48 +229,33 @@ np.std(v)
229229
2. Compute its mean and standard deviation.
230230
3. Try the same with a Python list. What happens?
231231

232-
---
233-
234-
## Mathematical background
235-
236-
For a vector with values:
237-
238-
\[
239-
x_1, x_2, x_3, \dots, x_n
240-
\]
241-
242-
### Mean
243-
244-
The **mean** (average) is:
245232

246-
\[
247-
\mu = \frac{1}{n} \sum_{i=1}^{n} x_i
248-
\]
233+
Steps:
234+
1. Subtract the mean from each value
235+
2. Square the differences
236+
3. Compute the mean of those squared differences
237+
4. Take the square root
249238

250-
This means:
251-
- Add up all values
252-
- Divide by the number of values
253239

254-
---
240+
??? exercise "Solution"
241+
```python
242+
import numpy as np
255243

256-
### Standard deviation
244+
# 1. Create vector
245+
v = np.arange(0, 101, 10)
246+
v
257247

258-
The **standard deviation** measures how much the values vary around the mean.
248+
# 2. Mean and standard deviation
249+
np.mean(v)
250+
np.std(v)
259251

260-
Population standard deviation:
252+
# 3. Try the same with a Python list
253+
lst = list(range(0, 101, 10))
261254

262-
\[
263-
\sigma = \sqrt{
264-
\frac{1}{n}
265-
\sum_{i=1}^{n} (x_i - \mu)^2
266-
}
267-
\]
268-
269-
Steps:
270-
1. Subtract the mean from each value
271-
2. Square the differences
272-
3. Compute the mean of those squared differences
273-
4. Take the square root
255+
# This will fail:
256+
np.mean(lst)
257+
np.std(lst)
258+
```
274259

275260
---
276261

File renamed without changes.

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ site_name: Python programming I
22
theme:
33
name: material
44
nav:
5-
- Setup: 01-intro.md
5+
- Setup: index.md
66
- Basics: 02-basics.md
77
- Plotting: 03-plotting.md
88
- DataFrames: 04-dataframes.md

0 commit comments

Comments
 (0)