Skip to content

Commit

Permalink
Add log of mme and introduction to combinatorics.
Browse files Browse the repository at this point in the history
  • Loading branch information
drvinceknight committed Oct 22, 2024
1 parent afd89e3 commit f376771
Show file tree
Hide file tree
Showing 2 changed files with 314 additions and 0 deletions.
92 changes: 92 additions & 0 deletions _posts/2024-10-22-introduction-to-combinatorics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
layout: post
title: "Mid module feedback and brief introduction to Combinatorics"
tags:
- combinatorics
- about
---

In class today carried out the mid module feedback and briefly introduced the
combinatorics chapter.

Thank you for engaging with this, I'll try and summarize the main points raised
and describe changes I will attempt to make.

You can see a recording of the class [here](https://cardiff.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=ef900a31-6934-417b-a1e0-b20c00f7d129)

## Mid module feedback

A number of you mentioned the structure, online class and use of my website as a positive
aspect of the course. Some of you also made some kind comments: thank you.

My speed during class continues to come up. I'll continue to try and do better
there.

One of the main things that a number of you raised that could be improved was
the Friday class. A number of you find the class "pointless".

In the class I explained that I do want to stick to the substructure of every
week where the Friday class is used to review the concepts. I will continue to
do this. **However** I would like to thank a couple of students who came up to
me at the end of class and made some great suggestions of how the Friday class
could be improved. My plan for the Friday class:

- I will start with the quiz as before **but** I will set a 10 minute timer. If
we have not finished the quiz by then then we will just stop it.
- After this quiz I will solve the coursework like exercise from the handout.
- If there is still time I will solve questions from the exercise sections.

When I got back to my office I noticed I hadn't used the Q&A feature right on
Mentimeter and there were a few questions left:

- Q: Can we see the haircut?
- A: Sure.

- Q: Put the hat back on lil bro.
- A: Not a question but ok.

- Q: If a wood chucker could chuck wood how much wood could a wood chucker chuck if Riggins 'bark'ed?
- A: Easy: Riggins would bark.

- Q: when does this module end?
- A: At the end of next Semester.

- Q: If the moon imploded, would Riggins bark?
- A: Yes: the answer is always that he would bark.

- Q: If you jumped at the same time as Riggins, and Riggins jumped on you then initiated a double jump off of you, would the moon be in danger of a crash landing?
- A: Probably not but wouldn't try it (not because of the moon but because of needing to keep Riggs safe).

- Q: How often do you go out drinking? Of these occasions how often is it with Riggins?
- A: Incredibly rarely.

- Q: Were u her Romeo?
- A: No one called me that but yeah...

- Q: You are the Romeo to the Juliette.
- A: Not a question but: I was...

- Q: If you talk to a hawk could a hawk tuah if you talk tuah - Riggins 2024
- A: Ok?

- Q: If k = p+1 and p=k, in the same system, how does the existence of God not get proved directly??
- A:

```python
import sympy as sym
k = sym.Symbol("k")
p = sym.Symbol("p")
equation = sym.Eq(lhs=k, rhs=p + 1).subs({p: k})
sym.solves
```

- Q: is The Boys the best show?
- A: I haven't seen it...

- Q: just this week my eduroam wifi has been playing up a lot on my phone. pls help pls pls pls
- A: [Sounds like an IT problem.](https://www.cardiff.ac.uk/study/student-life/learning-support/it-services)

## Brief introduction to combinatorics

Here is the notebook I used in class:
[combinatorics.ipynb]({{site.baseurl}}/assets/nbs/2024-2025/combinatorics.ipynb)
222 changes: 222 additions & 0 deletions assets/nbs/2024-2025/combinatorics.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "c555d0d8-fa69-4ecc-ba1d-cde6934a105f",
"metadata": {},
"source": [
"The digits 1, 2, 3 and 4 are arranged in random order, to form a four-digit number.\n",
"\n",
"How many different four-digit numbers can be formed?\n",
"\n",
"How many different four-digit numbers:\n",
"\n",
"1. Are even.\n",
"2. Are less than 4000."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "1bb357fe-48c1-469e-aa2e-cd56bf80578c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"range(1, 5)"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"digits = range(1, 5)\n",
"digits"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "60c70257-13a1-427a-a1d5-b8b09213cda9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1, 2, 3, 4)"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tuple(digits)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "79363241-24d2-42e2-a914-7e5c2466fb97",
"metadata": {},
"outputs": [],
"source": [
"import itertools"
]
},
{
"cell_type": "markdown",
"id": "6c154e06-9ece-492b-9bb2-754826003d9b",
"metadata": {},
"source": [
"The first question is asking us to generate all **permutations** of the digits 1, 2, 3, 4."
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "ca5d68ff-7336-487c-b99f-bf914b88e169",
"metadata": {},
"outputs": [],
"source": [
"permutations = tuple(itertools.permutations(digits))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "139be517-994d-4985-9c0a-075388007c01",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"((1, 2, 3, 4),\n",
" (1, 2, 4, 3),\n",
" (1, 3, 2, 4),\n",
" (1, 3, 4, 2),\n",
" (1, 4, 2, 3),\n",
" (1, 4, 3, 2),\n",
" (2, 1, 3, 4),\n",
" (2, 1, 4, 3),\n",
" (2, 3, 1, 4),\n",
" (2, 3, 4, 1),\n",
" (2, 4, 1, 3),\n",
" (2, 4, 3, 1),\n",
" (3, 1, 2, 4),\n",
" (3, 1, 4, 2),\n",
" (3, 2, 1, 4),\n",
" (3, 2, 4, 1),\n",
" (3, 4, 1, 2),\n",
" (3, 4, 2, 1),\n",
" (4, 1, 2, 3),\n",
" (4, 1, 3, 2),\n",
" (4, 2, 1, 3),\n",
" (4, 2, 3, 1),\n",
" (4, 3, 1, 2),\n",
" (4, 3, 2, 1))"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"permutations"
]
},
{
"cell_type": "markdown",
"id": "95038955-baa0-4082-b92e-d67d0ad851a3",
"metadata": {},
"source": [
"To compute the number we can count them:"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "5aab97f8-bb75-4f73-aada-53b47c85edc6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"24"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(permutations)"
]
},
{
"cell_type": "markdown",
"id": "4a31fc0f-16c6-499e-9368-41ec80af8384",
"metadata": {},
"source": [
"Let us confirm this theoretically. We know that the number should be $4!$:"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "486b2f54-d0ad-4ec4-b475-5f79fc2ee75e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"24"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import math\n",
"math.factorial(4)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18de8077-006e-442e-9399-23293f1ee8b2",
"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
}

0 comments on commit f376771

Please sign in to comment.