Skip to content

Commit

Permalink
Add log of virtual class. (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
drvinceknight authored Nov 13, 2024
1 parent 1d20f5f commit f2c47a4
Show file tree
Hide file tree
Showing 5 changed files with 1,051 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _posts/2024-10-30-virtual-probability-lab.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ for Mathematics](https://vknight.org/pfm/tools-for-mathematics/06-probability/tu

You can see a recording of the class [here](https://cardiff.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=c1ba87bd-b2b8-406a-8e75-b21900cc46b7).

You can find the notebook I worked on here [combinatorics-tutorial.ipynb]({{site.baseurl}}/assets/nbs/2024-2025/probability-tutorial.ipynb).
You can find the notebook I worked on here [probability-tutorial.ipynb]({{site.baseurl}}/assets/nbs/2024-2025/probability-tutorial.ipynb).

Note that I have also updated the notebook from the class which you can find
here: [combinatorics.ipynb]({{site.baseurl}}/assets/nbs/2024-2025/probability.ipynb)
here: [probability.ipynb]({{site.baseurl}}/assets/nbs/2024-2025/probability.ipynb)
14 changes: 14 additions & 0 deletions _posts/2024-11-13-virtual-sequences-lab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
layout: post
title: "Virtual lab: Sequences"
tags: sequences
---

Today's virtual lab went over the tutorial for the Sequences chapter for [Python
for Mathematics](https://vknight.org/pfm/tools-for-mathematics/07-sequences/tutorial/main.html).

You can see a recording of the class [here](https://cardiff.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=7746463b-8996-4c71-9b59-b22700bad326).

You can find the notebook I worked on here [sequences-tutorial.ipynb]({{site.baseurl}}/assets/nbs/2024-2025/sequences-tutorial.ipynb).

You can also find the board I wrote on when talking about [the Collatz conjecture](https://en.wikipedia.org/wiki/Collatz_conjecture) here [collatz]({{site.baseurl}}/assets/boards/2024-2025/collatz.ipynb)
Binary file added assets/boards/2024-2025/collatz.pdf
Binary file not shown.
164 changes: 164 additions & 0 deletions assets/nbs/2024-2025/more-probability.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "6b385490-e3ac-45b6-b7e1-1cd71cc5a3b8",
"metadata": {},
"source": [
"## Question 4 from probability chapter"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "f91543c8-a6f2-4911-a417-a9c997a61815",
"metadata": {},
"outputs": [],
"source": [
"import random\n",
"\n",
"def sample_experiment():\n",
" \"\"\"\n",
" Sample a travel method and whether or not we are late\n",
" \"\"\"\n",
" random_number = random.random()\n",
" if random_number < 1 / 2:\n",
" travel_method = \"car\"\n",
" probability_of_late = 1 / 5\n",
" elif random_number < 1 / 2 + 1 / 6:\n",
" travel_method = \"bike\"\n",
" probability_of_late = 2 / 5\n",
" else:\n",
" travel_method = \"foot\"\n",
" probability_of_late = 1 / 10\n",
" return travel_method, random.random() < probability_of_late"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "839b73a0-8d10-4446-9edc-bc491d461efa",
"metadata": {},
"outputs": [],
"source": [
"import random\n",
"\n",
"def sample_experiment():\n",
" \"\"\"\n",
" Sample a travel method and whether or not we are late\n",
" \"\"\"\n",
" random_number = random.random()\n",
" \n",
" if random_number < 1 / 2:\n",
" travel_method = \"car\"\n",
" is_late = random.random() < 1 / 5\n",
" return travel_method, is_late\n",
" \n",
" if random_number < 1 / 2 + 1 / 6:\n",
" travel_method = \"bike\"\n",
" is_late = random.random() < 2 / 5\n",
" return travel_method, is_late\n",
"\n",
" travel_method = \"foot\"\n",
" is_late = random.random() < 1 / 10\n",
" return travel_method, is_late"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "91c27fee-58e4-4515-98f4-86b40c53dbb6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"81.91554102604361"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"random.random() * 1/5"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "6ce5e629-5c6f-4c7c-bb9e-b98cf8a8c697",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[0;31mSignature:\u001b[0m \u001b[0mrandom\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrandint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mb\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m\n",
"Return random integer in range [a, b], including both end points.\n",
" \n",
"\u001b[0;31mFile:\u001b[0m /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/random.py\n",
"\u001b[0;31mType:\u001b[0m method"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"random.randint?"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "6c802fd8-0091-4f3d-9b2b-5e3a4b6f28a6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Riggins'"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"random.choice((\"Julien\", \"Kaitlynn\", \"Riggins\"))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "126e9a9d-d2b5-4abb-b245-e51007841e75",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit f2c47a4

Please sign in to comment.