# PCE_LEGENDRE Polynomial Chaos Expansion using Legendre Polynomials

PCE_LEGENDRE is a MATLAB library which sets up the system matrix for a polynomial chaos expansion, using Legendre polynomials with a linear factor, applied to a 2D PDE with a stochastic diffusion coefficient.

We wish to analyze a stochastic PDE of the form:

```
-div A(X,Y) grad U(X,Y) = F(X)
```
where
• U(X,Y) is an unknown scalar function,
• A(X,Y) is a given diffusion function,
• F(X) is a given right hand side function,
• X represents dependence on spatial variables,
• Y represents dependence on stochastic variables.

We let X be a space of finite element functions generated by piecewise linear functions associated with a particular triangular dissection of the unit square.

We let Y be the space of polynomials over R^N with total degree at most P.

We seek solutions U in XxY using a polynomial chaos expansion approach.

### Usage:

[ nxy, bxy, fxy ] = pce_legendre_linear_assemble ( n, p )
where the input is:
• n, the number of factors in the probability space.
• p, the maximum degree of the basis functions for the probability space.
and the output is
• nxy, the order of the matrix BXY. NXY = NX * NY.
• bxy, the system matrix, stored in sparse format.
• fxy, the right hand side.

### Languages:

PCE_LEGENDRE is available in a MATLAB version.

### Related Data and Programs:

CNOISE, a MATLAB library which generates samples of noise obeying a 1/f^alpha power law, by Miroslav Stoyanov.

LEGENDRE_POLYNOMIAL, a MATLAB library which evaluates the Legendre polynomial and associated functions.

LEGENDRE_RULE, a MATLAB program which computes a Gauss-Legendre quadrature rule.

PCE_BURGERS, a MATLAB program which defines and solves a version of the time-dependent viscous Burgers equation, with uncertain viscosity, using a polynomial chaos expansion, by Gianluca Iaccarino.

PCE_ODE_HERMITE, a MATLAB program which sets up a simple scalar ODE for exponential decay with an uncertain decay rate, using a polynomial chaos expansion in terms of Hermite polynomials.

POLPAK, a MATLAB library which evaluates a variety of mathematical functions.

STOCHASTIC_DIFFUSION, a MATLAB library which implements several versions of a stochastic diffusivity coefficient.

SUBSET, a MATLAB library which enumerates combinations, partitions, subsets, index sets, and other combinatorial objects.

### Reference:

1. Milton Abramowitz, Irene Stegun,
Handbook of Mathematical Functions,
National Bureau of Standards, 1964,
ISBN: 0-486-61272-4,
LC: QA47.A34.
2. Philip Davis, Philip Rabinowitz,
Methods of Numerical Integration,
Second Edition,
Dover, 2007,
ISBN: 0486453391,
LC: QA299.3.D28.
3. Roger Ghanem, Pol Spanos
Stochastic Finite Elements: A Spectral Approach,
Revised Edition,
Dover, 2003,
ISBN: 0486428184,
LC: TA347.F5.G56.
4. Dongbin Xiu,
Numerical Methods for Stochastic Computations: A Spectral Method Approach,
Princeton, 2010,
ISBN13: 978-0-691-14212-8,
LC: QA274.23.X58.
5. Daniel Zwillinger, editor,
CRC Standard Mathematical Tables and Formulae,
30th Edition,
CRC Press, 1996,
ISBN: 0-8493-2479-3,
LC: QA47.M315.

### Source Code:

• pce_legendre_linear_assemble.m, assembles the system matrix for a polynomial chaos expansion, using Legendre polynomials with a linear factor, for a 2D PDE with a stochastic diffusion coefficient.

### Examples and Tests:

• arrow_n3_p2.png, a SPY picture of the nonzeros in the matrix bxy produced by
[nxy,bxy,fxy]=pce_legendre_linear_assemble(3,2)
• arrow_n4_p1.png, a SPY picture of the nonzeros in the matrix bxy produced by
[nxy,bxy,fxy]=pce_legendre_linear_assemble(4,1)
• arrow_n4_p2.png, a SPY picture of the nonzeros in the matrix bxy produced by
[nxy,bxy,fxy]=pce_legendre_linear_assemble(4,2)
• arrow_n4_p3.png, a SPY picture of the nonzeros in the matrix bxy produced by
[nxy,bxy,fxy]=pce_legendre_linear_assemble(4,3)
• arrow_n4_p4.png, a SPY picture of the nonzeros in the matrix bxy produced by
[nxy,bxy,fxy]=pce_legendre_linear_assemble(4,4)

You can go up one level to the MATLAB source codes.