specular.ode.ODEResult
ODEResult(t, u, sigma, number_of_field_evaluations)
Container for the numerical data returned by every scalar ODE method.
Attributes
| Name | Type | Description |
|---|---|---|
t |
NumPy float64 array, shape (N_h + 1,) |
Nodes t_0 + n*h, for n=0,...,N_h, where N_h=floor((T-t_0)/h). The final node may precede T. |
u |
NumPy float64 array, shape (N_h + 1,) |
Initial value followed by the solution values at the time nodes. For Types 1/2, u[1] is the externally supplied starter. |
sigma |
NumPy float64 array, shape (N_h,) |
Scale used for each step. |
number_of_field_evaluations |
int | Number of calls to F(point) with point=[t,u] made by the solver. |
Notes
This is a frozen, slotted dataclass. Its attribute bindings cannot be reassigned,
but the contained NumPy arrays are mutable. Results contain numerical data;
plotting, event handling, and dense output are outside this API.
The arrays t and u are views of separate rows of the same preallocated
two-row grid. There is no extra solution value or scale for a shortened step
to T.
For all three Euler methods, sigma contains ones. In Types 1/2, this convention
also covers the first interval and does not describe how u_1 was produced.
In fourth-order mode, sigma records the SE4 scale or the fallback 1.0.
In auto mode, it may also record the left-endpoint SE3 fallback scale.
The recorded scale is the one used by the final fixed-point update that
produced the accepted value; the scale is not recomputed at that final value.
All recorded scales are finite and positive.
See Result.
Field calls made internally by a user-provided derivatives_of_F callback
are not included in number_of_field_evaluations.
Examples
import specular.ode
result = specular.ode.ellipse_scheme(
lambda point: -point[1], 0.0, 1.0, 1.0,
h=0.01, sigma_n=1.0,
)
print(result.t.shape, result.u.shape, result.sigma.shape)
print(result.number_of_field_evaluations)
Source code in specular/ode/_result.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |