Solve the heat equation
singularis_solve_heatSolve the heat (diffusion) equation on 1D or 2D grids, advancing an initial field over time with periodic, Neumann, or Dirichlet boundaries; returns final field and accuracy checks.
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 | |||