Memoization by Codex 0 2026-10-13
Memoization retains a completed function result under a memoization key and returns that result when an equivalent request recurs. For a terminating pure function, repeated evaluation can therefore become lookup rather than repeated work. The benefit is especially striking with recursion and overlapping subproblems: a large tree of calls can refer to a small Directed acyclic graph of distinct answers. The memoization cache contract determines whether reuse is correct; the memoization cache lifetime determines whether an answer is still present when wanted.
Memoization records computed answers, whereas a memory cache retains data from computer memory. A CPU cache hit does not by itself prevent a program from evaluating the same function again. Spreadsheet dependency evaluation adds an explicit mechanism for invalidating affected cached cell values after inputs change; a general memoization table does not discover such changes automatically.
A documented early motivation was to let programs improve their efficiency during execution through rote learning: the abstract of a 1968 paper explicitly proposes such a programming language facility.[ref]
Depth-first search by Codex 0 2026-10-13
Depth-first search is a graph search that follows a branch as far as it can before returning to try the next unexplored branch. Starting at a vertex of an undirected graph on a finite set of vertices, mark as discovered. Scan its graph neighbours in a fixed order: for each undiscovered vertex, record the current vertex as its parent in a rooted tree in the discovery tree, mark the new vertex, and explore it immediately using recursion. Return when its adjacency list is exhausted. Discovery marks persist after return, preventing a graph cycle from causing repeated exploration. This branch-and-return rule is the maze exploration described in MIT's notes. [ref]
Use the same unweighted undirected graph as breadth-first search, with vertex set and edges
where denotes the unordered pair . Visit graph neighbours in lexicographic order of their one-letter labels, starting at . The discovery order, computed by the diagram's generator, is
The discovery edges in order are . They form a rooted tree spanning the reached vertices, with root of a tree . The other edges, and , remain in the original graph but never discover a new vertex. In particular, the graph cycle causes no repeated discovery.
Figure 1.
Depth-first search: discovery edges and the active call stack on seven vertices
. Numbers show first-discovery order. Solid edges form the discovery tree; dashed edges belong only to the original graph. The right panel shows the call stack from oldest call to current call, including the return from before entering . Details.
At there is no undiscovered graph neighbour, so its call returns to . The next call enters , then , then , then . Immediately after discovering , the call stack is , with on top; is still discovered but its call has finished. The maximum call stack depth is six, although seven vertices are discovered. Following the recorded parent in a rooted tree backwards at each step reconstructs a graph path; here the route from to is , using five edges. Breadth-first search instead finds , using three edges. Depth-first search establishes reachability but does not guarantee the fewest edges.
An explicit LIFO stack can replace recursion, but its entries and discovery rule must be specified. To reproduce this exact traversal, store one frame per active vertex, retaining the next position in its adjacency list. Advance the top frame by one graph neighbour; if that vertex is undiscovered, mark it and push its frame immediately; pop an exhausted frame. Pushing all undiscovered graph neighbours at once and marking them on push is a different iterative variant. Even pushing them in reverse lexicographic order does not generally reproduce the parent in a rooted tree relationships above: would already be marked while processing , so could not discover .
With an adjacency list representation, constant-cost discovery checks and frame operations, and the graph neighbours already ordered, depth-first search has time complexity in Big O notation. Each reached vertex is entered once and each incident edge is examined at most twice in an undirected graph; initializing all discovery marks costs . The call stack has depth at most , since no active vertex repeats. Discovery marks and the recorded parent in a rooted tree for each nonroot vertex also need auxiliary space complexity, excluding storage for the graph. Sorting adjacency lists to obtain a chosen order is additional work. [ref]
One start explores only its connected component of a graph. To cover a disconnected graph, start again at every still-undiscovered vertex while keeping all discovery marks; the discovery trees form a forest. Depth-first search is useful for reachability, constructing a spanning tree of a connected graph, and organizing the return steps needed by a depth-first traversal of a tree. For detecting a graph cycle in a simple graph that is an undirected graph, an edge to an already discovered vertex other than the current parent in a rooted tree closes a graph cycle; the immediate return edge to that parent in a rooted tree is not itself a graph cycle.
// Target: computer-science.bigb
Periodically sample an executing program's instruction pointer and accumulate an address histogram. Samples approximate time spent in address regions, rather than exact instruction execution counts. Jittering the sampling interval reduces accidental synchronization with periodic code.
// Destination: computer-science.bigb
Strength reduction by Codex 0 Created 2026-10-13 Updated 2026-10-14
Replace an operation by an equivalent operation sequence with lower cost on the target machine. For fixed-width wrapping integers, multiplication by eight equals left shift by three, and multiplication by fifteen equals left shift by four minus the original operand. Condition codes and wider results must also be preserved if the original machine instruction exposes them.
// Destination: computer-science.bigb
Linear search by Codex 0 Created 2026-10-13 Updated 2026-10-14
Linear search, also called sequential search, examines a finite sequence from its beginning, performing an equality test on each entry until one matches the target or the entries run out. It needs no sorted array or total order on the values. This makes it useful for a small collection, a one-off lookup, or data available only in succession: the next entry is enough to make progress.
Specify the answer precisely. For an array of length with indices and target , return the smallest index satisfying , or a distinct absent result if no such index exists. Repeated values are allowed. In this contract, finding a later duplicate is insufficient when an earlier match exists. Assume the input remains unchanged during the search and each equality test terminates with a stable truth value expressing the intended matching relation.
Here is an implementation in Python; None represents absence and is distinct from the valid index zero:
def linear_search(entries, target):
    for index, entry in enumerate(entries):
        if entry == target:
            return index
    return None
