Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions doc/sphinx/source/examples/Sturm-Liouville/Bessel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Bessel Sturm-Liouville Problem

This example solves the Bessel differential equation, which is a classic Sturm-Liouville problem:

$$ x^2 u'' + x u' + (x^2 - \nu^2) u = 0, \quad 0 < x 1 $$

with Dirichlet boundary conditions:
$$ u(0) = 0, \quad u(1) = J_\nu(1) $$

The exact solution to this problem is the Bessel function of the first kind of order $\nu$, denoted as $J_\nu(x)$. For $\nu = 3$, the solution is $ J_3(x) = \frac{1}{\pi}\int^{\pi}_0 \cos(3\tau) - x\sin(\tau)\,d\tau $.

## Mathematical Background

Bessel's differential equation is a special case of the Sturm-Liouville problem, which has the general form:

$$\frac{d}{dx}\left(p(x)\frac{du}{dx}\right) + q(x)u + \lambda r(x)u = 0$$

For Bessel's equation, we have:

- $p(x) = x^2$
- $q(x) = x$
- $r(x) = \frac{1}{x}$
- $\lambda = -\nu^2$

## Discretization

The equation is discretized using mimetic finite difference operators. The spatial derivative operators are constructed with a specified order of accuracy $k$.

The discrete system is:

$$A u = b$$

where:

- $A = x^2 L + x I_{FC} G + (x^2 - \nu^2) I$
- $L$ is the mimetic Laplacian
- $G$ is the mimetic gradient
- $I_{FC}$ is the interpolation operator from faces to centers
- $I$ is the identity matrix

Boundary conditions are applied using `RobinBC`.

---

This example is implemented in:

