Page 1 of 1

Linear Algebra w/o Matrices

Posted: Fri May 23, 2025 4:57 pm
by Akumu9K
I really hope this thing wont crash. Anyways so uhhhhh, this is a hexcasting implementation of this monstrosity: https://www.desmos.com/3d/c8q9rejwaf
A completely non matrix related way of changing the basis of a vector, and it works for non orthogonal basis vectors too! The entire thing is around 500 patterns long.
The code took 3 hours to write so if there is any problems in there (I was careful but who knows) debugging will be a nightmare. That desmos thing took 12 hours, and I spent another 6 hours on a 4D one just to prove the solution generalizes to higher dimensions (It does :3). I might be slightly insane.

Also it for some reason doesnt render bookkeepers soooooo

Edit 1: Ok so I went over the code again, with the full mental faculties after waking up. The code works perfectly, it just needed 1 addition where I borked the list manip, and I need to change the bookkeepers a bit, -vv is now vv-, and vv- is now -vv, because I forgor how they worked.
Patterns
Numerical Reflection: 4ewdqdweqqqaedeqeewdweddwaawddeqqwawqaawqeewdweddwaadaaNumerical Reflection: 1deeedaawddNumerical Reflection: 0deeedaadaaddqddaawddaadaaddqddwaqawaaeddaadaawaqawwdedwwaqawNumerical Reflection: -1waqawwaawaadaawqaqwwdedwaadaaqeewdweddwaadaaNumerical Reflection: 2deeedaawddNumerical Reflection: 0deeedaadaaddqddaawddaadaaddqddwaqawaaeddaadaawaqawwdedwwaqawNumerical Reflection: -1waqawwaawaadaawqaqwwdedwaadaaddqddaawddaadaaddqddwaqawaaeddaadaawaqawwdedwwaqawNumerical Reflection: -1waqawwaawaadaawqaqwwdedwqeewdweddwNumerical Reflection: 1deeedaadaawqaqwwdedwaaeaaNumerical Reflection: 3ewdqdweqqqaedeaadaaqeewdweddwNumerical Reflection: 0deeedaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddVVeqqqqqaawddaadaaqeewdweddwNumerical Reflection: 2deeedaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddVVeqqqqqaawddaadaaqeewdweddwNumerical Reflection: 3deeedaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddVVeqqqqqaawddVaawddaaeaaqqqqqewqeewdweddwNumerical Reflection: 1deeedwqaqwwaqawaawddNumerical Reflection: 4ewdqdweqqqaedeaadaaNumerical Reflection: 3deeedaawddaadaaNumerical Reflection: 2deeedaawddddqddqeeeeeVV-aawddqeeeeeVV-aawddwdedwaawddaadaaNumerical Reflection: 2deeedqeeeeeaawddVNumerical Reflection: 0aawddeqqqqqaadaawqaqwwdedwaadaaddqddaaeddNumerical Reflection: 0deeedqeeeeeaawddVNumerical Reflection: 0aawddeqqqqqaadaawqaqwwdedwaadaaddqddaawddaadaaddqddwaqawaaeddaadaawaqawwdedwwaqawNumerical Reflection: -1waqawwaawaadaawqaqwwdedwaaeaaaawddqqqqqewqeewdweddwNumerical Reflection: 1deeedwqaqwwaqawaawddNumerical Reflection: 3ewdqdweqqqaedeaaeddNumerical Reflection: 3deeedaaeddaawddaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddVVeqqqqqddqddaaeddNumerical Reflection: 0deeedaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddVVeqqqqqaaeaaaawddqeeeee-VVaawddqeeeee-VVaawddwdedwaawddaaeddaaeddNumerical Reflection: 0deeedwaqawaawddNumerical Reflection: 3ewdqdweaaeddedqdeqwaeawqaaeddNumerical Reflection: 2deeedwaqawaaeaawaawaaeddNumerical Reflection: 1deeedaaeddddqddaadaaddqddaawddaadaaddqddwaqawaaeddaadaawaqawwdedwwaqawNumerical Reflection: -1waqawwaawaadaawqaqwwdedwaawddqqqqqewaawddNumerical Reflection: 3ewdqdweqqqaedeaaeddNumerical Reflection: 1deeedaaeddaawddaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddVVeqqqqqddqddaaeddNumerical Reflection: 4deeedaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddaawddaaqwqaaaawddddqddaaeddwaqawddqddVVeqqqqqaaeaaqeeeeeVV-aawddqeeeeeVV-aawddwdedwaawddVaaeaaeqqqqqaawddeqqwawqaaw

