TheAlgorithms/Python · error · ValueError
Insufficient initial points information.
Error message
Insufficient initial points information.
What it means
Error "Insufficient initial points information." thrown in TheAlgorithms/Python.
Source
Thrown at maths/numerical_analysis/adams_bashforth.py:81
for x0, x1 in zip(self.x_initials, self.x_initials[1:])
):
raise ValueError("x-values must be equally spaced according to step size.")
def step_2(self) -> np.ndarray:
"""
>>> def f(x, y):
... return x
>>> AdamsBashforth(f, [0, 0.2], [0, 0], 0.2, 1).step_2()
array([0. , 0. , 0.06, 0.16, 0.3 , 0.48])
>>> AdamsBashforth(f, [0, 0.2, 0.4], [0, 0, 0.04], 0.2, 1).step_2()
Traceback (most recent call last):
...
ValueError: Insufficient initial points information.
"""
if len(self.x_initials) != 2 or len(self.y_initials) != 2:
raise ValueError("Insufficient initial points information.")
x_0, x_1 = self.x_initials[:2]
y_0, y_1 = self.y_initials[:2]
n = int((self.x_final - x_1) / self.step_size)
y = np.zeros(n + 2)
y[0] = y_0
y[1] = y_1
for i in range(n):
y[i + 2] = y[i + 1] + (self.step_size / 2) * (
3 * self.func(x_1, y[i + 1]) - self.func(x_0, y[i])
)
x_0 = x_1
x_1 += self.step_size
return y
View on GitHub (pinned to f5988cc097)
Solutions
- Provide at least as many initial (x, y) points as the method's order requires.
- Use a single-step method (e.g. Runge-Kutta) to generate the missing starting points.
When it happens
Trigger: Thrown at maths/numerical_analysis/adams_bashforth.py:81 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of TheAlgorithms/Python@f5988cc097 (2026-08-14).
Data as JSON: /api/errors/f88c56cebe1b9c16.
Report an issue: GitHub.