- [MATLAB/OCTAVE](https://github.com/csrc-sdsu/mole/blob/main/examples/matlab_octave/sturmLiouvilleBessel.m)
- [C++](https://github.com/csrc-sdsu/mole/blob/main/examples/cpp/sturmLiouvilleBessel.cpp)

## Results

The numerical solution closely matches the exact solution, which is the Bessel function of the first kind of order $\nu$:

$J_\nu(x) = \frac{1}{\pi}\int^{\pi}_0 \cos(\nu\tau) - x\sin(\tau)\,d\tau$.
14 changes: 10 additions & 4 deletions doc/sphinx/source/examples/Sturm-Liouville/Chebyshev.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Chebyshev's differential equation is a special case of the Sturm-Liouville probl
$$\frac{d}{dx}\left(p(x)\frac{du}{dx}\right) + q(x)u + \lambda r(x)u = 0$$

For Chebyshev's equation, we have:

- $p(x) = 1-x^2$
- $q(x) = 0$
- $r(x) = 1$
Expand All @@ -30,23 +31,28 @@ The discrete system is:
$$A u = b$$

where:
- $A = (1-x^2) L - x I G + n^2 I$

- $A = (1-x^2) L - x I_{FC} G + n^2 I$
- $L$ is the mimetic Laplacian
- $G$ is the mimetic gradient
- $I$ is the interpolation operator from faces to centers
- $I_{FC}$ is the interpolation operator from faces to centers
- $I$ is the identity matrix

Boundary conditions are applied using the `addScalarBC1D` function.

---

This example is implemented in:

- [MATLAB/OCTAVE](https://github.com/csrc-sdsu/mole/blob/main/examples/matlab_octave/sturmLiouvilleChebyshev.m)
- [C++](https://github.com/csrc-sdsu/mole/blob/main/examples/cpp/sturmLiouvilleChebyshev.cpp)

## Results

The numerical solution closely matches the exact solution, which is the Chebyshev polynomial $T_2(x) = 2x^2 - 1$.
The numerical solution closely matches the exact solution, which is the Chebyshev polynomial $T_2(x) = 2x^2 - 1$.

Chebyshev polynomials are important in numerical analysis and approximation theory because they:

1. Minimize the maximum error in polynomial approximation
2. Have roots that are optimal interpolation points (Chebyshev nodes)
3. Are closely related to the Fourier cosine series
3. Are closely related to the Fourier cosine series
56 changes: 56 additions & 0 deletions doc/sphinx/source/examples/Sturm-Liouville/Helmholtz.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Helmholtz Sturm-Liouville Problem

This example solves the Helmholtz differential equation, which is a classic Sturm-Liouville problem:

$$ u'' + u = 0, \quad 0 < x < 3 $$
or
$$ u'' + \mu^2 u = 0, \quad 0 < x < 1 $$

with boundary conditions:
$$ u(0) = 0, \quad u(3) = \sin(3) $$
or
$$ u'(0) = 0, \quad u(1) + u'(1) = \cos(\mu) - \mu \sin(\mu) $$

The exact solution to this problem is $\sin(x)$ or $\cos(\mu x)$.

## Mathematical Background

Helmholtz's differential equation is a special case of the Sturm-Liouville problem, which has the general form:

$$\frac{d}{dx}\left(p(x)\frac{du}{dx}\right) + q(x)u + \lambda r(x)u = 0$$

For Helmholtz's equation, we have:

- $p(x) = 1$
- $q(x) = 0$
- $r(x) = 1$
- $\lambda = \mu^2$

## Discretization

The equation is discretized using mimetic finite difference operators. The spatial derivative operators are constructed with a specified order of accuracy $k$.

The discrete system is:

$$A u = b$$

where:

- $A = L + I$
- $L$ is the mimetic Laplacian
- $I$ is the identity matrix

Boundary conditions are applied using `RobinBC` or `MixedBC`.

---

These examples are implemented in:

- [MATLAB/OCTAVE](https://github.com/csrc-sdsu/mole/blob/main/examples/matlab_octave/sturmLiouvilleHelmholtzDirichletDirichlet.m)
- [C++](https://github.com/csrc-sdsu/mole/blob/main/examples/cpp/sturmLiouvilleHelmholtzDirichletDirichlet.cpp)
- [MATLAB/OCTAVE](https://github.com/csrc-sdsu/mole/blob/main/examples/matlab_octave/sturmLiouvilleHelmholtzDirichletRobin.m)
- [C++](https://github.com/csrc-sdsu/mole/blob/main/examples/cpp/sturmLiouvilleHelmholtzDirichletRobin.cpp)

## Results

The numerical solutions closely match the exact solutions, which are $\sin(x)$ or $\cos(\mu x)$.
52 changes: 52 additions & 0 deletions doc/sphinx/source/examples/Sturm-Liouville/Hermite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Hermite Sturm-Liouville Problem

This example solves the Hermite differential equation, which is a classic Sturm-Liouville problem:

$$ u'' - 2 u' + 2 m u = 0, \quad -1 < x < 1 $$

with Dirichlet boundary conditions:
$$ u(-1) = H_m(-1), \quad u(1) = H_m(1) $$

The exact solution to this problem is the Hermite polynomial of degree $m$, denoted as $H_m(x)$. For $m = 4$, the solution is $H_4(x) = e^{x^2} \frac{d^4}{dx^4}e^{-x^2}$.

## Mathematical Background

Hermite's differential equation is a special case of the Sturm-Liouville problem, which has the general form:

$$\frac{d}{dx}\left(p(x)\frac{du}{dx}\right) + q(x)u + \lambda r(x)u = 0$$

For Hermite's equation, we have:

- $p(x) = e^{-x^2}$
- $q(x) = 0$
- $r(x) = e^{-x^2}$
- $\lambda = m^2$

## Discretization

The equation is discretized using mimetic finite difference operators. The spatial derivative operatores are constructed with a specified order of accuracy $k$.

The discrete system is:

$$A u = b$$

where

- $A = L - 2 x I_{FC} G + 2 m I$
- $L$ is the mimetic Laplacian
- $G$ is the mimetic gradient
- $I_{FC}$ is the interpolation operator from faces to centers
- $I$ is the identity matrix

Boundary conditions are applied using `RobinBC`.

---

This example is implemented in:

- [MATLAB/OCTAVE](https://github.com/csrc-sdsu/mole/blob/main/examples/matlab_octave/sturmLiouvilleHermite.m)
- [C++](https://github.com/csrc-sdsu/mole/blob/main/examples/cpp/sturmLiouvilleHermite.cpp)

## Results

The numerical solution closely matches the exact solution, which is the Hermite polynomial $H_4(x) = e^{x^2} \frac{d^4}{dx^4}e^{-x^2}$.
52 changes: 52 additions & 0 deletions doc/sphinx/source/examples/Sturm-Liouville/Laguerre.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Laguerre Sturm-Liouville Problem

This example solves the Laguerre differential equation, which is a classic Sturm-Liouville problem:

$$x u'' + (1 - x) u' + n u = 0, \quad 0 < x < 2$$

with Dirichlet boundary conditions:
$$ u(0) = L_n(2), \quad u(2) = L_n(2) $$

The exact solution to this problem is the Laguerre polynomial of degree $n$, denoted as $L_n(x)$. For $n = 4$, the solution is $L_4(x) = \frac{e^x}{4!} \frac{d^4}{dx^4} (e^{-x}x^4) $.

## Mathematical Background

Laguerre's differential equation is a special case of the Sturm-Liouville problem, which has the general form:

$$\frac{d}{dx}\left(p(x)\frac{du}{dx}\right) + q(x)u + \lambda r(x)u = 0$$

For Laguerre's equation, we have:

- $p(x) = xe^{-x}$
- $q(x) = 0$
- $r(x) = e^{-x}$
- $\lambda = n$

## Discretization

The equation is discretized using mimetic finite difference operators. The spatial derivative operators are constructed with a specified order of accuracy $k$.

The discrete system is:

$$A u = b$$

where:

- $A = x L + (1 - x) I_{FC} G + n I$
- $L$ is the mimetic Laplacian
- $G$ is the mimetic gradient
- $I_{FC}$ is the interpolation operator from faces to centers
- $I$ is the identity matrix

Boundary conditions are applied using `RobinBC`.

---

This example is implemented in:

- [MATLAB/OCTAVE](https://github.com/csrc-sdsu/mole/blob/main/examples/matlab_octave/sturmLiouvilleLaguerre.m)
- [C++](https://github.com/csrc-sdsu/mole/blob/main/examples/cpp/sturmLiouvilleLaguerre.cpp)

## Results

The numerical solution closely matches the exact solution, which is the Laguerre polynomial $L_4(x) = \frac{e^x}{4!} \frac{d^4}{dx^4} (e^{-x}x^4) $.
52 changes: 52 additions & 0 deletions doc/sphinx/source/examples/Sturm-Liouville/Legendre.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Legendre Sturm-Liouville Problem

This example solves the Legendre differential equation, which is a classic Sturm-Liouville problem:

$$ (1 - x^2) u'' - 2 x u' + n (n + 1) u = 0, \quad -1 < x < 1 $$

with Dirichlet boundary conditions:
$$ u(-1) = -1, \quad u(1) = 1 $$

The exact solutoin to this problem is the Legendre polynomial of degree $n$, denoted as $L_n(x)$. For $n = 4$, the solution is $L_4(x) = \frac{1}{8}(35x^4 -30x^2 + 3)$.

## Mathematical Background

Legendre's differential equation is a special case of the Sturm-Liouville problem, which has the general form:

$$\frac{d}{dx}\left(p(x)\frac{du}{dx}\right) + q(x)u + \lambda r(x)u = 0$$

For Legendre's equation, we have:

- $p(x) = 1-x^2$
- $q(x) = 0$
- $r(x) = 1$
- $\lambda = n(n+1)$

## Discretization

The equation is discretized using mimetic finite difference operators. The spatial derivative operators are constructed with a specified order of accuracy $k$.

The discrete system is:

$$A u = b$$

where:

- $A = (1 - x^2) L - 2 x I_{FC} G + n(n+1) I$
- $L$ is the mimetic Laplacian
- $G$ is the mimetic gradient
- $I_{FC}$ is the interpolation operator from faces to centers
- $I$ is the identity matrix

Boundary conditions are applied using `RobinBC`.

---

This example is implemented in:

- [MATLAB/OCTAVE](https://github.com/csrc-sdsu/mole/blob/main/examples/matlab_octave/sturmLiouvilleLegendre.m)
- [C++](https://github.com/csrc-sdsu/mole/blob/main/examples/cpp/sturmLiouvilleLegendre.cpp)

## Results

The numerical solution closely matches the exact solution, which is the Legendre polynomial $L_4(x) = \frac{1}{8}(35x^4 -30x^2 + 3)$.
7 changes: 6 additions & 1 deletion doc/sphinx/source/examples/Sturm-Liouville/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ Sturm-Liouville theory deals with a class of second-order linear differential eq
:maxdepth: 1
:caption: Contents

Bessel
Chebyshev
```
Helmholtz
Hermite
Laguerre
Legendre
```
Loading