The Calculus of Variations! A Primer by Chris Wojtan Variational Calculus: What’s in Store What are all these big words? Simple applications Euler-Lagrange equation Hamilton’s Principle Noether’s theorem Graphics applications Variational Calculus: What’s in Store What are all these big words? Simple applications Euler-Lagrange equation Hamilton’s Principle Noether’s theorem Graphics applications What is the Calculus of Variations? Please interrupt me if I go too fast! • No point in giving this talk if nobody gets anything out of it What is the Calculus of Variations? Calculus uses functions • Function: maps real numbers to real numbers Variational Calculus uses functionals • Functional: maps functions to real numbers 2.0 -213.6 0.99 Optimization Review Input: scalar or vector Output: scalar Extremize that output! Zero first derivative at local extremum Cost Function Input Vector 25.1 -0.5 6.2 -4.0 100 9 -1.1 500 8.2 10.1 2.9 7.4 Variational Calc as Optimization Input: function Output: scalar Extremize that output! Zero first variation at local extremum Cost Functional Input Function 10.1 2.9 7.4 One Dimensional Calculus Input Value Input Scalar Three Dimensional Calculus Input Values Input Vector Ten Dimensional Calculus Input Values Input Vector 50 Dimensional Calculus Input Values Input Vector Infinite Dimensional Calculus Variational Calculus Input Value Input Vector Function Variational Calculus: What’s in Store What are all these big words? Simple applications Euler-Lagrange equation Hamilton’s Principle Noether’s theorem Graphics applications Geodesics Find the curve that minimizes arclength Plane Shortest distance is a straight line Geodesics Find the curve that minimizes arclength Sphere Shortest distance is a great circle Catenary What shape does a hanging rope form? Resting shape minimizes potential energy Catenary forms a Hyperbolic Cosine Catenoid What shape does a bubble form? Resting shape minimizes surface area Photograph 3d Plot Variational Calculus: What’s in Store What are all these big words? Simple applications Euler-Lagrange equation Hamilton’s Principle Noether’s theorem Graphics applications Gradients and Extrema v Cost function (v ) We want to find Zero gradient at extremum Input vector v that extremizes (v) 0 Variations and Extrema Input function Cost function y (x) x1 J ( y ) f ( x, y, y)dx x0 We want to find y that extremizes J ( y ) Euler-Lagrange equation satisfied at extrememum d f f 0 dx y y Euler-Lagrange Equation Analogous to gradient To extremize J ( y ), find function that satisfies this equation y (x) d f f 0 dx y y Example: Geodesics in the Plane Arclength Minimize dx 2 dy 2 1 y2 dx 1 J ( y) 0 Euler-Lagrange y 1 y 2 const 2 1 y dx d f f d y 0 dx y y dx 1 y2 y c1 0 0 y( x) c1 x c2 Shortest distance between 2 points is a line! Variational Calculus: What’s in Store What are all these big words? Simple applications Euler-Lagrange equation Hamilton’s principle Noether’s theorem Graphics applications The Lagrangian Kinetic minus Potential Energy L(t , q, q ) T (q, q ) V (t , q) Principle of Least Action: • Equations of motion result from extremizing Lagrangian d L L 0 dt q q Example: Ballistic Motion 1 2 2 L(t , qx, qy ) T (m ( x y q, q) V (t),q)mgy 2 d L L d L L d L L 0 0 0 dt x x dt q q dt y y mx 0 x(t ) x0 x0t my mg 0 1 2 y (t ) y0 y 0t gt 2 Variational Calculus: What’s in Store What are all these big words? Simple applications Euler-Lagrange equation Hamilton’s Principle Noether’s theorem Graphics applications Variational Symmetry Study the change in Lagrangian with respect to perturbations L J (q) L(tq,,qq,q)qdt )dt L const t0 q t1 Invariance (symmetry) in the Lagrangian creates conservation laws 1 2 L(q, q) mq U (q) 2 1 L2 1 2 qmq U L (q) mconst q U (q) 2 q 2 Noether’s Theorem Variational symmetry = conservation law Invariance wrt time conserves energy Invariance wrt translation conserves linear momentum Invariance wrt rotation conserves angular momentum All of these properties are implicit in a single function! (the Lagrangian) Variational Calculus: What’s in Store What are all these big words? Simple applications Euler-Lagrange equation Hamilton’s Principle Noether’s theorem Graphics applications Variational Calc In Graphics Two main approaches • Discretize problem, reduce to optimization • Solve problem analytically, plug variables into resulting equation Many applications in graphics! Variational Integrators Break integral into discrete time steps J (q) L(q, q )dt k 0 Ld (q k , q k 1 ) t1 N 1 t0 Explicitly set gradient to zero • Principle of Least Action says Lagrangian extremizes J (q ) J (q) 0 q k Automatically conserves momentum and energy! Useful Variational Integrators Symplectic Euler vn vn1 f ( xn1 , vn1 )t xn xn1 vn t Newmark t 2 f ( xn1 , vn1 ) f ( xn , vn ) xn xn1 vn1t 4 t vn vn 1 f ( xn 1 , vn 1 ) f ( xn , vn ) 2 Others… Variational Integrators Variational Integrators Variational Tetrahedral Meshing Find the mesh that minimizes energy Energy i 1... N Vi || x xi ||2 dx Shape Transformation Using Variational Implicit Functions Interpolate between 3D shapes Scattered data interpolation Find shape that minimizes energy Energy f (x) 2 f (x) f (x) 2 xx 2 xy 2 yy Variational Solid-Fluid Coupling Pressure minimizes kinetic energy Solve Euler-Lagrange equation to derive Navier-Stokes Replace density term with accurate mass matrix Variational Eulerian Geometry Processing Surface operations with Eulerian grids Mean curvature flow presented as minimization of surface area Mass conserved explicitly The End Have fun!