summaryrefslogtreecommitdiff
path: root/comp/work
diff options
context:
space:
mode:
authorthing1 <thing1@seacrossedlovers.xyz>2025-03-24 18:35:17 +0000
committerthing1 <thing1@seacrossedlovers.xyz>2025-03-24 18:35:17 +0000
commit590b61cdc1120315197f65dd780c919b6e13e385 (patch)
tree18781ed8c04668e16972a0baf36a83fd92b490fe /comp/work
parentc509339286e7aac6d1b8557cf3a55326ce3e1d75 (diff)
maths and comp sci
Diffstat (limited to 'comp/work')
-rw-r--r--comp/work/51/Makefile2
-rw-r--r--comp/work/51/vectors.ms193
2 files changed, 195 insertions, 0 deletions
diff --git a/comp/work/51/Makefile b/comp/work/51/Makefile
new file mode 100644
index 0000000..ec0f613
--- /dev/null
+++ b/comp/work/51/Makefile
@@ -0,0 +1,2 @@
+all: vectors.ms
+ eqn vectors.ms | groff -Tps -ms | ps2pdf - > vectors.pdf
diff --git a/comp/work/51/vectors.ms b/comp/work/51/vectors.ms
new file mode 100644
index 0000000..37c89df
--- /dev/null
+++ b/comp/work/51/vectors.ms
@@ -0,0 +1,193 @@
+.TL
+Vectors in comp sci
+.AU
+Lucas Standen
+.AI
+QMC
+.2C
+
+.EQ
+delim @@
+.EN
+
+.EQ
+delim @#
+.EN
+
+.NH 1
+How to write them
+
+.LP
+To write a vector, like in maths we can use
+.EQ
+({i sub x, j sub y})
+.EN
+But they can also be written
+.EQ
+R sup 2
+.EN
+
+.EQ
+R sup 3
+.EN
+Where the power is the number of degrees available
+
+.NH 1
+Combining vectors
+.LP
+To combine vectors one can use the formula
+.EQ
+w = alpha u + beta v
+.EN
+Where w is the combined vector and
+.EQ
+alpha + beta = 1
+.EN
+
+.NH 2
+Example
+.EQ
+u = (2,2)
+.EN
+
+.EQ
+v = (6,-2)
+.EN
+
+We can then say that
+.EQ
+w = (4, 0)
+.EN
+By subtracting v from u
+
+Then using the formula
+.EQ
+2 alpha + 6 beta = 3
+.EN
+Where 3 is a point on the combined vector
+.EQ
+2 alpha + -2 beta = 1
+.EN
+
+We can then solve for @ beta # like so
+
+.EQ
+6 beta - 3 = -2 beta - 1
+.EN
+
+.EQ
+8 beta - 2 = 0
+.EN
+
+.EQ
+8 beta = 2
+.EN
+
+.EQ
+beta = 2 over 8
+.EN
+
+.EQ
+beta = 1 over 4
+.EN
+
+From this we can say
+.EQ
+alpha = 3 over 4
+.EN
+Because
+.EQ
+alpha + beta = 1
+.EN
+
+.NH 2
+Another example
+
+.EQ
+2 alpha + 6 beta = 2
+.EN
+
+.EQ
+2 alpha - 2 beta = 1
+.EN
+
+.EQ
+8 beta = 1
+.EN
+
+.EQ
+beta = 1 over 8
+.EN
+
+.EQ
+2 alpha - 2 ({1 over 8}) = 1
+.EN
+
+.EQ
+2 alpha = 5 over 4
+.EN
+
+.EQ
+alpha = 5 over 8
+.EN
+
+Since
+.EQ
+alpha + beta != 1
+.EN
+We can say that w does not lie on the vector uv
+
+And because it is greater than 1 it means it is inside the triangle created by u and v
+
+.NH 1
+The dot product
+
+.LP
+To solve use the following formula
+
+.EQ
+u.v = |u|.|v| cos( theta )
+.EN
+
+Where @ theta # is the angle between the 2 vectors and
+
+.EQ
+|u| = " magnitude of u, " sqrt {x sup 2 + y sup 2}
+.EN
+
+You can also use
+.EQ
+u.v = u sub 1 . v sub 1 + u sub 2 . v sub 2 + u sub n + v sub n ...
+.EN
+If you don't have the angle
+
+Don't be confused by the dot, it just means
+.EQ
+u sub 1 . v sub 1 = u sub 1 times v sub 1
+.EN
+
+.NH 2
+Exam question
+
+.LP
+1.1)
+.EQ
+|b| = 4
+.EN
+
+1.2)
+.EQ
+u.v = u sub 1 . v sub 1 + u sub 2 . v sub 2 + u sub n + v sub n ...
+.EN
+
+.EQ
+a.b = 4 . 4 + 3 . 0
+.EN
+
+.EQ
+a.b = 16 + 0
+.EN
+
+.EQ
+a.b = 16
+.EN