RSSAmplifier

Blog

codethrasher

Recent content on codethrasher

codethrasher.comRSS feed ↗111 posts

Latest posts

Galactic-level Management

I’ve always been interested in simulations. In college I would write very simple simulations, graph the output and marvel at the patterns that would emerge from things like the periodic oscillations of a predator/prey population set given a stable environment. It was so much fun to do that even if I knew the outcome. It was sort of my way of playing a game without actually playing a game. I…

The Feynman Technique

I’m reposting this. I was looking through my old notes and stumbled onto this oldie. It really is such a superb way to dive into a subject. A four-step process to test your understanding of a given subject matter. Get a piece of paper and write the name of the technique/concept at the top Explain the concept in the most basic language possible. Avoid all technical jargon and pretend…

Org-mode cheatsheet

Tags Search tags: SPC n m or SPC o a m Add tag: SPC m q Links Insert link: SPC m l l File links have the structure [[file:relative_link_to_file][some_title]​] To link to a specific heading in a file ​ [[file:relative_link::header title][some_title]] header title can have spaces in it, e.g. relative_link.org::A Heading in a file External (web) links have the structure [​[full_url][some_title]​] To…

Curl a GraphQL API

1 2 3 4 5 6 7 curl -0 -v -X POST https://some.api.com/graphql \ -H 'Content-Type: application/json' \ -d @- << EOF { 'query': 'query { someQuery (someArg: false) { name } }' } EOF curl will probably complain about the -X POST being inferred, but it shouldn&rsquo;t harm anything. It can be left out.

Function Overloading

Take a function like below&hellip; 1 2 3 4 5 6 7 8 type Combinable = string | number function add ( a : Combinable , b : Combinable ) : Combinable { if ( typeof a === 'string' || typeof b === 'string' ) { return a . toString () + b . toString () } return a + b } If we were to use this function like this: 1 2 const x = add ( 'black cat' , 'white dog' ) x . split ( ' ' ) // TS compiler will complain…

Nullish Coalescing

1 2 // say you have some var hangin' around called `name` let x : string = name ?? '(no name)' ?? is the nullish coalescing operator. It differs from || in that if you had (in the above example) 1 let x : string = name || '(no name)' name equal to an empty string (which is falsey) x would then be assigned the value (no name) . The nullish coalescing operator will only use the right-hand assignment…

Recursive Type Aliases

In TS@4 a type can reference itself, e.g. 1 2 3 4 5 6 7 8 9 type JSONValue = | string | number | boolean | null | JSONValue [] | { [ k : string ] : JSONValue } Previously, this would not be possible without some messy hacks.

Labeled Tuple Types