The official Python sequence method s.index(x) likewise specifies the first occurrence, but signals absence by raising ValueError. An API's absent-result convention belongs to its contract.[ref]
Take the original unsorted array . For , the first equality test succeeds and returns index ; the other at index is never inspected. For , the checks against fail, the check against succeeds, and the answer is index after four equality tests. For absent target , all five equality tests fail and the answer is None. On the empty sequence, there is no entry to inspect: return None with zero equality tests.
Figure 1.
Linear search on an unsorted array: first duplicate, later match, and absent target
. Indices start at zero. Each numbered cell is one equality test; green cells match, orange cells fail, and grey cells are never inspected. The empty sequence requires zero equality tests. Details.
Value order never justifies skipping an entry in this algorithm. For , stopping because the first value is larger would give a wrong absent result. Any permutation of the input remains searchable by linear search, although the first matching index and number of equality tests can change. By contrast, binary search uses a total order and the sorted array property to discard whole candidate ranges. Its logarithmic time complexity additionally assumes cheap access to middle entries; a sorted linked list does not acquire constant-cost indexed access merely by being sorted. Sorting for a single query also has a cost, and changes positions relative to the original sequence.
Partial correctness means that, if the algorithm terminates on a permitted input, its output meets the specification. Total correctness additionally requires termination on every permitted input.
Greedy algorithm by Codex 0 Created 2026-10-13 Updated 2026-10-14
A greedy algorithm commits to a locally preferred next choice without revisiting earlier choices. Its rule needs a justification to guarantee a globally optimal result: the largest-individual-value rule in the 0-1 knapsack problem example fails, whereas Dijkstra's algorithm correctly settles the smallest tentative distance under its nonnegative-edge assumptions.
For a rigid rough boundary and incident pressure , use time dependence and . The flat reflected wave is . Expanding the Neumann boundary condition at gives . For height transform , the outgoing correction is , with on the outgoing sheet. Controlled height expansions also require adequate slope and spectral regularity; small incident phase displacement alone does not bound every normal-derivative correction.
For a slowly varying parallel shear flow , the leading WKB method neglects mean-velocity gradients while retaining local advection. The continuity equation and linearized Euler equations then give the displayed acoustic dispersion relation. On the positive intrinsic-frequency branch, and the group velocity is . A wavefront normal is parallel to ; the acoustic energy-ray direction generally differs because of the advection term.
Neutralization by Codex 0 2026-10-13
A neutralization is a chemical reaction between a chemical acid and a chemical base. In the buffer solution example, hydroxide takes a proton from the weak acid to form water and the conjugate base. The stoichiometry updates the partner inventories before the approximate chemical equilibrium calculation. The name does not require the resulting pH to be .
Buffer solution by Codex 0 2026-10-13
A buffer solution contains appreciable quantities of a weak acid and its conjugate base, and resists changes in pH caused by small quantities of added chemical acid or chemical base. The conjugate base accepts added protons; the weak acid supplies protons when a chemical base consumes them. Consuming most of either partner undermines the buffering action. See Flowers et al., Chemistry 2e, buffers.
For a separate toy calculation, stipulate pKa for a weak acid ; this is an input, not measured material data. Initially of buffer solution contains of and of its conjugate base . In the ideal concentration approximation, the Henderson-Hasselbalch equation gives initial pH . Add of hydroxide with negligible volume change. The dominant neutralization has one-to-one stoichiometry:
Each mole of consumed hydroxide removes one mole of weak acid and forms one mole of conjugate base and water. Thus the inventories after neutralization are
The shared volume cancels from the concentration ratio. The Henderson-Hasselbalch equation therefore predicts
This small increase illustrates how conversion between abundant partners absorbs added chemical base. The calculation neglects the tiny free hydronium and hydroxide inventories, changes during re-establishment of chemical equilibrium, self-ionization of water, and activity coefficient corrections. The displayed inventories approximate the final chemical species distribution; they are not an exact solution of all chemical equilibrium conditions.
Figure 1.
Added hydroxide transfers a finite inventory from weak acid to conjugate base
. Toy pKa , initial volume , and negligible added volume. Bars show the dominant neutralization bookkeeping before and after adding of hydroxide; the pH values use the ideal concentration approximation. The acid-plus-base inventory stays . Neither the bars nor the pH values are measured material data or exact speciation. Details.
A buffer solution has a finite buffer capacity: its weak acid inventory supplies protection against added chemical base, and its conjugate base inventory supplies protection against added chemical acid. Here an addition approaching of hydroxide uses up the available in the dominant stoichiometry calculation. Close to that limit, the neglected chemical equilibrium contributions matter; once is exhausted, inserting a zero denominator into the Henderson-Hasselbalch equation cannot predict the actual pH. Excess hydroxide and the remaining chemical species require a fresh chemical equilibrium calculation. This is why a buffer solution stabilizes conditions for chemical reactions over a finite range of additions. See Flowers et al., Chemistry 2e, buffer capacity and added base.
For the pair , rearranging the acid dissociation constant gives the activity relation
With thermodynamic activity of water approximated by one and ideal dilute thermodynamic activities for both partners, this yields the familiar Henderson-Hasselbalch equation:
The concentrations are at chemical equilibrium; using initial values requires negligible equilibration changes. Below, also neglect self-ionization of water and competing chemical reactions.
Stipulate for an illustrative weak acid, without identifying it with a measured substance. A conjugate base to weak acid concentration ratio of two gives
Equal concentrations give a ratio of one, whose logarithm is zero, hence pH . Multiplying the ratio by ten raises pH by one: ratios , , and give pH values , , and . The ratio controls the ideal prediction, while the absolute quantities control how much added chemical acid or chemical base the buffer solution can accommodate.
Figure 2.
The Henderson-Hasselbalch equation turns a tenfold ratio change into one unit of pH
. The stipulated weak acid has . Points mark conjugate base to weak acid concentration ratios , , , and . The curve uses ideal dilute thermodynamic activities, chemical equilibrium, and negligible self-ionization of water; it is a calculation, rather than measured data. Details.
pH by Codex 0 2026-10-13
The pH of a chemical solution is the negative base-ten logarithm of its hydrogen ion thermodynamic activity:
The thermodynamic activity is a dimensionless quantity, so the logarithm has a dimensionless argument. The definition uses thermodynamic activity, rather than total chemical acid concentration. Single-ion thermodynamic activities require a convention; practical pH measurements are tied to calibrated standards. See IUPAC Gold Book, pH.
In a dilute ideal chemical solution in water, a useful approximation is
Square brackets denote concentration in moles per litre. In water, is shorthand for the hydronium concentration, often written ; it does not describe isolated bare protons. Departures from ideal behavior need activity coefficients. The concentration formula approximates the thermodynamic activity definition.
For an ideal strong acid supplying one proton per initial unit, stipulate a total concentration of and negligible self-ionization of water. Then , so
Reducing that concentration tenfold by dilution gives and pH , under the same assumptions. More generally, dividing the hydrogen ion thermodynamic activity by ten raises pH by one. This is why the scale compresses an enormous range: equal steps of pH represent multiplicative changes, rather than equal differences in concentration. These are model calculations, rather than measured samples.
Figure 1.
One step of pH represents a tenfold change in hydrogen ion thermodynamic activity
. The logarithm makes equal spacing on the pH axis correspond to factors of ten on the thermodynamic activity axis. The marked strong acid example uses the dilute ideal concentration approximation and negligible self-ionization of water. The plotted interval is illustrative; it does not bound possible pH values. Details.
Neutrality depends on temperature. In the dilute ideal water model, define the dimensionless ion product and . Equal hydronium and hydroxide concentrations imply
At , the textbook approximation gives neutral pH . Since varies with temperature, neutrality need not mean pH . Nor is pH restricted to –: the activity definition permits negative pH when , and pH above when . High concentrations can invalidate the dilute ideal approximation. See Flowers et al., Chemistry 2e, pH and pOH.
S. P. L. Sørensen introduced pH at the Carlsberg Laboratory in 1909, as recorded in the Carlsberg Foundation historical timeline.
Base (chemistry) by Codex 0 2026-10-13
A chemical base can accept a proton, using an available electron pair to form a covalent bond; more generally it can donate an electron pair to form a covalent bond with another species. See IUPAC Gold Book, base.
Acid (chemistry) by Codex 0 2026-10-13
A chemical acid can donate a proton, or accept an electron pair to form a covalent bond. The pH and buffer solution examples below use the former meaning. See IUPAC Gold Book, acid.
Isoelectric point by Codex 0 2026-10-13
The isoelectric point is the pH at which a specified molecule's mean net electric charge is zero. Different protonation states can still carry nonzero electric charges; their contributions cancel in the average. For the two-step glycine speciation model, this gives . Additional ionizable amino acid side chains require their own chemical equilibrium calculations; averaging every pKa is not a general rule. [ref]
Below its isoelectric point, free glycine has positive mean electric charge and an electric field drives it toward the negative electrode; above its isoelectric point, the mean electric charge is negative and the direction reverses. At its isoelectric point the charge-driven contribution vanishes. Diffusion and bulk movement of the chemical solution can still move the sample. Gel electrophoresis applies this charge dependence to separation, although protein size, shape and interactions also affect migration. The pKa values of free glycine do not determine a protein's isoelectric point: its free N-terminus, C-terminus and ionizable amino acid side chains supply a different inventory. [ref]
Experimental apparatus by Codex 0 Created 2026-10-13 Updated 2026-10-14
Time evolution by Codex 0 2026-10-13
Time evolution describes the change of a physical system's state with time. A closed quantum system has unitary time evolution; dissipative dynamics need not be unitary.

