# Partial Differential Equation

(Redirected from PDE)

\$a_{5}(x,t) u_{xx} + a_{4}(x,t)u_{xt} + a_{3}(x,t) u_{tt} + a_{2}(x,t) u_{x} + a_{1}(x,t) u_{t} + a_{0}(x,t) u = f(x,t)\$

## Codebook

### Construction

So far only linear second-order partial differential equations can be constructed.

```double[] coeffs = {0.0, 1.0, 0.0, 0.0, 0.0, -1.0};
IDoubleFunction2D zero = DoubleVarFunction2D.create(0.0);
pde = new LinearPdeOrder2CP(coeffs, zero);
```

Assume that some constants have been defined.

```private static final double r = 0.05;
private static final double delta = 0.01;
private static final double sigma = 0.2;
```
```IDoubleFunction2D a = new DoubleVarFunction2D() {
public double apply(double xi, double theta) {
double s = sigma * xi * (1.0 - xi);
return -0.5 * s * s;
}
};
IDoubleFunction2D b = new DoubleVarFunction2D() {
public double apply(double xi, double theta) {
return -(r - delta) * xi * (1.0 - xi);
}
};
IDoubleFunction2D c = new DoubleVarFunction2D() {
public double apply(double xi, double theta) {
return -(r - delta) * xi;
}
};
IDoubleFunction2D zero2D = DoubleVarFunction2D.create(0.0);
IDoubleFunction2D one2D = DoubleVarFunction2D.create(1.0);

IDoubleFunction2D[] coefficients = new IDoubleFunction2D[]{c, one2D, b, zero2D, zero2D, a};
ILinearPde2D pde = new LinearPdeOrder2(coefficients, zero2D);
```