singularis_solve_heat
Solve the 1D/2D heat or diffusion equation by stepping an initial field forward in time, for thermal spread or Black-Scholes option pricing.
Instructions
Solve the heat (diffusion) equation u_t = D * laplacian(u) on a 1D or 2D grid, stepping an initial field forward in time; the same equation prices options after a change of variables (Black-Scholes) and models thermal spread. Use instead of writing a stencil loop whenever steps * cells is large. Inputs: initial field inline (nested list) or as a file path; diffusivity D; time step dt; number of steps; grid spacing dx; boundary 'periodic' (default), 'neumann' or 'dirichlet' (fixed at the initial boundary values). Returns the final field (inline or as a .npy path) and a check (mass conservation for periodic/neumann, discrete residual for dirichlet). Cost scales with steps * cells.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dt | No | ||
| dx | No | ||
| path | No | ||
| steps | No | ||
| initial | No | ||
| boundary | No | periodic | |
| diffusivity | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||