Code: Select all

// This is a method of doing basis change from the standard XYZ basis of minecraft to any given ABC basis.
// Its based on this: https://www.desmos.com/3d/ejhslqcl7h
// You do not need matrices to do linear algebra :3
// It takes 4 inputs, A,B,C,V1. ABC are the new basis vectors corresponding to XYZ. V1 is the vector you are changing the basis of
// This pattern uses the ravenmind but restores it afterwards. So with an empty ravenmind, it will set the ravenmind to null.


Numerical Reflection: 4
Flock's Gambit
Retrograde Purification
Muninn's Reflection
Jester's Gambit
Huginn's Gambit
Muninn's Reflection
// The stack is now, [A,B,C,V1], (Previous ravenmind iota). Ravenmind is now [A,B,C,V1]
// With selection distillation, 0 selects A, 1 selects B, 2 selects C, 3 selects V1
// Now we gotta do some gram schmidt thingy. Look it up on wikipedia if you want
Gemini Decomposition
Numerical Reflection: 1
Selection Distillation
Jester's Gambit
Numerical Reflection: 0
Selection Distillation
// Stack is now, A, B
Gemini Decomposition
Rotation Gambit II
// Stack is now, A, B, A
Jester's Gambit
// I will be using my own vector projection thingy because Im based like that but it can be replaced with the vector projection pattern in hexcasting.
// The formula for it is, ( (v1 dot v2) / length(v1)^2) * v1, v1 is the one being projected on, v2 is the one being projected
// For the sake of optimization, the specific formula used is ( (v1 dot v2) / (v1 dot v1) ) * v1, because v1 dot v1 is equivalent to length(v1)^2
// v1 ontop, v2 at the bottom, on the stack.
Gemini Decomposition
Rotation Gambit II
Multiplicative Distillation
Prospector's Gambit
Gemini Decomposition
Multiplicative Distillation
Division Distillation
Multiplicative Distillation
// Vector projection end.
// Now we have a vector thats A projected onto B, time to subtract it from A
Numerical Reflection: -1
Multiplicative Distillation
Additive Distillation
// Time to normalize
Gemini Decomposition
Length Purification
Division Distillation
// This new vector will be called A-C1
// Now we need to do that whole process again, but with B and C. First lets duplicate A-C1 though, we will need it
Gemini Decomposition
// Stack is now, A-C1,A-C1,(Previous ravenmind iota)
Muninn's Reflection
Gemini Decomposition
Numerical Reflection: 2
Selection Distillation
Jester's Gambit
Numerical Reflection: 0
Selection Distillation
// Stack is now, C, B, the rest
Gemini Decomposition
Rotation Gambit II
Jester's Gambit
Gemini Decomposition
Rotation Gambit II
Multiplicative Distillation
Prospector's Gambit
Gemini Decomposition
Multiplicative Distillation
Division Distillation
Multiplicative Distillation
Numerical Reflection: -1
Multiplicative Distillation
Additive Distillation
Gemini Decomposition
Length Purification
Division Distillation
// This new vector will be called C-C1P
// The stack is now, C-C1P,A-C1,A-C1,(Previous ravenmind iota)
// Now we need to do that process again, but with C-C1P and A-C1, to get C-C1. C-C1, A-C1 and B (Normalized) will be used for a basis change of, A, C and V1. B will become the Y+ vector
Gemini Decomposition
Rotation Gambit II
Jester's Gambit
Gemini Decomposition
Rotation Gambit II
Multiplicative Distillation
Prospector's Gambit
Gemini Decomposition
Multiplicative Distillation
Division Distillation
Multiplicative Distillation
Numerical Reflection: -1
Multiplicative Distillation
Additive Distillation
Gemini Decomposition
Length Purification
Division Distillation
// The stack is now, C-C1, A-C1, (Previous ravenmind iota)
// Now lets bring B out and arrange them into A B C
Muninn's Reflection
Numerical Reflection: 1
Selection Distillation
Gemini Decomposition
Length Purification
Division Distillation
// Normalized B
// Stack is now, B, C-C1, A-C1
Rotation Gambit
// Now lets package em up into a list.
Numerical Reflection: 3
Flock's Gambit
Retrograde Purification
// Now time to change the basis of A, C and V1!
// A first, it will be called A2 after this
Gemini Decomposition
Muninn's Reflection
Numerical Reflection: 0
Selection Distillation
// Stack is now, A, [A-C1,B,C-C1],[A-C1,B,C-C1],(Previous ravenmind iota)
Jester's Gambit
Speaker's Decomposition
// Stack is now, A-C1, [B,C-C1], A
Jester's Gambit
Rotation Gambit II
// Stack is now, A-C1, A, [B,C-C1]
Prospector's Gambit
Multiplicative Distillation
// This is the X component of our basis changed A vector, A2.x
Rotation Gambit II
// Stack is now, A, [B,C-C1], A2.x
// We now repeat.
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
// Stack is now, A, [C-C1], A2.y, A2.x (I think, I havent checked.)
// One more time
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
// Stack is now, A, [], A2.z, A2.y, A2.x
// Time to get rid of the top two useless iotas and form A2.
Bookkeeper's Gambit: vv
Vector Exaltation
// Stack is now, A2, [A-C1,B,C-C1],(Previous ravenmind iota)
// Now we repeat for C and V1.
Jester's Gambit
Gemini Decomposition
Muninn's Reflection
Numerical Reflection: 2
Selection Distillation
// Selected C, stack is, C, [construct list],[construct list], A2, (Previous ravenmind iota)
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
// Stack is now, C, [], C2.z, C2.y, C2.x, [construct list], A2, (Previous ravenmind iota)
Bookkeeper's Gambit: vv
Vector Exaltation
// Stack is now, C2, [construct list], A2, (PRI)
// Now for V1
Jester's Gambit
Gemini Decomposition
Muninn's Reflection
Numerical Reflection: 3
Selection Distillation
// Select ^
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
// Basis change ^
Bookkeeper's Gambit: vv
Vector Exaltation
Jester's Gambit
// Stack is now, [construct list], V1-2, C2, A2, (PRI)
// Now time to assemble another list in the form of, [A2,B2,C2,V1-2], B2 is just Y+
// Okay slight problem here, that I noticed so late lmao.
// So I made the naive assumption that, after aligning B with the Y axis, we could just substitute in Y+ for B
// We can but, only if B is of length 1. Otherwise it doesnt work. So the fix is simple, multiply the Y+ with the length of B.
// There is another place where Y+ is substituted in for B, and while for that place it doesnt matter, Ill still fix it there too anyways.
Bookkeeper's Gambit: v
Jester's Gambit
Rotation Gambit
Vector Reflection +Y
// Fix start
Muninn's Reflection
Numerical Reflection: 1
Selection Distillation
Length Purification
Multiplicative Distillation
// Fix end
Jester's Gambit
// Stack is now, A2, B2, C2, V1-2, (PRI)
Numerical Reflection: 4
Flock's Gambit
Retrograde Purification
// Stack is now, [A2,B2,C2,V1-2], (PRI)
// Time to find the FIRST component of the basis changed V1, VF. The z component.
Gemini Decomposition
Numerical Reflection: 3
Selection Distillation
Jester's Gambit
Gemini Decomposition
Numerical Reflection: 2
Selection Distillation
Jester's Gambit
Rotation Gambit II
// Stack is now, C2, V1-2, [A2,B2,C2,V1-2], (PRI)
// Now time to find both of their z components
Vector Disintegration
Bookkeeper's Gambit: vv-
// Stack is now, C2.z, V1-2, ...
Jester's Gambit
Vector Disintegration
Bookkeeper's Gambit: vv-
// Stack is now, V1-2.z, C2.z, ...
Jester's Gambit
Division Distillation
// We have obtained the z component of VF
// Stack is now, VF.z, [A2,B2,C2,V1-2], (PRI)
Jester's Gambit
// Time to find the x component of VF. We need a new set of construct vectors, but, finding them wont be hellish this time since B2 is just Y+, and thus B2-C
// Still gonna be painful though. Lets start with C2-C
Gemini Decomposition
Numerical Reflection: 2
Selection Distillation
Vector Disintegration
// Stack is now, C2.z, C2.y, C2.x ,[A2,B2,C2,V1-2], VF.Z, (PRI)
// We need to make C2.y 0, combine them and then normalize them.
Jester's Gambit
Bookkeeper's Gambit: v
Numerical Reflection: 0
Jester's Gambit
Vector Exaltation
Gemini Decomposition
Length Purification
Division Distillation
// Stack is now, C2-C, [A2,B2,C2,V1-2], VF.Z, (PRI)
// Now lets get A2-C. We will first need to do this same process to it, but then gram schmidt with C2-C
Gemini Decomposition
Rotation Gambit II
Prospector's Gambit
Numerical Reflection: 0
Selection Distillation
// Stack is now, A2, C2-C, [A2,B2,C2,V1-2], C2-C, VF.Z, (PRI)
// 0 the y first.
Vector Disintegration
Jester's Gambit
Bookkeeper's Gambit: v
Numerical Reflection: 0
Jester's Gambit
Vector Exaltation
Gemini Decomposition
Length Purification
Division Distillation
// Stack is now, A2.5, C2-C ...
Gemini Decomposition
Rotation Gambit II
// Stack is now, A2.5, C2-C, A2.5
// Now we do the gram schmidt
Jester's Gambit
// Stack is now, C2-C, A2.5, A2.5
Gemini Decomposition
Rotation Gambit II
Multiplicative Distillation
Prospector's Gambit
Gemini Decomposition
Multiplicative Distillation
Division Distillation
Multiplicative Distillation
// Stack is now, A2-P, A2.5
Numerical Reflection: -1
Multiplicative Distillation
Additive Distillation
// Stack is now, A2-C, now time to normalize it
Gemini Decomposition
Length Purification
Division Distillation
// Stack is now, A2-C, [A2,B2,C2,V1-2], C2-C, VF.Z, (PRI)
// Time to make our new construct list, A2-C, B2-C, C2-C
Rotation Gambit
Jester's Gambit
Vector Reflection +Y
// Fix start
Muninn's Reflection
Numerical Reflection: 1
Selection Distillation
Length Purification
Multiplicative Distillation
// Fix end
Jester's Gambit
// Stack is now, A2-C, B2-C, C2-C, ...
Numerical Reflection: 3
Flock's Gambit
Retrograde Purification
// Stack is now, [A2-C,B2-C,C2-C], [A2,B2,C2,V1-2], VF.Z, (PRI)
// Now we only need to basis change 2 vectors, V1-2 and A2
Prospector's Gambit
Numerical Reflection: 3
Selection Distillation
Prospector's Gambit
Jester's Gambit
// Time to basis change V1-2.
// Stack is now, V1-2 ,[A2-C,B2-C,C2-C] ,[A2-C,B2-C,C2-C], [A2,B2,C2,V1-2], VF.Z, (PRI)
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Bookkeeper's Gambit: vv
Vector Exaltation
// Stack is now, V1-3, [A2-C,B2-C,C2-C], [A2,B2,C2,V1-2], VF.Z, (PRI)
// Now time for A2
Rotation Gambit II
Prospector's Gambit
Numerical Reflection: 0
Selection Distillation
// Stack is now, A2, [A2-C,B2-C,C2-C], [A2,B2,C2,V1-2], V1-3, VF.Z, (PRI)
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Bookkeeper's Gambit: vv
Vector Exaltation
// Stack is now, A3, [A2,B2,C2,V1-2], V1-3, VF.Z, (PRI)
Rotation Gambit
Jester's Gambit
// Stack is now, A3, V1-C, [A2,B2,C2,V1-2], VF.Z, (PRI)
// Now time to find VF.X!
Vector Disintegration
Bookkeeper's Gambit: -vv
Jester's Gambit
Vector Disintegration
Bookkeeper's Gambit: -vv
Jester's Gambit
Division Distillation
// We found VF.X!
// Stack is now, VF.X, [A2,B2,C2,V1-2], VF.Z, (PRI)
// We now need to find VF.Y
// For this we will construct R1, a partially finished vector composed of (VF.X * A2) + (VF.Z * C2)
// The reason we did not construct this before was, well, such a vector coincided with either one of our basis vectors previously. So we could just use those instead.
Jester's Gambit
Prospector's Gambit
// Stack is now VF.X, [A2,B2,C2,V1-2], VF.X, VF.Z, (PRI)
Prospector's Gambit
Numerical Reflection: 0
Selection Distillation
Multiplicative Distillation
// Stack is now, R1.P1, [A2,B2,C2,V1-2], VF.X, VF.Z, (PRI)
// We now need to reach VF.Z... This is awkward.
Jester's Gambit
// Push R1.P1 down first.
Numerical Reflection: 3
Flock's Gambit
Prospector's Gambit
Integration Distillation
Flock's Disintegration
// Stack is now, VF.Z, [A2,B2,C2,V1-2], R1.P1, VF.X, VF.Z, (PRI)
// I did not update my VSCode hexcasting addon yet okay? Excuse the fucked up stack manip
Prospector's Gambit
Numerical Reflection: 2
Selection Distillation
Multiplicative Distillation
// We have obtained R1.P2
// Stack is now, R1.P2, [A2,B2,C2,V1-2], R1.P1, ...
// We now need to add them together
Rotation Gambit
Additive Distillation
// We now have R1.
// Stack is now R1, [A2,B2,C2,V1-2], VF.X, VF.Z, (PRI)
// Finally, FINALLY, time to acquire VF.Y. We need 2 construct vectors, R1 itself, and B2 gram schmidt to R1's plane. B2 and V1-2 will be changed.
// What vector we use for Y here doesnt matter. Ill just use Y+, call it PY, standing for Placeholder Y
Prospector's Gambit
Numerical Reflection: 1
Selection Distillation
Prospector's Gambit
// Stack is now, R1, B2, R1
Rotation Gambit II
// Stack is now, B2, R1, R1
// It needs to be, B2, R1, B2, R1
Gemini Decomposition
Rotation Gambit II
// Stack is now, B2, R1, B2, R1
Jester's Gambit
Gemini Decomposition
Rotation Gambit II
Multiplicative Distillation
Prospector's Gambit
Gemini Decomposition
Multiplicative Distillation
Division Distillation
Multiplicative Distillation
// Stack is now, B2.5, B2, R1, ...
Numerical Reflection: -1
Multiplicative Distillation
Additive Distillation
// Normalize
Gemini Decomposition
Length Purification
Division Distillation
// Stack is now, B-C3, R1, [A2,B2,C2,V1-2], VF.X, VF.Z, (PRI)
// Now lets make a construct list again.
// B-C3 will be the Z, R1 will be the X, Y+ will be the Y
Jester's Gambit
Vector Reflection +Y
Jester's Gambit
Numerical Reflection: 3
Flock's Gambit
Retrograde Purification
// Stack is now, [R1,Y+,B-C3], [A2,B2,C2,V1-2], VF.X, VF.Z, (PRI)
// Time to basis change B2 and V1-2!
Prospector's Gambit
Numerical Reflection: 1
Selection Distillation
Prospector's Gambit
Jester's Gambit
// Stack is now, B2, [R1,Y+,B-C3], [R1,Y+,B-C3], [A2,B2,C2,V1-2], VF.X, VF.Z, (PRI)
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Bookkeeper's Gambit: vv
Vector Exaltation
// Stack is now, B3, [R1,Y+,B-C3], [A2,B2,C2,V1-2], VF.X, VF.Z, (PRI)
// Time for V1-2
Rotation Gambit II
Prospector's Gambit
Numerical Reflection: 4
Selection Distillation
// Stack is now, V1-2, [R1,Y+,B-C3], [A2,B2,C2,V1-2], B3, VF.X, VF.Z, (PRI)
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Jester's Gambit
Speaker's Decomposition
Jester's Gambit
Rotation Gambit II
Prospector's Gambit
Multiplicative Distillation
Rotation Gambit II
Bookkeeper's Gambit: vv
Vector Exaltation
// Stack is now, V1-3, [A2,B2,C2,V1-2], B3, VF.X, VF.Z, (PRI)
Rotation Gambit
Vector Disintegration
Bookkeeper's Gambit: vv-
Jester's Gambit
Vector Disintegration
Bookkeeper's Gambit: vv-
Jester's Gambit
Division Distillation
// Finally, we have, VF.Y
// Stack is now, VF.Y, [A2,B2,C2,V1-2], VF.X, VF.Z, (PRI)
// Time to clean up.
Jester's Gambit
Bookkeeper's Gambit: v
// Stack is now, VF.Y, VF.X, VF.Z, (PRI)
Rotation Gambit
Vector Exaltation
// Finally we have VF. Vector Final.
// Now we just gotta restore the ravenmind
Jester's Gambit
Huginn's Gambit