1 type Address = [ number , string , string , number ] Say you now have a function printAddress which takes an Address type as its arg. 1 2 3 function printAddress (... address : Address ) { // ...stuff } Your editor (before TS@4 ) would hint that the arguments were something like: address_0: number, address_1: string, ...etc which is not really helpful because address_0: number doesn&rsquo;t…

Variadic Tuple Types

1 type Foo < T extends any [] > = [ boolean , ... T , boolean ] Before TS@4.0 ...T would need to be the last element, but now we can spread the T type nested between known types; e.g. &ldquo;This array will have a boolean, with some stuff (strings, numbers, etc.), and another boolean&rdquo;.

Composite Builds

TypeScript has a way of describing a build process as multiple subpieces of a project. This saves from having to build every piece, and instead build independent parts and stitch them together as needed. In a monorepo environment, multiple packages will have multiple builds and, possibly, refer to those builds amongst each other. The root tsconfig.json file can be used, but a problem of…

Jest Setup for a Monorepo

Out of the box, Jest mostly works in a Monorepo environment, with the exception of a few Babel plugins so that (as an example) TypeScript works. Needs: @babel/preset-env (Babel will transform whatever it needs to transform based on the build target, e.g. TypeScript, IE11, ES6, Node10, etc.) @babel/preset-typescript (Babel will strip out the symbols that are specific to TypeScript) The root-level…

Monorepos

Colocation

&ldquo;colocation&rdquo; is a pattern wherein you keep the query/mutation as close to the consuming component as possible. In many instances, it&rsquo;s in the exact file. This is in contrast with the DRY approach, which would beg the author to push queries/mutations higher up and imported into whichever file needs it.

Yarn-NPM

package.json resolutions field yarn specific Allows you to force the use of a particular version for a nested dependency. e.g.: 1 2 3 4 'devDependencies' : { '@angular/cli' : '1.0.3' , 'typescript' : '2.3.2' } yarn.lock will contain: 1 2 3 4 5 6 7 'typescript@>=2.0.0 <2.3.0' : version '2.2.2' resolved…

Cipher

A cipher is defined over the spaces of: All Keys, \(\mathscr{K}\) All Messages, \(\mathscr{M}\) All Cipher texts, \(\mathscr{C}\) Cipher (defined as a triple, \((\mathscr{K}, \mathscr{M}, \mathscr{C})\)) as a pair of algorithms \((\mathbf{E}, \mathbf{D})\) where \(\mathbf{E}\) represents the encryption algorithm and \(\mathbf{D}\) represents the decryption algorithm. \begin{equation} \mathbf{E}:…

Distribution Vector

A vector with non-negative components (representing specific probabilities) which add up to one e.g. \begin{equation} (P(x_{0}), P(x_{1}),&hellip;,P(x_{n})) \end{equation} Also known as: Stochastic Vector

Uniform Distribution

\begin{equation} x \in U:P(x) = \frac{1}{|U|} \end{equation} Where \(|U|\) is the size of the universe (set). In Probability Theory, a uniform distribution assigns an equal probability to each element of a given set.

Point Distribution

x 0 : P(x) = 1,∀ x ≠ x 0 : P(x) = 0 In Probability Theory, a point distribution is a distribution which assigns all the probability to a given point (set element).

Cryptography

Digital Signature

Digital Signature

A function of the content being &ldquo;signed&rdquo;

Cost Function

The measurement of accuracy of a hypothesis function . The accuracy is given as an average difference of all the results of the hypothesis from the inputs (\(x\)&rsquo;s) to the outputs (\(y\)&rsquo;s). \begin{equation} J(\Theta_{0},\Theta_{1})=\frac{1}{2m}\sum_{i=1}^{m}(h_{\Theta}(x_{i}) - y_{i})^{2} \end{equation} where \(m\) is the number of inputs (e.g. training examples) This function is also…

Machine Learning

Gradient Descent Cost Function Hypothesis Function Artificial Neural Network

Gradient Descent

An optimization algorithm for finding the local minimum of a differentiable function. (The red arrows show the minimums of \(J(\Theta_{0},\Theta_{1})\), i.e. the cost function ) To find the minimum of the cost function , we take its derivative and &ldquo;move along&rdquo; the tangential line of steepest (negative) descent. Each &ldquo;step&rdquo; is determined by the coefficient \(\alpha\), which…

Hypothesis Function

A function which maps values \(x\) to an output value \(y\). Historically, in ML, hypothesis functions are denoted \(h(x^{(i)})\).

Artificial Neural Network

Artificial Neural Network (ANN) Layers All learning occurs in the layers. In the image, below, there are three layers, but there could be only one, or many more. In the example image the first layer is known as the Input Layer , the second the Hidden Layer , and the third the Output Layer . In a 3+ layered ANN, any layer that is not the input/output layer is a Hidden Layer . Input The data being…

Covectors

A linear mapping from a vector space to a field of scalars. In other words, a linear function which acts upon a vector resulting in a real number (scalar) \begin{equation} \alpha\,:\,\mathbf{V} \longrightarrow \mathbb{R} \end{equation} Simplistically, covectors can be thought of as &ldquo;row vectors&rdquo;, or: \begin{equation} \begin{bmatrix} 1 & 2 \end{bmatrix} \end{equation} This might look…

Differential Geometry

Tensors Tensor Product

Linear Algebra

Bases Bases Transformation Coordinate Transformation Covectors Dual Space Identity Matrix Invertible Matrix Invertible Matrix Orthonormal Basis Tensor Product Tensors Vector Space Axioms (Vector Space)

Linear Mapping

A mapping from \(\mathbf{V} \rightarrow \mathbf{W}\) that preserves the operations of addition and scalar multiplication. Also known as Linear Map Linear Transformation Linear Function

Multilinear Map

A function of several variables that is linear, separately, in each variable. A multilinear map of one variable is a standard linear mapping .

Tensor Product

Dual Space

The space of all linear functionals \(f:V\rightarrow \mathbb{R}\), noted as \(V^{*}\) The dual space has the same dimension as the corresponding vector space or, given a space \(V\), with bases \((v_{1},&hellip;,v_{n})\), there exists a dual space \(V^{*}\) with a dual basis \((v^{*}_{1},&hellip;,v^{*}_{n})\).

Dual Vector Space

The space of all linear functionals \(f:V\rightarrow \mathbb{R}\), noted as \(V^{*}\) The dual space has the same dimension as the corresponding vector space or, given a space \(V\), with bases \((v_{1},&hellip;,v_{n})\), there exists a dual space \(V^{*}\) with a dual basis \((v^{*}_{1},&hellip;,v^{*}_{n})\).

Heliosphere

The bubble, created by the Sun&rsquo;s plasma (see Solar Wind ), which encompasses the Sun itself. Outside of this bubble, the Sun&rsquo;s plasma is overwhelmed by the Interstellar plasma.

Solar Wind

TODO

Tensors

As a linear representation A tensor can be represented as a vector of x-number of dimensions. Basically, a generalization on top of scalars, vectors, and matrices. The specific &ldquo;flavor&rdquo; of the tensor (i.e. is it a scalar, vector, or matrix) is clarified by referring to the tensor&rsquo;s &ldquo;rank&rdquo;. For instance; a rank 0 tensor is a scalr, rank 1 tensor is a one-dimensional…

Kronecker Delta

\begin{equation} \delta_{ij}= \begin{cases} 0 & \text{if i \(\neq\) j}\\\ 1 & \text{if i \(=\) j} \end{cases} \end{equation}

Bases

a basis for an n-dimensional vector space \(V\) is any ordered set of linearly independent vectors \((\mathbf{e}_{1}, \mathbf{e}_{2},&hellip;,\mathbf{e}_{n})\) An arbitrary vector \(\mathbf{x}\) in \(V\) can be expressed as a linear combination of the basis vectors: \begin{equation} \mathbf{x}\,=\,\sum\limits_{i = 1}^{n} \mathbf{e}_{i}x^{i} \end{equation} See Bases Transformation , Coordinate…

Orthonormal Basis

An orthonormal basis is a basis where all the vectors are one unit long and all perpendicular to each other (e.g. the Cartesian plane)

Bases Transformation

Consider two bases \((\mathbf{e}_{1},\mathbf{e}_{2})\) and \((\mathbf{\tilde{e}}_{1},\mathbf{\tilde{e}}_{2})\), where we consider the former the old basis and the latter the new basis . Each vector \((\mathbf{\tilde{e}}_{1},\mathbf{\tilde{e}}_{2})\) can be expressed as a linear combination of \((\mathbf{e}_{1},\mathbf{e}_{2})\): \begin{equation}…

Identity Matrix

\begin{equation} \mathbf{I}(\mathbf{X})=\mathbf{X} \end{equation} Where any \(nxn\) matrix is established via the Kronecker Delta , e.g. \begin{equation} \mathbf{I}_{ij}\,=\,\delta_{ij} \end{equation}

Invertible Matrix

A matrix, which when multiplied by another matrix, results in the identity matrix . \begin{equation} \mathbf{A}\mathbf{A}^{-1} = I \end{equation} e.g. \begin{equation} \begin{bmatrix} a & b\\\ c & d \end{bmatrix} \begin{bmatrix} d & -b\\\ -c & a \end{bmatrix}= \begin{bmatrix} 1 & 0\\\ 0 & 1 \end{bmatrix} \end{equation}

Vector Space

also known as a linear space A collection of objects known as &ldquo;vectors&rdquo;. In the Euclidean space these can be visualized as simple arrows with a direction and a length, but this analogy will not necessarily translate to all spaces. Addition and multiplication of these objects (vectors) must adhere to a set of axioms for the set to be considered a &ldquo;vector space&rdquo;. Addition (+)…

Coordinate Transformation

Axioms (Vector Space)

To qualify as a vector space , a set \(V\) and its associated operations of addition (\(+\)) and multiplication/scaling (\(\cdot\)) must adhere to the below: Associativity \begin{equation} \mathbf{u}+(\mathbf{v}+\mathbf{w}) = (\mathbf{u} + \mathbf{v}) + \mathbf{w} \end{equation} Commutivity \begin{equation} \mathbf{u} + \mathbf{v} = \mathbf{v} + \mathbf{u} \end{equation} Identity of Addition There…

Invariance (Mathematics)

An property (of a mathematical object) is invariant if, after some operation(s) are applied, that property remains unchanged. For instance, in a geometrical space where the concept of &ldquo;length&rdquo; is defined (by some metric); a physical object, say a pencil, will maintain its characteristics (length) despite a change of coordinates (e.g. polar to cartesian). In short, vectors are…

Cosmology

The Inflationary Universe Standard Model Cosmic Inflation Cosmological Constant Cosmic Microwave Background

The Inflationary Universe

source The Inflationary Universe: A Possible Solution To The Horizon And Flatness Problems (Guth, 1980) Questions I still have DONE WHY#1: why is that approximation unstable? See Flatness Problem Abstract The initial conditions defined in the Standard Model present two problems: The early universe is defined to be homogeneous despite the massive distances between regions (causal disconnect) The…

Standard Model (Cosmology)

This refers to the Cosmological &ldquo;Standard Model&rdquo;, i.e. the \(\Lambda\)CDM. This is not the same as the Standard Model of Particle Physics Lambda-CDM The lambda-cdm or, lambda cold-dark-matter, is a three-parameter description of the Big Bang Cosmological model parametrized by: the Cosmological Constant \(\Lambda\) dark matter normal matter Of the cosmological models, this presents the…

Cosmological Principle

The Cosmological Principle states that at large enough scales (>100Mpc) the universe&rsquo;s matter distribution is isotropic and homogeneous and should not produce irregularities in the large-scale structure of the universe over the course of its evolution.