1import fh from './fh.m?raw'
2import berrut from './berrut.m?raw'
3import uniformInteger from './uniform-integer.m?raw'
4import lagrange from './lagrange.m?raw'
5import equal from './equal.m?raw'
6import random from './random.m?raw'
8export interface Method {
9 id: string
10 name: string
11 /** one line, shown in the picker */
12 blurb: string
13 source: string
14}
16export const METHODS: Method[] = [
17 {
18 id: 'fh',
19 name: 'Floater-Hormann',
20 blurb: 'The paper: blend n-d+1 local polynomials of degree d. No poles, order h^(d+1).',
21 source: fh,
22 },
23 {
24 id: 'berrut',
25 name: 'Berrut (d = 0)',
26 blurb: 'Weights (-1)^k. The d = 0 member, and the one that needs a bounded mesh ratio.',
27 source: berrut,
28 },
29 {
30 id: 'uniform-integer',
31 name: 'Integer weights',
32 blurb: "Section 4's closed form on a uniform mesh: 1, 4, 7, 8, ..., 8, 7, 4, 1 for d = 3.",
33 source: uniformInteger,
34 },
35 {
36 id: 'lagrange',
37 name: 'Polynomial (d = n)',
38 blurb: 'The Lagrange weights of equation (2). No poles, but Runge divergence.',
39 source: lagrange,
40 },
41 {
42 id: 'equal',
43 name: 'Equal weights',
44 blurb: 'w_k = 1. Drop the alternating signs and a pole appears in every interval.',
45 source: equal,
46 },
47 {
48 id: 'random',
49 name: 'Random weights',
50 blurb: 'The generic barycentric rational interpolant. Interpolates; has poles.',
51 source: random,
52 },
53]
55export const DEFAULT_METHOD = METHODS[0]
57export function findMethod(id: string | null | undefined): Method | undefined {
58 return METHODS.find((m) => m.id === id)
59}