commit c50df677ce0a635c9fd79395aab19df290a539d7
parent 80d7636524fbbce82fa4cb37c9f5e447df8dd89a
Author: thing1 <thing1@seacrossedlovers.xyz>
Date: Fri, 17 Oct 2025 11:01:32 +0100
lecture and lab
Diffstat:
8 files changed, 211 insertions(+), 0 deletions(-)
diff --git a/CS12020/15.10.25.md b/CS12020/15.10.25.md
@@ -0,0 +1,4 @@
+15/10/25
+========
+
+
diff --git a/CS12020/labs/lab3/2 b/CS12020/labs/lab3/2
@@ -0,0 +1,70 @@
+#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()) ;
+ return Serial.parseInt();
+}
+
+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/lab3/Makefile b/CS12020/labs/lab3/Makefile
@@ -0,0 +1,10 @@
+all: compile upload
+
+upload: compile
+ arduino-cli upload --fqbn arduino:avr:uno . -p /dev/ttyACM0
+
+compile: lab3.ino
+ arduino-cli compile --fqbn arduino:avr:uno .
+
+monitor:
+ arduino-cli monitor -p /dev/ttyACM0
diff --git a/CS12020/labs/lab3/lab3.ino b/CS12020/labs/lab3/lab3.ino
@@ -0,0 +1,70 @@
+#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()) ;
+ return Serial.parseInt();
+}
+
+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/CS18120/15.10.25.md b/CS18120/15.10.25.md
@@ -0,0 +1,4 @@
+15/10/25
+========
+
+
diff --git a/MP10610/14.10.25.md b/MP10610/14.10.25.md
@@ -0,0 +1,16 @@
+14/10/25
+========
+
+Limits
+------
+
+- say that f(x) is defined when x is close to some value a, the limit of f at A is C if f(x) becomes very close to c.
+- FIG1 shows this
+- FIG2 shows the method
+ - note we choose values close to the limit, to sub into X
+- FIG3 shows an example method
+ - note because the function was defined at 3 it could be solved
+- FIG4 shows a right oriented limit, noted by the plus, this means only view values come from the right hand side
+ - same thing works for a left sided limit
+- FIG5 shows an examples of the sign functions
+- FIG6 shows an example of solving inf/inf questions
diff --git a/MP10610/16.10.25.md b/MP10610/16.10.25.md
@@ -0,0 +1,17 @@
+16/10/25
+========
+
+Limits
+------
+
+- if you have a function with a function above and bellow it, the limits of all functions at a point can be equated
+- see FIG1 for l'hopitals rule
+
+Continuity
+----------
+
+- see FIG2 for the rules of continuity
+
+
+
+
diff --git a/PH16210/16.10.25.md b/PH16210/16.10.25.md
@@ -0,0 +1,20 @@
+16/10/25
+========
+
+Complex numbers
+---------------
+
+- see FIG1 for the definition of an imaginary number
+- see FIG2 for an example of how to use i
+- see FIG3 for how to write a complex number
+- see FIG4 for how to find the sum and product of complex numbers
+ - the formula for the product is messy, just put the 2 numbers next to each other and expand out the bracket
+- complex conjugation is simply where you flip the sign of imaginary term, the z becomes z* when you do this
+ - this is a flip around the real (x) axis
+- see FIG5 for modulus and argument
+ - the modulus of a complex number, is the length of the vector it represents
+ - the argument is the angle of the vector (in rad) to the real (x) axis
+- a complex number times is complex conjugation is the modulus of itself squared
+ - see FIG6 for a writen representation
+ - this value is real, not complex!
+- see FIG7 for how to divide complex numbers