0 obsidian/miscnotes

miscellaneous notes


Table of Contents

Lagrange Multipliers

The problem: Maximize scalar function f(\vec{v}) under the constraints c_i(\vec{v}) = 0.

Solution: Solve for \nabla f(\vec{v}) = \sum_i \lambda_i \nabla c_i(\vec{v}). The values of the \lambda_i do not matter, only the value of \vec{v}.

If the gradient of f does not lie purely in the space spanned by the gradients of the constraints, then we can always increase f by moving along the constraint manifold (moving along the constraint manifold = moving in a direction perpendicular to the gradients of the constraint functions, think about contours of constant value). Adding constraints removes constraints on the gradient of f.

Cramer’s Rule

A system can be represented as

^abe765

where we are solving for x, y, z and know everything else.

Because the area of a parallelepiped is base times height, (diagram most likely needed here)

^ab78d8

For determinants, we know

[[Cramer’s Rule#^ab78d8|Focus on x]]: The [[Cramer’s Rule#^abe765|original equation]] says \begin{bmatrix} x \\ y \\ z\end{bmatrix} transformed by the matrix must be \begin{bmatrix} a \\ b \\ c\end{bmatrix}, so we know

^84f58c

By taking the determinants on both sides of [[Cramer’s Rule#^84f58c|this equation]] and substituting in x, we get Cramer’s rule:

Similar logic can be applied for y and z.

\alpha-\beta pruning Minimax/Negamax search

Returns a lower bound on the true score of a node

**Search function returns a lower bound for the real score, unless

Fail hard

// alpha = best score we can get (from whole search up until this depth)
// beta = best score our opponent can get (from whole search up until this depth)
// fail hard: Only returns values in [alpha, beta]
int search(Position pos, int alpha, int beta) {
	for (auto move : pos.legal_moves()) {
		pos.make(move);
		
		// next beta = our best move
		// next alpha = best score opponent can get (beta)
		// negatives for perspective change
		int score = -search(pos, -beta, -alpha);
		
		pos.unmake(move);

		alpha = std::max(score, alpha);
		if (alpha >= beta) {
			// higher up, the search found a better
			// branch, so this path doesn't need to be explored further
			return beta;
		}
	}

	return alpha;
}

Fail soft Version

Can return values outside of the [\alpha, \beta] range

int search(Position pos, int alpha, int beta) {
	int val = std::numeric_limits<int>::min();
	for (auto move : pos.legal_moves()) {
		pos.make(move);
		val = std::max(val, -search(pos, -beta, -alpha));
		pos.unmake(move);

		alpha = std::max(val, alpha);
		if (alpha >= beta)
			return val;
	}

	return val;
}

Null windows

Quick boolean testing

int test = -search(pos, -alpha - 1, -alpha);

Comp Arch

Boolean Problem (2025-01-23)

Simplify the following expression:

Solution: Just expand out using DeMorgan’s + axioms and eventually you will get

where \oplus denotes XOR.

Derivation: Note that

We can write a simple expression for a \oplus b \oplus c by nesting these expressions, using both versions for the a\oplus b subexpression in (a\oplus b)\oplus c:

Expanding the extreme left term with de Morgan’s twice:

However, by the idempotency we can expand it and AND it together with itself with no effect:

By the a + b = a + \overline{a}b absorption identity, we can further do

Substituting this into the original expression, we obtain the full problem.

Buffer

Aout = A
00
11

AND

ABout = AB
000
010
100
111

OR

ABout = A+B
000
011
101
111

Inverter

Aout = \overline{A}
01
10

NAND

ABout = \overline{AB}
001
011
101
110

NOR

ABout = \overline{A+B}
001
010
100
110

Curveball 1

ABCout = A(B+C)
0000
0010
0100
0110
1000
1011
1101
1111

Curveball 2

ABCout = A+BC
0000
0010
0100
0111
1001
1011
1101
1111

Harmonic Series Stuff

The Actual Stuff

Extending Where n\le0

Cases for n\gt0

Cursed U-sub

e^x Stuff

finally:

Orgo Chem 2022-09-25

R = carbon-containing thing ()

HybridizationEndInternal
sp^2aldehyde (\ce{R-C(=O)H})ketone \ce{RC(=O)R'}
sp^3alcohol (\ce{ROH})ether \ce{R-O-R'}
Both(carboxyllic) acid (\ce{C(=O)OH})ester

Primary Amines: \ce{NH_2R} Secondary Amines: \ce{NHR^1R^2} Tertiary Amines: \ce{NR^1R^2R^3}

Le Chatelier’s 2022-12-07

\ce{H2(g) + 3H2(g) <-> 2NH3(g) \Delta H = -129 kJ/mol}

Equilibrium will counteract any stress

Increase in temperature

Math of Kinetics

For the reaction \ce{aA + bB + ...-> pP + ...}

Let A(t) be the concentration of the limiting reactant in the reaction. Let a be the coefficient that reactant has in the equation. Let R(t) be the rate of the reaction. Let k be any positive real number. Let n be the order of the reaction.

For zeroth-order n=0 reactions,

For first-order n=1 reactions,

For second order n=2 reactions, A'(t)=-a\cdot k\cdot A(t)^2 A(t)=(kt+A(0)^{-1})^{-1} \therefore {1\over{A(t)}} is linear with respect to time, and its slope is the value of k.

Test Suite for TikzJax


Log in to Comment

Firebase not Loaded