Re: Linear Algebra w/o Matrices

Posted: Sun May 25, 2025 2:11 pm
by Akumu9K
I have made a hyperoptimized version, based on the last section here: https://www.desmos.com/3d/nzvjqrdbbl

Its 80 patterns long so 1/5th the length of the previous one
Spoiler
aaeddaaeddaadaaddqddwedewNumerical Reflection: -1waqawwaawNumerical Reflection: 3aadaNumerical Reflection: 5aadaaadaaddqddwedewNumerical Reflection: -1waqawwaawaadadaawaadaaddqddwedewNumerical Reflection: -1waqawwaawddqddaawddaadaaddqddwedewNumerical Reflection: -1waqawwaawaadaaNumerical Reflection: 7aadawaqawaawddNumerical Reflection: 4aadawaqawwdedwaawddaadaaNumerical Reflection: 7aadawaqawaawddNumerical Reflection: 6aadawaqawwdedwaadadaawNumerical Reflection: 7aadawaqawaawddNumerical Reflection: 5aadawaqawwaawNumerical Reflection: 5aadaaadaaddqddwedewNumerical Reflection: -1waqawwaawaadaaNumerical Reflection: 8aadawaqawaawddNumerical Reflection: 6aadawaqawwdedwaawddeqqqqq

Code: Select all