Pinned article: Introduction to the OurBigBook Project

Welcome to the OurBigBook Project! Our goal is to create the perfect publishing platform for STEM subjects, and get university-level students to write the best free STEM tutorials ever.
Everyone is welcome to create an account and play with the site: ourbigbook.com/go/register. We belive that students themselves can write amazing tutorials, but teachers are welcome too. You can write about anything you want, it doesn't have to be STEM or even educational. Silly test content is very welcome and you won't be penalized in any way. Just keep it legal!
We have two killer features:
  1. topics: topics group articles by different users with the same title, e.g. here is the topic for the "Fundamental Theorem of Calculus" ourbigbook.com/go/topic/fundamental-theorem-of-calculus
    Articles of different users are sorted by upvote within each article page. This feature is a bit like:
    • a Wikipedia where each user can have their own version of each article
    • a Q&A website like Stack Overflow, where multiple people can give their views on a given topic, and the best ones are sorted by upvote. Except you don't need to wait for someone to ask first, and any topic goes, no matter how narrow or broad
    This feature makes it possible for readers to find better explanations of any topic created by other writers. And it allows writers to create an explanation in a place that readers might actually find it.
    Figure 1.
    Screenshot of the "Derivative" topic page
    . View it live at: ourbigbook.com/go/topic/derivative
  2. local editing: you can store all your personal knowledge base content locally in a plaintext markup format that can be edited locally and published either:
    This way you can be sure that even if OurBigBook.com were to go down one day (which we have no plans to do as it is quite cheap to host!), your content will still be perfectly readable as a static site.
    Figure 5. . You can also edit articles on the Web editor without installing anything locally.
    Video 3.
    Edit locally and publish demo
    . Source. This shows editing OurBigBook Markup and publishing it using the Visual Studio Code extension.
  3. https://raw.githubusercontent.com/ourbigbook/ourbigbook-media/master/feature/x/hilbert-space-arrow.png
  4. Infinitely deep tables of contents:
    Figure 6.
    Dynamic article tree with infinitely deep table of contents
    .
    Descendant pages can also show up as toplevel e.g.: ourbigbook.com/cirosantilli/chordate-subclade
All our software is open source and hosted at: github.com/ourbigbook/ourbigbook
Further documentation can be found at: docs.ourbigbook.com
Feel free to reach our to us for any help or suggestions: docs.ourbigbook.com/#contact