Skip to content

Commit ff13b9a

Browse files
author
Adám Brudzewsky
authored
Add files via upload
1 parent 536398f commit ff13b9a

File tree

2 files changed

+722
-0
lines changed

2 files changed

+722
-0
lines changed

Notebooks/ArithMean.ipynb

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Arithmetic Mean\n",
8+
"The **arithmetic mean** is the sum of a *collection of numbers* divided by the count of numbers in the collection.\n",
9+
"\n",
10+
"Let's say we have the collection {3,1,4,1,5}."
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 1,
16+
"metadata": {},
17+
"outputs": [],
18+
"source": [
19+
"collection←3 1 4 1 5"
20+
]
21+
},
22+
{
23+
"cell_type": "markdown",
24+
"metadata": {},
25+
"source": [
26+
"To find the mean, we first find the sum."
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": 2,
32+
"metadata": {},
33+
"outputs": [],
34+
"source": [
35+
"sum←+⌿collection"
36+
]
37+
},
38+
{
39+
"cell_type": "markdown",
40+
"metadata": {},
41+
"source": [
42+
"Then we find the count."
43+
]
44+
},
45+
{
46+
"cell_type": "code",
47+
"execution_count": 3,
48+
"metadata": {},
49+
"outputs": [],
50+
"source": [
51+
"count←≢collection"
52+
]
53+
},
54+
{
55+
"cell_type": "markdown",
56+
"metadata": {},
57+
"source": [
58+
"Finally, we divide the sum by the count."
59+
]
60+
},
61+
{
62+
"cell_type": "code",
63+
"execution_count": 4,
64+
"metadata": {},
65+
"outputs": [],
66+
"source": [
67+
"mean←sum÷count"
68+
]
69+
},
70+
{
71+
"cell_type": "markdown",
72+
"metadata": {},
73+
"source": [
74+
"And that's our mean."
75+
]
76+
},
77+
{
78+
"cell_type": "code",
79+
"execution_count": 5,
80+
"metadata": {},
81+
"outputs": [
82+
{
83+
"data": {
84+
"text/html": [
85+
"<span style=\"white-space:pre; font-family: monospace\">2.8\n",
86+
"</span>"
87+
]
88+
},
89+
"execution_count": 5,
90+
"metadata": {},
91+
"output_type": "execute_result"
92+
}
93+
],
94+
"source": [
95+
"mean"
96+
]
97+
}
98+
],
99+
"metadata": {
100+
"kernelspec": {
101+
"display_name": "Dyalog APL",
102+
"language": "apl",
103+
"name": "dyalog-kernel"
104+
},
105+
"language_info": {
106+
"file_extension": ".apl",
107+
"mimetype": "text/apl",
108+
"name": "APL"
109+
}
110+
},
111+
"nbformat": 4,
112+
"nbformat_minor": 2
113+
}

0 commit comments

Comments
 (0)