Skip to content

Instantly share code, notes, and snippets.

@abrudz
Created September 14, 2018 09:31
Show Gist options
  • Save abrudz/b238665ef665b6adb7f235d6b93ef2b3 to your computer and use it in GitHub Desktop.
Save abrudz/b238665ef665b6adb7f235d6b93ef2b3 to your computer and use it in GitHub Desktop.
Webinar file
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Arithmetic Mean\n",
"The **arithemetic mean** is is the sum of a *collection* of numbers divided by the count of numbers in the collection.\n",
"\n",
"Let's say we have the collection {3,1,4,1,5}"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"collection←3 1 4 1 5 6"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To find the mean, we first find the sum."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"sum←+⌿collection"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Then the count."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"count←≢collection"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now divide sum by count."
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"mean←sum÷count"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"And that's the mean"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<span style=\"white-space:pre; font-family: monospace\">26\n",
"</span>"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mean"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Dyalog APL",
"language": "apl",
"name": "dyalog-kernel"
},
"language_info": {
"file_extension": ".apl",
"mimetype": "text/apl",
"name": "APL"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment