uni

Thing1's amazing uni repo
Log | Files | Refs

commit c5dee9ccd7273745cd4326746b7bc697975f6bd5
parent b4b57b966c21de080f8982e655e42d348fba1512
Author: thing1 <thing1@seacrossedlovers.xyz>
Date:   Mon, 27 Oct 2025 09:55:18 +0000

added a lab, and many notes

Diffstat:
ACS12020/22.10.25.md | 4++++
ACS12020/24.10.25.md | 5+++++
ACS12020/labs/lab4/Makefile | 10++++++++++
ACS12020/labs/lab4/lab4.ino | 46++++++++++++++++++++++++++++++++++++++++++++++
ACS12020/labs/lab4/tmp | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
ACS12020/labs/lab4/util.h | 21+++++++++++++++++++++
ACS18120/22.10.25.md | 1+
ACS18120/24.10.25.md | 9+++++++++
AMP10610/21.10.25.md | 8++++++++
AMP10610/23.10.25.md | 9+++++++++
AMP10610/27.10.25.md | 24++++++++++++++++++++++++
APH16210/23.10.25.md | 5+++++
12 files changed, 196 insertions(+), 0 deletions(-)

diff --git a/CS12020/22.10.25.md b/CS12020/22.10.25.md @@ -0,0 +1,4 @@ +22/10/25 +======== + + diff --git a/CS12020/24.10.25.md b/CS12020/24.10.25.md @@ -0,0 +1,5 @@ +24/10/25 +======== + +- look up andy's band the moon men +- diff --git a/CS12020/labs/lab4/Makefile b/CS12020/labs/lab4/Makefile @@ -0,0 +1,10 @@ +all: compile upload + +upload: compile + arduino-cli upload --fqbn arduino:avr:uno . -p /dev/ttyACM0 + +compile: lab4.ino + arduino-cli compile --fqbn arduino:avr:uno . + +monitor: + arduino-cli monitor -p /dev/ttyACM0 diff --git a/CS12020/labs/lab4/lab4.ino b/CS12020/labs/lab4/lab4.ino @@ -0,0 +1,46 @@ +#include "util.h" + +const char *order[] = {"Secs", "Mins", "Hours"}; +const int time_orders = SIZE(order); + +const char *sports[] = {"swim", "run", "cycle"}; +const int number_of_sports = SIZE(sports); + +int +input_time(const char *order, const char *sport) { + SEprintf("How many %s did %s take: ", order, sport); + return readint(); +} + +void +input_sport(const char *sport, int times[time_orders]) { + for (int i = 0; i < time_orders; i++) + times[i] = input_time(order[i], sport); +} + +void +normalize(int times[time_orders]) { + for (int i = 0; i < time_orders - 1; i++) { + times[i + 1] += times[i] / 60; + times[i] %= 60; + } +} + +void +setup() { + int sport_times[number_of_sports + 1][time_orders] = {0}; + Serial.begin(9600); + + for (int i = 0; i < number_of_sports; i++) + input_sport(sports[i], sport_times[i]); + + for (int i = 0; i < number_of_sports; i++) + for (int j = 0; j < time_orders; j++) + sport_times[time_orders][j] += sport_times[i][j]; + + normalize(sport_times[3]); + + SEprintf("Total time: %dsec %dmin %dhr.\n", sport_times[time_orders][0], sport_times[time_orders][1], sport_times[time_orders][2]); +} + +void loop() {} diff --git a/CS12020/labs/lab4/tmp b/CS12020/labs/lab4/tmp @@ -0,0 +1,54 @@ +#include "util.h" + +int +input_time(const char *order, const char *sport) { + int i; + SEprintf("How many %s did %s take: ", order, sport); + i = readint(); + SEprintf("\n"); + return i; +} + +void +readtime(const char *sport, int secs[], int mins[], int hours[], int i) { + secs[i] = input_time("secs", sport); + mins[i] = input_time("mins", sport); + hours[i] = input_time("hours", sport); +} + +int +sum(int arr[3]) { + int total = 0; + for (int i = 0; i < 3; i++) + total += arr[i]; + + return total; +} + +void +setup() { + int secs[3] = {0}, mins[3] = {0}, hours[3] = {0}, res[3] = {0}; + char *sports[] = { + "swim", + "run", + "cycle", + }; + + Serial.begin(9600); + + for (int i = 0; i < SIZE(sports); i++) + readtime(sports[i], secs, mins, hours, i); + + res[0] = sum(secs); + res[1] = sum(mins); + res[2] = sum(hours); + + for (int i = 0; i <= 3; i++) { + res[i + 1] += res[i] / 60; + res[i] = res[i] % 60; + } + + SEprintf("Total time: %dhr %dmin %dsec.\n", res[2], res[1], res[0]); +} + +void loop() {} diff --git a/CS12020/labs/lab4/util.h b/CS12020/labs/lab4/util.h @@ -0,0 +1,21 @@ +#define SIZE(arr) (sizeof(arr) / sizeof(arr[0])) + +void +SEprintf(const char *fmt, ...) { + static char sbuf[64] = { 0 }; + va_list ap; + + va_start(ap, fmt); + vsnprintf(sbuf, 64, fmt, ap); + va_end(ap); + + Serial.print(sbuf); +} + +int +readint() { + while (!Serial.available()) ; + int i = Serial.parseInt(); + SEprintf("\n"); + return i; +} diff --git a/CS18120/22.10.25.md b/CS18120/22.10.25.md @@ -0,0 +1 @@ +22/10/25 diff --git a/CS18120/24.10.25.md b/CS18120/24.10.25.md @@ -0,0 +1,9 @@ +24/10/25 +======== + +EpIc mEmEs +---------- + +1, 3, 2, 5, 4, 6, 7 + + diff --git a/MP10610/21.10.25.md b/MP10610/21.10.25.md @@ -0,0 +1,8 @@ +21/10/25 +======== + +Differentiation +--------------- + +- see FIG1 for differentiation by first principles +- diff --git a/MP10610/23.10.25.md b/MP10610/23.10.25.md @@ -0,0 +1,9 @@ +23/10/25 +======== + +Differentiation +=============== + +- see FIG1 for the product rule +- see FIG2 for a proof of the product rule +- see FIG3 for the quotient rule diff --git a/MP10610/27.10.25.md b/MP10610/27.10.25.md @@ -0,0 +1,24 @@ +27/10/25 +======== + +- see FIG1 for a use of eulers formula, when adding angles in polar form +- we can use De moivres formula to multiply angles + +- the roots of unity all lie on the unit circle (with an imaginary y axis) +- each root is evenly distributed along the unit circle +- see fig4 for the roots of unity formula + - n is the number of roots that you are looking for + - when n is 0, the root is always 1, meaning 1 is always a root +- FIG3 shows how to find the 5th root of unity + - m must be substituted in for all its values + +- to solve complex roots (see FIG4 for a worked example) + - write the right hand side in polar form + - multiply the right hand side by e^(2 PI i m) where m is an int + - take the nth root of the right hand side + - convert back into polar form (magnitude and angle) + - substitued the values of m into the angle + - we can then draw this on a circle, it will have a radius of the magnitude + - then draw on the angles found before + + diff --git a/PH16210/23.10.25.md b/PH16210/23.10.25.md @@ -0,0 +1,5 @@ +23/10/25 +======== + +- see FIG1 for De Moivre's theorem + - this can be used to prove the addition formula of sin and cos