Partial Differential Equations

Spring 2015 Peter Coutts and Jerad Meisner Partial Differential Equations Introduction

Any differential equation that includes unknown multivariable functions and their partial . Used to describe physical phenomena e.g. sound, heat, electrostatics, electrodynamics, fluid flow, elasticity, and . Introduction

∂u − k∇2u = 0 ∂t

Describes distribution of heat in a region over time Solved by method of One-dimensional heat equation:

∂u ∂2u = k ∂t ∂x2 Heat Equation Separation of Variables

Assume solution (in this case u(x, t)) is actually a product solution – a product of functions, each dependent upon a single variable. In the case of the heat equation, we make the assumption that our solution will be of the form:

u(x, t) = F (x)G(t) Turn the PDE into two ordinary differential equations (ODEs) which should be much easier to solve. Heat Equation Separation of Variables

Plug product into equation and differentiate

∂ ∂2 [F (x)G(t)] = k [F (x)G(t)] ∂t ∂x2 dG d2F F (x) = kG(t) dt dx2 Let both sides equal γ and solve

dG d2F = γkG = γF dt dx2 Heat Equation Particular Solution

Define initial/boundary conditions

k = 2, 0 ≤ x ≤ π u(0, t) = u(π, t) = 0 u(x, 0) = x

Solution is Fourier sine series ∞ X 2 2 u(x, t) = (−1)n+1 sin (nx)e−2n t n n=1 Heat Equation Solution Laplace’s Equation Introduction

∂2f ∂2f ∂2f ∇2f = + + = 0 ∂x2 ∂y2 ∂z2

Second-order, homogeneous, partial differential equation ∇2: Divergence of the gradient - Laplacian Applications Gravitational and Electric Potentials Steady-state heat distribution Velocity potential (Fluid Dynamics) Transport Phenomena Laplace’s Equation Polar Spherical Coordinates

x = ρ sin θ cos φ y = ρ sin θ sin φ z = ρ cos θ

Plugging derivatives into Laplace’s equation:

1 ∂  ∂f  1 ∂  ∂f  1 ∂2f ∇2f = ρ2 + sin θ + = 0 ρ2 ∂ρ ∂ρ ρ2 sin θ ∂θ ∂θ ρ2 sin2 θ ∂φ2 Laplace’s Equation Solution

Use Separation of variables:

f(ρ, θ, φ) = R(ρ)Θ(θ)Φ(φ)

General Solution:

∞ `   X X ` B`,m m  f(ρ, θ, φ) = A`,mρ + P (cos θ) C`,m cos mφ + D`,m sin mφ ρ(`+1) ` `=0 m=0 | {z } | {z } | {z } Θ(θ) Φ(φ) R(ρ)

We are interested in the angular (φ and θ dependent) part Basis Functions Associated

A complete orthogonal set of solutions to Legendre’s equation

(−1)m p d`+m P m = (1 − x2)m (x2 − 1)` ` 2``! dx`+m Recursive Definition:

m m 2 m/2 Pm (x) = (−1) (2m − 1)!!(1 − x )

m m Pm+1(x) = x(2m + 1)Pm (x)

m m m (` − m)P` = x(2` − 1)P`−1(x) − (` + m − 1)P`−2(x) Basis Functions Associated Legendre Polynomials

First five associated Legendre polynomials Basis Functions Legendre Expansion

Can be used to expand and reconstruct any piecewise continuous function f(x).

1 Z an = f(x)pn(x)dx −1

∞ X f(x) = anpn n=0 N X f(x) ≈ anpn n=0 Legendre Expansion Example

N = 1 N = 2 N = 3

N = 4 N = 5 N = 6

Expansion of f(x) = 1.2x6 − 3.1x5 − 2.1x4 − x3 − 3x2 + 2x − 2 Spherical Harmonics Introduction

Angular component of solution to Laplace’s Equation

m m imφ Y` = P` (cos θ)e Physics Electron orbitals Gravitational fields Magnetic fields Cosmic microwave background radiation Computer Graphics Lighting Computation Modelling 3D shapes 2D analog to 1D Spherical Harmonics Examples

0 0 2 Y1 Y3 Y4

Examples of spherical harmonics using surface normal displacement Spherical Harmonics CG Lighting Computation

Dot Product Lighting

Light intensity multiplied by N · Li Gives lighting function defined on hemisphere of directions Integral over hemisphere gives illumination on surface Computationally expensive / Cannot be done real-time Spherical Harmonics Illumination Function Reconstruction

Have a function to integrate, but don’t know what the result looks like Can use spherical harmonics to reconstruct the illumination function ZZ m a`,m = f(x)Y` (x)ds S

∞ ` X X m f(x) = a`,mY` `=0 m=−` N ` X X m f(x) ≈ a`,mY` `=0 m=−` Spherical Harmonics Reconstruction Example

f(x) = 2 + sin 7θ sin 3φ N = 5 N = 7

N = 11 N = 16

Expansion of f(x) = 1.2x6 − 3.1x5 − 2.1x4 − x3 − 3x2 + 2x − 2 Spherical Harmonics Reconstruction Example

2 4 f(x) = 2 + sin 7θ + sin 3φ N = 5 N = 7

N = 11 N = 16

Expansion of f(x) = 1.2x6 − 3.1x5 − 2.1x4 − x3 − 3x2 + 2x − 2 Spherical Harmonics Real Examples

© Weta Digital Spherical Harmonics Real Examples

© 2009 20th Century Fox