@algorisys/tinyfly 0.116.0 → 0.118.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/docs/editor-guide.md +1 -1
- package/docs/examples.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/gsap-compat.md +1 -1
- package/docs/llm-guide.md +5 -1
- package/docs/maps.md +2 -2
- package/docs/math.md +68 -9
- package/docs/teaching.md +1 -1
- package/lib/addons/characters.js +1661 -1649
- package/lib/addons/math.js +2134 -1184
- package/lib/browser/tinyfly-math.iife.js +4 -4
- package/lib/browser/tinyfly.iife.js +12 -12
- package/lib/browser/tinyfly.js +306 -280
- package/lib/browser/tinyfly.umd.js +12 -12
- package/lib/engine/tinyfly-engine.js +112 -98
- package/lib/engine/tinyfly-engine.umd.cjs +2 -2
- package/lib/types/engine/authoring/random.d.ts +7 -0
- package/lib/types/math/discrete/graph-search.d.ts +38 -0
- package/lib/types/math/discrete/set-expression.d.ts +33 -0
- package/lib/types/math/figure/display-list.d.ts +8 -0
- package/lib/types/math/figure/figure-spec.d.ts +178 -1
- package/lib/types/math/figure/item-context.d.ts +7 -1
- package/lib/types/math/figure/items/discrete.d.ts +23 -0
- package/lib/types/math/figure/items/probability.d.ts +13 -0
- package/lib/types/math/figure/items/shapes.d.ts +3 -0
- package/lib/types/math/index.d.ts +10 -1
- package/lib/types/math/presets/discrete.d.ts +49 -0
- package/lib/types/math/presets/probability.d.ts +62 -0
- package/lib/types/math/prob/bayes.d.ts +16 -0
- package/lib/types/math/prob/distributions.d.ts +58 -0
- package/lib/types/math/prob/galton.d.ts +18 -0
- package/lib/types/math/prob/histogram.d.ts +20 -0
- package/lib/types/math/prob/scatter.d.ts +24 -0
- package/lib/types/math/tex/glyph-metrics.d.ts +8 -0
- package/lib/types/math/tex/tex-parser.d.ts +2 -1
- package/llms-full.txt +93 -18
- package/llms.txt +31 -31
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +4 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Mat2 } from '../linear/mat2';
|
|
2
2
|
import { type Vec2 } from '../linear/vec2';
|
|
3
|
-
import type { MathTheme, NumRef, VecRef } from './figure-spec';
|
|
3
|
+
import type { DistributionRef, MathTheme, NumRef, VecRef } from './figure-spec';
|
|
4
|
+
import type { Distribution } from '../prob/distributions';
|
|
4
5
|
import type { Plane } from './plane';
|
|
5
6
|
/** Values by name, as the figure holds them at one moment. */
|
|
6
7
|
export type Values = Record<string, number | number[]>;
|
|
@@ -31,3 +32,8 @@ export declare function vecOf(values: Values, ref: VecRef): Vec2;
|
|
|
31
32
|
export declare function matrixOf(values: Values, name: string | undefined): Mat2;
|
|
32
33
|
/** A number given directly or by the name of a number value. */
|
|
33
34
|
export declare function numOf(values: Values, ref: NumRef): number;
|
|
35
|
+
/**
|
|
36
|
+
* A distribution with its value names replaced by the values' numbers. Counts
|
|
37
|
+
* (binomial n, dice count and sides, a mean's count) are rounded to whole numbers.
|
|
38
|
+
*/
|
|
39
|
+
export declare function distributionOf(values: Values, ref: DistributionRef): Distribution;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type GraphEdge, type SearchEvent } from '../../discrete/graph-search';
|
|
2
|
+
import { type Vec2 } from '../../linear/vec2';
|
|
3
|
+
import type { ClockItem, GraphItem, VennItem } from '../figure-spec';
|
|
4
|
+
import { type Shape } from '../display-list';
|
|
5
|
+
import { type ItemContext, type Values } from '../item-context';
|
|
6
|
+
/** A graph's edges in object form. */
|
|
7
|
+
export declare function graphEdges(item: GraphItem): GraphEdge[];
|
|
8
|
+
/** Where each node is, in world units: its own `at`, else its place in the tree layout. */
|
|
9
|
+
export declare function graphPositions(item: GraphItem): Map<string, Vec2>;
|
|
10
|
+
export interface SearchState {
|
|
11
|
+
events: SearchEvent[];
|
|
12
|
+
/** Events fully done */
|
|
13
|
+
done: number;
|
|
14
|
+
/** How far the next event is, 0..1 */
|
|
15
|
+
partial: number;
|
|
16
|
+
}
|
|
17
|
+
/** The search shown at the current `step` (all of it when no step is given). */
|
|
18
|
+
export declare function searchState(item: GraphItem, values: Values): SearchState | undefined;
|
|
19
|
+
export declare function layoutGraph(item: GraphItem, ctx: ItemContext): Shape[];
|
|
20
|
+
export declare function layoutVenn(item: VennItem, ctx: ItemContext): Shape[];
|
|
21
|
+
/** The hour a clock value shows: value mod modulus, in 0..modulus − 1. */
|
|
22
|
+
export declare const clockHour: (value: number, modulus: number) => number;
|
|
23
|
+
export declare function layoutClock(item: ClockItem, ctx: ItemContext): Shape[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type PointsSpec } from '../../prob/scatter';
|
|
2
|
+
import type { BayesItem, DistributionItem, GaltonItem, HistogramItem, ScatterItem } from '../figure-spec';
|
|
3
|
+
import { type Shape } from '../display-list';
|
|
4
|
+
import { type ItemContext } from '../item-context';
|
|
5
|
+
/** How many samples a histogram or scatter has so far: a whole number, at most 20 000. */
|
|
6
|
+
export declare const sampleCount: (n: number) => number;
|
|
7
|
+
export declare function layoutHistogram(item: HistogramItem, ctx: ItemContext): Shape[];
|
|
8
|
+
export declare function layoutDistribution(item: DistributionItem, ctx: ItemContext): Shape[];
|
|
9
|
+
export declare function layoutGalton(item: GaltonItem, ctx: ItemContext): Shape[];
|
|
10
|
+
export declare function layoutScatter(item: ScatterItem, ctx: ItemContext): Shape[];
|
|
11
|
+
/** A scatter item's points spec with its numbers resolved. */
|
|
12
|
+
export declare function pointsSpec(item: ScatterItem, ctx: Pick<ItemContext, 'values'>): PointsSpec;
|
|
13
|
+
export declare function layoutBayes(item: BayesItem, ctx: ItemContext): Shape[];
|
|
@@ -16,10 +16,17 @@ export { parseExpression, expressionNames, ExpressionError, FUNCTIONS, CONSTANTS
|
|
|
16
16
|
export { evaluate, compile, compileDerivative, type Scope } from './expr/evaluate';
|
|
17
17
|
export { differentiate, nthDerivative, expressionToString } from './expr/differentiate';
|
|
18
18
|
export { integrate } from './figure/derived';
|
|
19
|
+
export { density, meanOf, sdOf, supportOf, sample, samples, isDiscrete, distributionProblem, DISTRIBUTION_KINDS, type Distribution, type DistributionKind } from './prob/distributions';
|
|
20
|
+
export { binSamples, defaultBins, summary, type Bin } from './prob/histogram';
|
|
21
|
+
export { scatterPoints, leastSquares, type PointsSpec } from './prob/scatter';
|
|
22
|
+
export { ballPath, ballAt, binOf } from './prob/galton';
|
|
23
|
+
export { bayesAreas, type BayesAreas } from './prob/bayes';
|
|
24
|
+
export { searchEvents, treeLayout, adjacency, SEARCH_KINDS, type SearchKind, type SearchEvent, type GraphEdge } from './discrete/graph-search';
|
|
25
|
+
export { parseSetExpression, inRegion, regionCells, setNames, type SetExpression } from './discrete/set-expression';
|
|
19
26
|
export { parseTex, TexError, TEX_COMMANDS, SYMBOLS, type TexNode, type TexClass } from './tex/tex-parser';
|
|
20
27
|
export { layoutTex, type TexLayout, type TexPiece, type TexGlyph, type TexRule, type TexStroke, type TexLayoutOptions } from './tex/tex-layout';
|
|
21
28
|
export { morphEquation, type MorphPiece, type PlacedLayout } from './tex/equation-morph';
|
|
22
|
-
export { MATH_FONT } from './tex/glyph-metrics';
|
|
29
|
+
export { MATH_FONT, MATH_SYMBOL_FONT } from './tex/glyph-metrics';
|
|
23
30
|
export * from './figure/figure-spec';
|
|
24
31
|
export { validateMathFigure } from './figure/validate-spec';
|
|
25
32
|
export { layoutFigure, type MathProps } from './figure/layout-figure';
|
|
@@ -33,6 +40,8 @@ export { mountMath, mountAllMath, type MountedMathFigure } from './embed/mount-m
|
|
|
33
40
|
export { mathExplorable, type MathExplorable, type ExplorableOptions, type SliderControl, type DragHandle } from './embed/explorable';
|
|
34
41
|
export { linearMapFigure, determinantFigure, eigenFigure, vectorSumFigure, spanFigure, MATRIX_TEX, type PresetOptions, } from './presets/linear-algebra';
|
|
35
42
|
export { tangentFigure, secantFigure, riemannFigure, areaFigure, taylorFigure, limitFigure, type CalculusOptions } from './presets/calculus';
|
|
43
|
+
export { normalFigure, binomialFigure, cltFigure, galtonFigure, monteCarloPiFigure, regressionFigure, bayesFigure, type ProbabilityOptions } from './presets/probability';
|
|
44
|
+
export { graphSearchFigure, shortestPathFigure, recursionTreeFigure, vennFigure, clockFigure, SAMPLE_GRAPH, type DiscreteOptions } from './presets/discrete';
|
|
36
45
|
import type { MathFigureSpec } from './figure/figure-spec';
|
|
37
46
|
import { type MathProps } from './figure/layout-figure';
|
|
38
47
|
/** A figure checked up front: returns it unchanged, or throws a message that says how to fix it. */
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { GraphEdgeSpec, GraphNode, MathFigureSpec, MathThemeName } from '../figure/figure-spec';
|
|
2
|
+
/**
|
|
3
|
+
* Ready-made discrete maths figures. Each returns a plain MathFigureSpec
|
|
4
|
+
* whose moving part is a number value:
|
|
5
|
+
*
|
|
6
|
+
* - graphSearchFigure / shortestPathFigure / recursionTreeFigure: `step`,
|
|
7
|
+
* how many search steps are done (fractional: the next node being reached)
|
|
8
|
+
* - clockFigure: `value`, the number the hand points at (mod the modulus)
|
|
9
|
+
* - vennFigure: no values; animate the item's draw, or show one figure per region
|
|
10
|
+
*/
|
|
11
|
+
export interface DiscreteOptions {
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
theme?: MathThemeName;
|
|
15
|
+
}
|
|
16
|
+
/** A small graph of eight nodes (A–H), for searches. */
|
|
17
|
+
export declare const SAMPLE_GRAPH: {
|
|
18
|
+
nodes: GraphNode[];
|
|
19
|
+
edges: [string, string, number][];
|
|
20
|
+
};
|
|
21
|
+
/** Breadth-first or depth-first search on a graph, step by step, with its queue or stack. */
|
|
22
|
+
export declare function graphSearchFigure(options?: DiscreteOptions & {
|
|
23
|
+
search?: 'bfs' | 'dfs';
|
|
24
|
+
start?: string;
|
|
25
|
+
nodes?: GraphNode[];
|
|
26
|
+
edges?: GraphEdgeSpec[];
|
|
27
|
+
}): MathFigureSpec;
|
|
28
|
+
/** Dijkstra's shortest paths on a weighted graph: each node settles at its distance from the start. */
|
|
29
|
+
export declare function shortestPathFigure(options?: DiscreteOptions & {
|
|
30
|
+
start?: string;
|
|
31
|
+
target?: string;
|
|
32
|
+
nodes?: GraphNode[];
|
|
33
|
+
edges?: GraphEdgeSpec[];
|
|
34
|
+
}): MathFigureSpec;
|
|
35
|
+
/** The call tree of a naive recursive Fibonacci, F(n) = F(n − 1) + F(n − 2), visited in call order. */
|
|
36
|
+
export declare function recursionTreeFigure(options?: DiscreteOptions & {
|
|
37
|
+
n?: number;
|
|
38
|
+
}): MathFigureSpec;
|
|
39
|
+
/** Two or three sets as a Venn diagram with a set expression shaded. */
|
|
40
|
+
export declare function vennFigure(options?: DiscreteOptions & {
|
|
41
|
+
sets?: string[];
|
|
42
|
+
highlight?: string;
|
|
43
|
+
label?: string;
|
|
44
|
+
}): MathFigureSpec;
|
|
45
|
+
/** A clock of `modulus` hours with the hand at `value` (mod modulus). */
|
|
46
|
+
export declare function clockFigure(options?: DiscreteOptions & {
|
|
47
|
+
modulus?: number;
|
|
48
|
+
value?: number;
|
|
49
|
+
}): MathFigureSpec;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { DistributionRef, MathFigureSpec, MathThemeName } from '../figure/figure-spec';
|
|
2
|
+
/**
|
|
3
|
+
* Ready-made probability and statistics figures. Each returns a plain
|
|
4
|
+
* MathFigureSpec whose moving parts are number values:
|
|
5
|
+
*
|
|
6
|
+
* - normalFigure: `mu`, `sigma`, and the shaded range `a`..`b`
|
|
7
|
+
* - binomialFigure: `n` and `p`
|
|
8
|
+
* - cltFigure: `k` (how many draws are averaged) and `samples`
|
|
9
|
+
* - galtonFigure: `balls` (fractional: the next ball is on its way down)
|
|
10
|
+
* - monteCarloPiFigure: `count` points
|
|
11
|
+
* - regressionFigure: `count`, `slope`, `noise`
|
|
12
|
+
* - bayesFigure: `prior`, `sensitivity`, `falsePositive`
|
|
13
|
+
*/
|
|
14
|
+
export interface ProbabilityOptions {
|
|
15
|
+
width?: number;
|
|
16
|
+
height?: number;
|
|
17
|
+
theme?: MathThemeName;
|
|
18
|
+
x?: [number, number];
|
|
19
|
+
y?: [number, number];
|
|
20
|
+
}
|
|
21
|
+
/** The normal curve, with P(a ≤ X ≤ b) shaded. */
|
|
22
|
+
export declare function normalFigure(options?: ProbabilityOptions & {
|
|
23
|
+
mean?: number;
|
|
24
|
+
sd?: number;
|
|
25
|
+
shade?: [number, number];
|
|
26
|
+
}): MathFigureSpec;
|
|
27
|
+
/** Binomial(n, p) as bars. */
|
|
28
|
+
export declare function binomialFigure(options?: ProbabilityOptions & {
|
|
29
|
+
n?: number;
|
|
30
|
+
p?: number;
|
|
31
|
+
}): MathFigureSpec;
|
|
32
|
+
/**
|
|
33
|
+
* The central limit theorem: the mean of k draws from a skewed distribution
|
|
34
|
+
* (exponential by default) piles up into a normal curve as k grows.
|
|
35
|
+
*/
|
|
36
|
+
export declare function cltFigure(options?: ProbabilityOptions & {
|
|
37
|
+
of?: DistributionRef;
|
|
38
|
+
k?: number;
|
|
39
|
+
samples?: number;
|
|
40
|
+
}): MathFigureSpec;
|
|
41
|
+
/** A Galton board in a tall frame: balls bounce through the pegs into a bell. */
|
|
42
|
+
export declare function galtonFigure(options?: ProbabilityOptions & {
|
|
43
|
+
rows?: number;
|
|
44
|
+
balls?: number;
|
|
45
|
+
}): MathFigureSpec;
|
|
46
|
+
/** Estimate π by throwing points at a square and counting those inside the circle. */
|
|
47
|
+
export declare function monteCarloPiFigure(options?: ProbabilityOptions & {
|
|
48
|
+
count?: number;
|
|
49
|
+
}): MathFigureSpec;
|
|
50
|
+
/** Noisy points about a line, and the least-squares line through them. */
|
|
51
|
+
export declare function regressionFigure(options?: ProbabilityOptions & {
|
|
52
|
+
slope?: number;
|
|
53
|
+
intercept?: number;
|
|
54
|
+
noise?: number;
|
|
55
|
+
count?: number;
|
|
56
|
+
}): MathFigureSpec;
|
|
57
|
+
/** A medical test as areas: how likely is the condition, given a positive result? */
|
|
58
|
+
export declare function bayesFigure(options?: ProbabilityOptions & {
|
|
59
|
+
prior?: number;
|
|
60
|
+
sensitivity?: number;
|
|
61
|
+
falsePositive?: number;
|
|
62
|
+
}): MathFigureSpec;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bayes' rule as areas of a unit square: the prior splits it into a column
|
|
3
|
+
* with the condition and one without; each column splits into those who test
|
|
4
|
+
* positive and those who do not.
|
|
5
|
+
*/
|
|
6
|
+
export interface BayesAreas {
|
|
7
|
+
/** P(condition and positive) */
|
|
8
|
+
truePositive: number;
|
|
9
|
+
/** P(no condition and positive) */
|
|
10
|
+
falsePositive: number;
|
|
11
|
+
/** P(positive) */
|
|
12
|
+
positive: number;
|
|
13
|
+
/** P(condition | positive) */
|
|
14
|
+
posterior: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function bayesAreas(prior: number, sensitivity: number, falsePositiveRate: number): BayesAreas;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type RandomSource } from '../../engine/authoring/random';
|
|
2
|
+
/**
|
|
3
|
+
* Probability distributions as plain data, `{ kind, …parameters }`, with
|
|
4
|
+
* their density (or mass), mean, spread and a seeded sampler. Discrete ones
|
|
5
|
+
* take whole-number values. Pure: samples come from a seed, never from
|
|
6
|
+
* Math.random, so a histogram fills the same way every time it plays.
|
|
7
|
+
*/
|
|
8
|
+
export type Distribution = {
|
|
9
|
+
kind: 'normal';
|
|
10
|
+
mean?: number;
|
|
11
|
+
sd?: number;
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'uniform';
|
|
14
|
+
min?: number;
|
|
15
|
+
max?: number;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'exponential';
|
|
18
|
+
rate?: number;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'binomial';
|
|
21
|
+
n: number;
|
|
22
|
+
p: number;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'poisson';
|
|
25
|
+
rate: number;
|
|
26
|
+
}
|
|
27
|
+
/** The number of heads in `count` fair coin tosses is binomial; this is the total of `count` fair dice */
|
|
28
|
+
| {
|
|
29
|
+
kind: 'dice';
|
|
30
|
+
count?: number;
|
|
31
|
+
sides?: number;
|
|
32
|
+
}
|
|
33
|
+
/** The mean of `count` draws of another distribution: the central limit theorem's subject */
|
|
34
|
+
| {
|
|
35
|
+
kind: 'mean';
|
|
36
|
+
of: Distribution;
|
|
37
|
+
count: number;
|
|
38
|
+
};
|
|
39
|
+
export type DistributionKind = Distribution['kind'];
|
|
40
|
+
export declare const DISTRIBUTION_KINDS: readonly DistributionKind[];
|
|
41
|
+
/** The whole numbers a discrete distribution can take, [low, high] (high may be Infinity). */
|
|
42
|
+
export declare function supportOf(d: Distribution): [number, number];
|
|
43
|
+
/** True for distributions on whole numbers (drawn as bars, not a curve). */
|
|
44
|
+
export declare function isDiscrete(d: Distribution): boolean;
|
|
45
|
+
/** The density (continuous) or probability mass (discrete) at x. */
|
|
46
|
+
export declare function density(d: Distribution, x: number): number;
|
|
47
|
+
export declare function meanOf(d: Distribution): number;
|
|
48
|
+
export declare function sdOf(d: Distribution): number;
|
|
49
|
+
/** One draw. */
|
|
50
|
+
export declare function sample(d: Distribution, source: RandomSource): number;
|
|
51
|
+
/**
|
|
52
|
+
* The first `count` draws from `d` with `seed`. Asking for more continues
|
|
53
|
+
* the same sequence, so a histogram that grows from 10 to 1000 samples keeps
|
|
54
|
+
* its first 10. Cached by distribution and seed.
|
|
55
|
+
*/
|
|
56
|
+
export declare function samples(d: Distribution, seed: number | string, count: number): number[];
|
|
57
|
+
/** Checks a distribution's parameters; returns a message, or undefined when it is fine. */
|
|
58
|
+
export declare function distributionProblem(d: Distribution): string | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Galton board's balls: each bounces left or right at each row of pegs, by
|
|
3
|
+
* its own seeded coin flips, and lands in the bin numbered by its rights.
|
|
4
|
+
* Pure geometry in "peg units": row i of pegs sits at depth i, its pegs at
|
|
5
|
+
* x = j − i / 2 (j = 0..i); bin b sits at x = b − rows / 2.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ballPath(seed: number | string, ball: number, rows: number): boolean[];
|
|
8
|
+
/** The bin a ball lands in: how many times it went right. */
|
|
9
|
+
export declare const binOf: (path: boolean[]) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Where a ball is, part way down (`progress` 0 at the top peg, 1 when it
|
|
12
|
+
* reaches the bins), in peg units: x across, depth down. Between rows it
|
|
13
|
+
* hops in a small arc, as balls on a real board do.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ballAt(path: boolean[], progress: number): {
|
|
16
|
+
x: number;
|
|
17
|
+
depth: number;
|
|
18
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Distribution } from './distributions';
|
|
2
|
+
export interface Bin {
|
|
3
|
+
left: number;
|
|
4
|
+
right: number;
|
|
5
|
+
count: number;
|
|
6
|
+
/** count, or count / (total × width) when scaled as a density */
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The default bins for a distribution: one per whole number for discrete
|
|
11
|
+
* ones (centred on it), else 30 across mean ± 4 sd.
|
|
12
|
+
*/
|
|
13
|
+
export declare function defaultBins(d: Distribution): [number, number, number];
|
|
14
|
+
/** Samples counted into `bins`; heights as counts or as a density (total area 1). */
|
|
15
|
+
export declare function binSamples(values: number[], [from, to, count]: [number, number, number], scale: 'density' | 'count'): Bin[];
|
|
16
|
+
/** Sample mean and standard deviation (0 and 0 for no samples). */
|
|
17
|
+
export declare function summary(values: number[]): {
|
|
18
|
+
mean: number;
|
|
19
|
+
sd: number;
|
|
20
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Vec2 } from '../linear/vec2';
|
|
2
|
+
export type PointsSpec = {
|
|
3
|
+
kind: 'uniform';
|
|
4
|
+
x: [number, number];
|
|
5
|
+
y: [number, number];
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'linear';
|
|
8
|
+
slope: number;
|
|
9
|
+
intercept: number;
|
|
10
|
+
noise: number;
|
|
11
|
+
x: [number, number];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* `count` random points from a seed. Each point draws the same random numbers
|
|
15
|
+
* whatever the parameters, so moving the slope or the noise moves every
|
|
16
|
+
* point smoothly instead of reshuffling them.
|
|
17
|
+
*/
|
|
18
|
+
export declare function scatterPoints(spec: PointsSpec, seed: number | string, count: number): Vec2[];
|
|
19
|
+
/** The least-squares line through points, and the correlation r. Undefined for fewer than two distinct x. */
|
|
20
|
+
export declare function leastSquares(points: Vec2[]): {
|
|
21
|
+
slope: number;
|
|
22
|
+
intercept: number;
|
|
23
|
+
r: number;
|
|
24
|
+
} | undefined;
|
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
* first in MATH_FONT.
|
|
12
12
|
*/
|
|
13
13
|
export declare const MATH_FONT = "\"Latin Modern Math\", \"STIX Two Math\", \"Cambria Math\", \"Times New Roman\", \"Liberation Serif\", \"Noto Serif\", Times, serif";
|
|
14
|
+
/**
|
|
15
|
+
* Font for operators and symbols (∪ ∩ △ ∈ ≤ ∑ …): maths faces first, then
|
|
16
|
+
* DejaVu, whose serif and maths faces cover them where text serifs such as
|
|
17
|
+
* Liberation Serif do not. Letters, digits and Greek use MATH_FONT.
|
|
18
|
+
*/
|
|
19
|
+
export declare const MATH_SYMBOL_FONT = "\"Latin Modern Math\", \"STIX Two Math\", \"Cambria Math\", \"DejaVu Math TeX Gyre\", \"DejaVu Serif\", serif";
|
|
20
|
+
/** The font a glyph is drawn in: MATH_FONT for letters, digits and Greek, MATH_SYMBOL_FONT for the rest. */
|
|
21
|
+
export declare const fontFor: (text: string) => "\"Latin Modern Math\", \"STIX Two Math\", \"Cambria Math\", \"Times New Roman\", \"Liberation Serif\", \"Noto Serif\", Times, serif" | "\"Latin Modern Math\", \"STIX Two Math\", \"Cambria Math\", \"DejaVu Math TeX Gyre\", \"DejaVu Serif\", serif";
|
|
14
22
|
/** Height above the baseline of the maths axis (where fraction bars and − sit). */
|
|
15
23
|
export declare const AXIS_HEIGHT = 0.25;
|
|
16
24
|
/** Rule thickness for fraction bars and radicals. */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Supported:
|
|
5
5
|
* - Letters (italic), digits, `+ - = < > ( ) [ ] | , . ; : ! '`
|
|
6
6
|
* - `^` and `_` with a single token or a `{group}`
|
|
7
|
-
* - `\frac{a}{b}`, `\sqrt{x}`, `\vec{v}`, `\hat{x}`, `\bar{x}`
|
|
7
|
+
* - `\frac{a}{b}`, `\binom{n}{k}`, `\sqrt{x}`, `\vec{v}`, `\hat{x}`, `\bar{x}`
|
|
8
8
|
* - Big operators `\sum \prod \int` (limits from `_` and `^`), and named
|
|
9
9
|
* operators `\sin \cos \tan \log \ln \exp \det \lim \max \min \arg`
|
|
10
10
|
* - Greek letters and the symbols in SYMBOLS (`\cdot \times \le \to \infty` …)
|
|
@@ -36,6 +36,7 @@ export type TexNode = {
|
|
|
36
36
|
type: 'frac';
|
|
37
37
|
num: TexNode;
|
|
38
38
|
den: TexNode;
|
|
39
|
+
bar?: boolean;
|
|
39
40
|
} | {
|
|
40
41
|
type: 'sqrt';
|
|
41
42
|
body: TexNode;
|
package/llms-full.txt
CHANGED
|
@@ -591,7 +591,7 @@ with a GSAP-style call (durations are in seconds here):
|
|
|
591
591
|
```html
|
|
592
592
|
<div class="box" style="width:60px;height:60px;background:#4a9eff"></div>
|
|
593
593
|
|
|
594
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
594
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.118.0/cdn/tinyfly.iife.js"></script>
|
|
595
595
|
<script>
|
|
596
596
|
tinyfly.to('.box', { x: 200, duration: 1 })
|
|
597
597
|
</script>
|
|
@@ -799,7 +799,7 @@ Without a build step, the all-in-one bundle exposes the same functions on a
|
|
|
799
799
|
global — `tinyfly.to()`, `tinyfly.timeline()` and so on:
|
|
800
800
|
|
|
801
801
|
```html
|
|
802
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
802
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.118.0/cdn/tinyfly.iife.js"></script>
|
|
803
803
|
<script>
|
|
804
804
|
tinyfly.to('.box', { x: 200, duration: 1 })
|
|
805
805
|
</script>
|
|
@@ -2714,7 +2714,7 @@ For simple website embedding without a build system.
|
|
|
2714
2714
|
</html>
|
|
2715
2715
|
```
|
|
2716
2716
|
|
|
2717
|
-
Build the player with `npm run build:player` to generate `lib/player/tinyfly-player.iife.js`, or load it from the CDN: `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
2717
|
+
Build the player with `npm run build:player` to generate `lib/player/tinyfly-player.iife.js`, or load it from the CDN: `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.118.0/cdn/tinyfly-player.iife.js`.
|
|
2718
2718
|
|
|
2719
2719
|
---
|
|
2720
2720
|
|
|
@@ -7068,7 +7068,7 @@ The dialog shows the generated HTML/JavaScript code with a **Copy Code** button.
|
|
|
7068
7068
|
**Steps to embed:**
|
|
7069
7069
|
1. Build the player: `npm run build:player`
|
|
7070
7070
|
2. Copy `lib/player/tinyfly-player.iife.js` to your project (or load
|
|
7071
|
-
`https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
7071
|
+
`https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.118.0/cdn/tinyfly-player.iife.js`
|
|
7072
7072
|
instead; see [Deployment](DEPLOYMENT.md))
|
|
7073
7073
|
3. Copy the generated code into your HTML
|
|
7074
7074
|
4. Adjust the script `src` path if needed
|
|
@@ -8493,7 +8493,11 @@ or `scale`: those belong to the figure's target. The same figure plays in a
|
|
|
8493
8493
|
lesson page (`<figure data-tinyfly-math>`), an explorable and a video
|
|
8494
8494
|
(`mathTarget`). Calculus items (`tangent`, `riemann`, `area`, `taylor`, a
|
|
8495
8495
|
`point` with `on` and `x`) take numbers or number-value names for `at`, `n`,
|
|
8496
|
-
`to`, `order`, and publish `\\val{ID.slope}`, `ID.sum`, `ID.value` for TeX.
|
|
8496
|
+
`to`, `order`, and publish `\\val{ID.slope}`, `ID.sum`, `ID.value` for TeX. Probability items
|
|
8497
|
+
(`histogram`, `distribution`, `galton`, `scatter`, `bayes`) take a distribution as data
|
|
8498
|
+
(`{ kind: 'normal', mean: 'mu', sd: 1 }`) and draw seeded samples, never `Math.random`. Discrete:
|
|
8499
|
+
`graph` (nodes with `at`, or `tree: { root }`; `search` stepped by `step`), `venn` (`highlight: "(A | B)'"`),
|
|
8500
|
+
`clock` (`modulus`, `value`). See `docs/math.md`.
|
|
8497
8501
|
|
|
8498
8502
|
## Your own behaviours
|
|
8499
8503
|
|
|
@@ -8680,7 +8684,7 @@ path for all of that:
|
|
|
8680
8684
|
</figure>
|
|
8681
8685
|
|
|
8682
8686
|
<!-- once, anywhere on the page (a site-wide footer is fine) -->
|
|
8683
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
8687
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.118.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
|
|
8684
8688
|
```
|
|
8685
8689
|
|
|
8686
8690
|
Every `[data-tinyfly-embed]` mounts when the page is ready, with no per-post
|
|
@@ -9086,6 +9090,15 @@ Some names are reserved, because a track on them would move the whole figure:
|
|
|
9086
9090
|
| `area` | `expr`, `from`, `to`, `lower?` (another function), `negativeColor?`, `fillOpacity?` |
|
|
9087
9091
|
| `taylor` | `expr`, `at`, `order` (0–20; a fractional order grows the next term in), `domain?` |
|
|
9088
9092
|
|
|
9093
|
+
| `histogram` | `distribution`, `count` (samples so far), `bins?: [from, to, n]`, `scale?: 'density' \| 'count'`, `curve?`, `seed?` |
|
|
9094
|
+
| `distribution` | `distribution`, `shade?: [a, b]` (P(a ≤ X ≤ b)), `domain?` |
|
|
9095
|
+
| `galton` | `rows?`, `balls` (fractional: the next ball on its way), `spacing?`, `top?`, `seed?` |
|
|
9096
|
+
| `scatter` | `points: { kind: 'uniform', x, y }` or `{ kind: 'linear', slope, intercept, noise, x }`, `count`, `inside?` (an expression in x and y, true when ≤ 0), `fit?`, `seed?` |
|
|
9097
|
+
| `bayes` | `prior`, `truePositive`, `falsePositive`, `at?`, `size?`, `labels?` |
|
|
9098
|
+
| `graph` | `nodes: [{ id, at?, label? }]`, `edges` (`[from, to, weight?]` or objects), `directed?`, `tree?: { root, spacing?, at? }`, `search?: { kind: 'bfs' \| 'dfs' \| 'dijkstra', start }`, `step?`, `frontier?` (screen px), `weights?`, `radius?` |
|
|
9099
|
+
| `venn` | `sets` (two or three `{ id, label?, color? }`), `highlight?` (a set expression), `highlightColor?`, `at?`, `radius?`, `universe?` |
|
|
9100
|
+
| `clock` | `modulus`, `value`, `at?`, `radius?` |
|
|
9101
|
+
|
|
9089
9102
|
`point` also rides a curve: `{ on: 'sin(x)', x: 'p' }` is the point (p, sin p), and
|
|
9090
9103
|
`hollow: true` draws an open circle for a hole or a limit. `function` takes
|
|
9091
9104
|
`derivative: n` to plot f′, f″ … and `dashed: true`.
|
|
@@ -9105,6 +9118,42 @@ Items work out numbers that TeX can show with `\val{…}`:
|
|
|
9105
9118
|
| `area` | `ID.value` (the signed integral) |
|
|
9106
9119
|
| `point` on a curve | `ID.x`, `ID.y` |
|
|
9107
9120
|
| `taylor` | `ID.order`, `ID.degree` (its whole part) |
|
|
9121
|
+
| `histogram` | `ID.count`, `ID.mean`, `ID.sd` (of the samples so far) |
|
|
9122
|
+
| `distribution` | `ID.p` (the shaded probability), `ID.mean`, `ID.sd` |
|
|
9123
|
+
| `galton` | `ID.landed` |
|
|
9124
|
+
| `scatter` | `ID.count`, `ID.inside`, `ID.ratio`, `ID.slope`, `ID.intercept`, `ID.r` |
|
|
9125
|
+
| `bayes` | `ID.prior`, `ID.posterior`, `ID.positive`, `ID.truePositive`, `ID.falsePositive` |
|
|
9126
|
+
| `graph` with a search | `ID.visited`, `ID.steps`, and for Dijkstra `ID.d.NODE` (∞ until known) |
|
|
9127
|
+
| `clock` | `ID.hour` (value mod modulus), `ID.turns` |
|
|
9128
|
+
|
|
9129
|
+
### Graphs, searches and sets
|
|
9130
|
+
|
|
9131
|
+
A search is shown step by step: `step` counts the nodes finished, and its
|
|
9132
|
+
fractional part draws the edge the search is crossing to the next one. Finished
|
|
9133
|
+
nodes are yellow; nodes waiting in the queue (breadth first), the stack (depth
|
|
9134
|
+
first) or the open set (Dijkstra) are blue; yellow edges are how each node was
|
|
9135
|
+
reached. Neighbours are taken in the order the nodes are listed, so a search
|
|
9136
|
+
always tells the same story (`searchEvents` returns it as data). A tree lays
|
|
9137
|
+
itself out from its root when nodes have no `at` (`treeLayout`), which is how
|
|
9138
|
+
`recursionTreeFigure` draws the calls a recursive function makes.
|
|
9139
|
+
|
|
9140
|
+
Venn regions are set expressions: `A | B`, `A & B`, `A - B`, `A ^ B`, `A'` (or
|
|
9141
|
+
`!A`), with brackets; `∪ ∩ ∖ △ ¬` work too. Each cell of the region is drawn as
|
|
9142
|
+
the universe clipped inside and outside the circles, the same in canvas and SVG.
|
|
9143
|
+
|
|
9144
|
+
### Distributions and randomness
|
|
9145
|
+
|
|
9146
|
+
A distribution is data: `{ kind: 'normal', mean, sd }`, `uniform` (`min`,
|
|
9147
|
+
`max`), `exponential` (`rate`), `binomial` (`n`, `p`), `poisson` (`rate`),
|
|
9148
|
+
`dice` (`count`, `sides`), or `{ kind: 'mean', of, count }`, the average of
|
|
9149
|
+
`count` draws (what the central limit theorem is about). Any of its numbers
|
|
9150
|
+
may be a value name, so a slider moves the mean or n. `density`, `meanOf`,
|
|
9151
|
+
`sdOf`, `sample` and `samples` work on them directly.
|
|
9152
|
+
|
|
9153
|
+
Every sample comes from a seed (the item id unless `seed` is given), through
|
|
9154
|
+
the engine's `createRandom`, `randomNormal` and `shuffled`. A histogram that
|
|
9155
|
+
grows from 10 to 1000 samples keeps its first 10, and every render, video and
|
|
9156
|
+
reader sees the same draws.
|
|
9108
9157
|
|
|
9109
9158
|
Slopes, derivative plots and Taylor coefficients come from symbolic
|
|
9110
9159
|
differentiation of the expression (`differentiate`, `compileDerivative`), so
|
|
@@ -9170,7 +9219,7 @@ lesson's step options (`duration`, `easing`, `delay`).
|
|
|
9170
9219
|
<figcaption>The determinant is the area of the unit square after the map.</figcaption>
|
|
9171
9220
|
</figure>
|
|
9172
9221
|
|
|
9173
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
9222
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.118.0/cdn/tinyfly-math.iife.js" data-tinyfly-auto></script>
|
|
9174
9223
|
```
|
|
9175
9224
|
|
|
9176
9225
|
The figure draws itself into an SVG and redraws from the timeline whenever the
|
|
@@ -9236,9 +9285,9 @@ Equations are typeset by a built-in TeX subset, with no KaTeX or MathJax:
|
|
|
9236
9285
|
- `\sum`, `\prod` and `\int`, with limits above and below in display style
|
|
9237
9286
|
- Named operators: `\sin \cos \tan \log \ln \exp \det \lim \max \min` …
|
|
9238
9287
|
- Greek letters
|
|
9239
|
-
- Symbols: `\cdot \times \pm \le \ge \ne \approx \to \infty \partial \nabla \in` …
|
|
9288
|
+
- Symbols: `\cdot \times \pm \le \ge \ne \approx \to \infty \partial \nabla \in \cup \cap \triangle \varnothing` …
|
|
9240
9289
|
- Matrices: `\begin{pmatrix|bmatrix|vmatrix|matrix} … \end{…}`
|
|
9241
|
-
- `\text{…}`, `\color{name}{…}`, and spacing `\, \; \quad`
|
|
9290
|
+
- `\binom{n}{k}`, `\text{…}`, `\color{name}{…}`, and spacing `\, \; \quad`
|
|
9242
9291
|
- `\left( … \right)`, with delimiters at their natural size
|
|
9243
9292
|
- `\id{name}{…}`, which names a term
|
|
9244
9293
|
- `\val{name}` and `\val{name:digits}` for live values
|
|
@@ -9269,6 +9318,18 @@ their own.
|
|
|
9269
9318
|
| `areaFigure({ expr, from, to })` | The area up to `b`, its value shown |
|
|
9270
9319
|
| `taylorFigure({ expr, at, order })` | Taylor polynomials of degree `order` |
|
|
9271
9320
|
| `limitFigure({ expr, at, limit })` | A point `p` sliding toward a hole |
|
|
9321
|
+
| `normalFigure({ mean, sd, shade })` | The normal curve with P(a ≤ X ≤ b) shaded (`mu`, `sigma`, `a`, `b`) |
|
|
9322
|
+
| `binomialFigure({ n, p })` | Binomial bars |
|
|
9323
|
+
| `cltFigure({ of, k, samples })` | Means of `k` draws piling into a normal curve |
|
|
9324
|
+
| `galtonFigure({ rows, balls })` | A Galton board |
|
|
9325
|
+
| `monteCarloPiFigure({ count })` | Points in a square; the share inside the circle ≈ π/4 |
|
|
9326
|
+
| `regressionFigure({ slope, intercept, noise, count })` | Noisy points and the least-squares line |
|
|
9327
|
+
| `bayesFigure({ prior, sensitivity, falsePositive })` | A medical test as areas: P(condition given a positive) |
|
|
9328
|
+
| `graphSearchFigure({ search, start })` | Breadth- or depth-first search on a sample graph, with its queue or stack (`step`) |
|
|
9329
|
+
| `shortestPathFigure({ start, target })` | Dijkstra on the weighted sample graph, distances shown (`step`) |
|
|
9330
|
+
| `recursionTreeFigure({ n })` | The call tree of naive recursive Fibonacci, in call order (`step`) |
|
|
9331
|
+
| `vennFigure({ sets, highlight, label })` | Two or three sets with a region shaded |
|
|
9332
|
+
| `clockFigure({ modulus, value })` | Clock arithmetic (`value`) |
|
|
9272
9333
|
|
|
9273
9334
|
Each returns a plain figure to change or extend. In each, `M` starts at the
|
|
9274
9335
|
identity unless `matrix` is given.
|
|
@@ -9276,15 +9337,17 @@ identity unless `matrix` is given.
|
|
|
9276
9337
|
## Examples
|
|
9277
9338
|
|
|
9278
9339
|
- Gallery: **Linear Map**, **Eigenvectors**, **Equation Steps**, **Matrix Lesson**,
|
|
9279
|
-
**Derivative**, **Riemann Sums**
|
|
9280
|
-
|
|
9281
|
-
|
|
9340
|
+
**Derivative**, **Riemann Sums**, **Taylor Series**, **Galton Board**, **Central Limit
|
|
9341
|
+
Theorem**, **Monte Carlo π**, **Bayes: a Positive Test**, **Graph Search**, **Recursion
|
|
9342
|
+
Tree**, **Set Operations** and **Clock Arithmetic**.
|
|
9343
|
+
- Videos: `linear-map-short.mjs`, `riemann-short.mjs`, `galton-short.mjs` and
|
|
9344
|
+
`graph-search-short.mjs` (9:16); `eigen-explainer.mjs`, `taylor-explainer.mjs`,
|
|
9345
|
+
`clt-explainer.mjs` and `de-morgan-explainer.mjs` (16:9), in `examples/headless-video/`.
|
|
9282
9346
|
|
|
9283
9347
|
## Next
|
|
9284
9348
|
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
surface) build on the same figure model.
|
|
9349
|
+
AI/ML (networks with flowing activations, gradient descent on a loss surface,
|
|
9350
|
+
decision boundaries) builds on the same figure model.
|
|
9288
9351
|
See `todo.md` for their status.
|
|
9289
9352
|
|
|
9290
9353
|
---
|
|
@@ -10237,8 +10300,8 @@ On a page with no build step, load the maps add-on after the browser bundle; it
|
|
|
10237
10300
|
adds to the same `tinyfly` global:
|
|
10238
10301
|
|
|
10239
10302
|
```html
|
|
10240
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
10241
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
10303
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.118.0/cdn/tinyfly.iife.js"></script>
|
|
10304
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.118.0/cdn/tinyfly-maps.iife.js"></script>
|
|
10242
10305
|
```
|
|
10243
10306
|
|
|
10244
10307
|
It is a separate script because the offline world map it carries adds about
|
|
@@ -15467,7 +15530,7 @@ magnet.addEventListener('pointerleave', () => {
|
|
|
15467
15530
|
|
|
15468
15531
|
<!-- capabilities: generated from the library -->
|
|
15469
15532
|
|
|
15470
|
-
# tinyfly capabilities (v0.
|
|
15533
|
+
# tinyfly capabilities (v0.118.0)
|
|
15471
15534
|
|
|
15472
15535
|
Generated from the library itself: every name below is accepted, and names not listed are rejected (beat scripts, code panels and `checkTracks` say which name was probably meant).
|
|
15473
15536
|
|
|
@@ -15954,6 +16017,10 @@ A figure is JSON: a plane and items. Tracks on its target animate values by name
|
|
|
15954
16017
|
- `linearMapFigure, determinantFigure, eigenFigure, vectorSumFigure, spanFigure`: ready linear algebra figures; the matrix is the value M
|
|
15955
16018
|
- `tangentFigure, secantFigure, riemannFigure, areaFigure, taylorFigure, limitFigure`: ready calculus figures; their moving parts are number values (a, h, n, b, order, p)
|
|
15956
16019
|
- `differentiate / compileDerivative / integrate`: exact symbolic derivatives of expressions; Simpson integration
|
|
16020
|
+
- `normalFigure, binomialFigure, cltFigure, galtonFigure, monteCarloPiFigure, regressionFigure, bayesFigure`: ready probability and statistics figures
|
|
16021
|
+
- `graphSearchFigure, shortestPathFigure, recursionTreeFigure, vennFigure, clockFigure`: ready discrete maths figures; searches move with the value step
|
|
16022
|
+
- `searchEvents / parseSetExpression / regionCells`: graph searches as data; set expressions and their Venn cells
|
|
16023
|
+
- `distributions`: { kind: normal | uniform | exponential | binomial | poisson | dice | mean, …numbers or value names }; density, meanOf, sdOf, samples (seeded)
|
|
15957
16024
|
- `layoutTex(tex) / morphEquation(a, b, t)`: the built-in TeX subset, and term-by-term transitions
|
|
15958
16025
|
- `vec2, mat2`: 2D vectors and 2×2 matrices (apply, multiply, determinant, inverse, eigen)
|
|
15959
16026
|
|
|
@@ -15974,6 +16041,14 @@ Items (each has `id`, `kind`, and optional `color`, `draw`, `opacity`):
|
|
|
15974
16041
|
- `riemann` { expr, from, to, n, rule?: left | right | midpoint | trapezoid }: \val{ID.sum}, \val{ID.exact}
|
|
15975
16042
|
- `area` { expr, from, to, lower? }: signed, coloured by sign; \val{ID.value}
|
|
15976
16043
|
- `taylor` { expr, at, order }: exact Taylor polynomials; a fractional order grows the next term in
|
|
16044
|
+
- `histogram` { distribution, count, bins?, scale?, curve?, seed? }: seeded samples, binned; fills as count grows
|
|
16045
|
+
- `distribution` { distribution, shade?: [a, b] }: a density curve (bars when discrete); \val{ID.p}
|
|
16046
|
+
- `galton` { rows?, balls, spacing?, top?, seed? }: a Galton board; fractional balls = the next one falling
|
|
16047
|
+
- `scatter` { points: uniform | linear, count, inside?, fit?, seed? }: Monte Carlo and regression; \val{ID.ratio}, \val{ID.r}
|
|
16048
|
+
- `bayes` { prior, truePositive, falsePositive }: Bayes as areas; \val{ID.posterior}
|
|
16049
|
+
- `graph` { nodes, edges, directed?, tree?, search?: { kind: bfs | dfs | dijkstra, start }, step?, frontier? }: searches step by step
|
|
16050
|
+
- `venn` { sets (2 or 3), highlight?: set expression like (A | B)' }: shaded by clipping
|
|
16051
|
+
- `clock` { modulus, value }: clock arithmetic; \val{ID.hour}
|
|
15977
16052
|
|
|
15978
16053
|
Props a timeline animates:
|
|
15979
16054
|
|