// Based on https://www.desmos.com/3d/f8suvijh8u the hyper-optimized section.
// Input sequence on the stack, from top to bottom:
// A, B, C, V1

Prospector's Gambit
Prospector's Gambit
// Stack is now, A,B, A,B,C,V1
Gemini Decomposition
Rotation Gambit II
// Gram Schmidt Process, v1 being projected, v2 being projected onto, inputs: v1, v2, v1
// Stack is now, A,B,A, A,B,C,V1
Power Distillation
Numerical Reflection: -1
Multiplicative Distillation
Additive Distillation
// Stack is now A-2, A,B,C,V1
Numerical Reflection: 3
Fisherman's Gambit II
// Stack is now, B,A-2, A,B,C,V1
Numerical Reflection: 5
Fisherman's Gambit II
// Stack is now, C,B,A-2, ...
Gemini Decomposition
Rotation Gambit II
Power Distillation
Numerical Reflection: -1
Multiplicative Distillation
Additive Distillation
// Stack is now, C-2,A-2, A,B,C,V1
Dioscuri Gambit
// Stack is now, C-2,A-2,C-2,A-2, ...
Gemini Decomposition
Rotation Gambit II
Power Distillation
Numerical Reflection: -1
Multiplicative Distillation
Additive Distillation
// Stack is now, C-3, C-2,A-2, ...
Rotation Gambit II
Jester's Gambit
// Stack is now, A-2,C-2, C-3
Gemini Decomposition
Rotation Gambit II
Power Distillation
Numerical Reflection: -1
Multiplicative Distillation
Additive Distillation
// Stack is now, A-3, C-3, A,B,C,V1
Gemini Decomposition
// Stack is now, A-3,A-3, C-3, A,B,C,V1
Numerical Reflection: 7
Fisherman's Gambit II
Multiplicative Distillation
// Stack is now, V1.a, A-3, C-3, A,B,C,V1
Jester's Gambit
Numerical Reflection: 4
Fisherman's Gambit II
Multiplicative Distillation
// Stack is now, A.a, V1.a, C-3, A,B,C,V1
Division Distillation
// Stack is now VF.x, C-3, A,B,C,V1
Jester's Gambit
Gemini Decomposition
Numerical Reflection: 7
Fisherman's Gambit II
// Stack is now, V1, C-3, C-3, VF.x, A,B,C,V1
Multiplicative Distillation
// Stack is now, V1.c, C-3, VF.x, A,B,C,V1
Jester's Gambit
Numerical Reflection: 6
Fisherman's Gambit II
Multiplicative Distillation
// Stack is now, C.c, V1.c, VF.x, ...
Division Distillation
// Stack is now, VF.z, VF.x, A,B,C,V1
Dioscuri Gambit
// Stack is now, VF.z, VF.x, VF.z, VF.x, A,B,C,V1
Numerical Reflection: 7
Fisherman's Gambit II
Multiplicative Distillation
// Stack is now, R1.c, VF.x, VF.z, VF.x, A,B,C,V1
Jester's Gambit
Numerical Reflection: 5
Fisherman's Gambit II
Multiplicative Distillation
// Stack is now, R1.a, R1.c, ...
Additive Distillation
// Stack is now, R1, VF.z, VF.x, A,B,C,V1
Numerical Reflection: 5
Fisherman's Gambit II
// Stack is now, B, R1, ...
Gemini Decomposition
Rotation Gambit II
// Stack is now, B, R1, B, ...
Power Distillation
Numerical Reflection: -1
Multiplicative Distillation
Additive Distillation
// Stack is now, B-3, VF.z, VF.x, A,B,C,V1
Gemini Decomposition
Numerical Reflection: 8
Fisherman's Gambit II
// Stack is now, V1, B-3, B-3, ...
Multiplicative Distillation
// Stack is now, V1.b, B-3, VF.z, VF.x, A,B,C,V1
Jester's Gambit
Numerical Reflection: 6
Fisherman's Gambit II
Multiplicative Distillation
// Stack is now, B.b, V1.b, VF.z, VF.x, A,B,C,V1
Division Distillation
// Stack is now, VF.y, VF.z, VF.x, ...
Jester's Gambit
Vector Exaltation

