

NumericalAnalysisKit
This package contains libraries for performing various kinds of numerical analysis tasks.
NumericalPDEKit
This library contains various numerical solvers for partial differential equations (soon to include hyperbolic solvers, as well).
EllipticalPDE
This struct
uses finite difference methods to solve elliptical PDEs numerically.
For usage, please have a look at some of the examples in the EllipticalPDETests.
ParabolicPDE
This struct
implements the Crank-Nicolson method to solve parabolic PDEs numerically.
For usage, please have a look at some of the examples in the ParabolicPDETests.
HyperbolicPDE (coming soon)
Not yet implemented, but this will provide solvers for hyperbolic PDEs.
VisualizationKit
This library provides utilities for generating various visualizations based on solutions to numerical analysis problems. Currently, this is limited to generating 2D images representing cross-sectional heat maps in any of the x
-, y
-, or z
-directions.
Examples
Laplace Equation in 2 Spatial Dimensions
Use the framework to generate heat maps indicating scalar values at various points in space. For example, the below rendering shows what a solution to Laplace’s equation on a fine rectangular mesh would look like, subject to certain Dirichlet boundary conditions (in this example, a thin sheet is held at 100ºC on one edge, and 0ºC on the other three; interior temperatures are pictured, with cooler temperatures indicated in blue, gradually increasing towards hotter temperatures in red):

Heat Equation in 2 Spatial Dimensions
Using the same physical conditions as in the above exampe, we can similarly render a time-dependent (unsteady-state) solution to the Heat Equation for a sequence of discrete time steps (in this case, stitched together into an animated GIF):

Laplace Equation in 3 Spatial Dimensions
This last example illustrates how heat maps can be used to visualize solutions u(x,y,z)
over 3D rectangular regions in space. Laplace’s equation is solved on a 15cm x
15cm x
15cm cube, with spatial step size h
= 0.5 cm; each face is held at a different temperature, starting with 0ºC, and stepping upward in 20º-increments, up through 100ºC. Temperatures u
are known at all grid points within the 3D mesh. Each of the following images represent a specific 2D cross-sectional heat map, taken from a specific location along the x-
, y-
, or z-
axis.
- Cross-sectional heat map at
x = 11
: 
- Cross-sectional heat map at
y = 11
: 
- Cross-sectional heat map at
z = 11
: 
NumericalAnalysisKit
Numerical analysis toolkit for Swift
This package contains libraries for performing various kinds of numerical analysis tasks.
NumericalPDEKit
This library contains various numerical solvers for partial differential equations (soon to include hyperbolic solvers, as well).
EllipticalPDE
This
struct
uses finite difference methods to solve elliptical PDEs numerically.For usage, please have a look at some of the examples in the EllipticalPDETests.
ParabolicPDE
This
struct
implements the Crank-Nicolson method to solve parabolic PDEs numerically.For usage, please have a look at some of the examples in the ParabolicPDETests.
HyperbolicPDE (coming soon)
Not yet implemented, but this will provide solvers for hyperbolic PDEs.
VisualizationKit
This library provides utilities for generating various visualizations based on solutions to numerical analysis problems. Currently, this is limited to generating 2D images representing cross-sectional heat maps in any of the
x
-,y
-, orz
-directions.Examples
Laplace Equation in 2 Spatial Dimensions
Use the framework to generate heat maps indicating scalar values at various points in space. For example, the below rendering shows what a solution to Laplace’s equation on a fine rectangular mesh would look like, subject to certain Dirichlet boundary conditions (in this example, a thin sheet is held at 100ºC on one edge, and 0ºC on the other three; interior temperatures are pictured, with cooler temperatures indicated in blue, gradually increasing towards hotter temperatures in red):
Heat Equation in 2 Spatial Dimensions
Using the same physical conditions as in the above exampe, we can similarly render a time-dependent (unsteady-state) solution to the Heat Equation for a sequence of discrete time steps (in this case, stitched together into an animated GIF):
Laplace Equation in 3 Spatial Dimensions
This last example illustrates how heat maps can be used to visualize solutions
u(x,y,z)
over 3D rectangular regions in space. Laplace’s equation is solved on a 15cmx
15cmx
15cm cube, with spatial step sizeh
= 0.5 cm; each face is held at a different temperature, starting with 0ºC, and stepping upward in 20º-increments, up through 100ºC. Temperaturesu
are known at all grid points within the 3D mesh. Each of the following images represent a specific 2D cross-sectional heat map, taken from a specific location along thex-
,y-
, orz-
axis.x = 11
:y = 11
:z = 11
: