| 1 |
|
| 2 |
The code cheby is intended to illustrate various Chebyshev spectral methods |
| 3 |
(namely Galerkin, tau and collocation) by solving a 1-D second order |
| 4 |
differential equation with boundary conditions: |
| 5 |
|
| 6 |
d^2 u/dx^2 - 4 du/dx + 4 u = e^x + C, x in [-1,1] |
| 7 |
|
| 8 |
u(-1) = 0 and u(1) = 0 |
| 9 |
|
| 10 |
C = - 4 e /(1+e^2) |
| 11 |
|
| 12 |
The exact solution is |
| 13 |
|
| 14 |
u(x) = e^x - sinh(1)/sinh(2) e^{2x} + C/4 |
| 15 |
|
| 16 |
and is used to measure the accuracy of the numerical solution. |
| 17 |
|
| 18 |
The numerical solution is searched by expansion onto Chebyshev |
| 19 |
polynomials T_0(x), T_1(x), ..., T_N(x). |
| 20 |
|
| 21 |
The maximum order of Chebyshev polynomials, N, is set by the |
| 22 |
integer variable nn at the first line of cheby.C : |
| 23 |
|
| 24 |
nn = N + 1 |
| 25 |
|
| 26 |
By default nn is set to 5, so that N = 4. |
| 27 |
|
| 28 |
The code cheby produces various output ASCII files to draw |
| 29 |
some figures with Grace. |
| 30 |
|