Re: Linear Algebra w/o Matrices

Posted: Sun Jun 01, 2025 10:30 pm
by Akumu9K
Alright so uhhhh a couple of things.

First of all, I found a problem in the 420 pattern version. I naively assumed that, after the basis change, we can just substitute in Y+ for B, and while that holds true for all cases where B equals 1 and isnt on the opposite side compared to Y+… It doesnt hold true for otherwise. The solution is simple, just grab the B from ravenmind, find its length and multiply the Y+ with it (Might wanna do a dot product normalization thingy to also cover for the reflected cases), Im too lazy to update the post above though so I leave this as an exercise to the reader (Ok slight update, I have since gotten over my laziness and updated it.)

So yeah uhhhhh, dont make naive assumptions or your mathematical wonders will die, in horrific fashion, while you cry for 30 minutes wondering why.

Anyways second of all, I have optimized it even further! I have found a method that closely resembles the Hyper Optimized version with a slight change, and the presence of the cross product means that in 3D (And 3D only. The 4D version with gram schmidt is less efficient than Hyper Optimized) it is even more efficient/small, coming in at a whopping 43 patterns, almost 10th of the original method.
Spoiler
Numerical Reflection: 3aadaaaeddwdedwaadaaNumerical Reflection: 4aadawaqawaawddNumerical Reflection: 6aadawaqawaawddwdedwNumerical Reflection: 2aadaNumerical Reflection: 4aadawdedwaadaaNumerical Reflection: 6aadawaqawaawddNumerical Reflection: 7aadawaqawaawddwdedwNumerical Reflection: 4aadaNumerical Reflection: 6aadawdedwaadaaNumerical Reflection: 5aadawaqawaawddNumerical Reflection: 8aadawaqawaawddwdedwddqddeqqqqq

Code: Select all

// This is a slightly modified version of the Hyper-Optimized method,
// Relying not on constructed vectors but rather simple orthogonalization.
// Because of the presence of the cross product in 3 dimensional space,
// It is more optimized than the Hyper-Optimized method, but only in 3D space.

// Input Sequence on the stack, from top to bottom:

// A, B, C, V1

// Note: Cross product is not commutative.
// For this to work, the components need to be in the order of, C, B, A ... on the stack, from top to bottom.
// So our three operations will be, BA, AC and CB.
// Otherwise it reflects the vector along one axis and thats bad

Numerical Reflection: 3
Fisherman's Gambit II
Prospector's Gambit
// Stack is now, A,C, A,B,C,V1
Division Distillation
Gemini Decomposition
// Stack is now, AC.cross, AC.cross, A,B,C,V1
Numerical Reflection: 4
Fisherman's Gambit II
Multiplicative Distillation
Jester's Gambit
// Stack is now, AC.cross, AC-B.dot, A,B,C,V1
Numerical Reflection: 6
Fisherman's Gambit II
Multiplicative Distillation
// Stack is now, AC-V1.dot, AC-B.dot, ...
Jester's Gambit
Division Distillation
// Stack is now, VF.y, A,B,C,V1
// Now we just repeat till we get VF.x and VF.z, and then rearrange and vector exalt.
Numerical Reflection: 2
Fisherman's Gambit II
Numerical Reflection: 4
Fisherman's Gambit II
// Stack is now, B,A, VF.y, ...
Division Distillation
Gemini Decomposition
// Stack is now, BA.cross, BA.cross, VF.y, A,B,C,V1
Numerical Reflection: 6
Fisherman's Gambit II
Multiplicative Distillation
Jester's Gambit
// Stack is now, BA.cross, BA-C.dot, VF.y, A,B,C,V1
Numerical Reflection: 7
Fisherman's Gambit II
Multiplicative Distillation
// Stack is now, BA-V1.dot, BA-C.dot, ...
Jester's Gambit
Division Distillation
// Stack is now, VF.z, VF.y, A,B,C,V1
Numerical Reflection: 4
Fisherman's Gambit II
Numerical Reflection: 6
Fisherman's Gambit II
// Stack is now, C,B, VF.z, VF.y, A,B,C,V1
Division Distillation
Gemini Decomposition
// Stack is now, CB.cross, CB.cross, VF.z, VF.y, A,B,C,V1
Numerical Reflection: 5
Fisherman's Gambit II
Multiplicative Distillation
Jester's Gambit
// Stack is now, CB.cross, CB-A.dot, VF.z, VF.y, A,B,C,V1
Numerical Reflection: 8
Fisherman's Gambit II
Multiplicative Distillation
// Stack is now, CB-V1.dot, CB-A.dot, ...
Jester's Gambit
Division Distillation
// Stack is now, VF.x, VF.z, VF.y, A,B,C,V1
Rotation Gambit II
Vector Exaltation