. . . . .. . Double ansatz spaces and barycentric rootfinding Alex Townsend Oxford University NLA group, Manchester University 6th of November 2012 . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Global rootfinding Find all x ∈ Ω ⊂ C such that p(x) = n ∑ ak φk (x) = 0, ak ∈ C. k=0 Examples: .1. Monomials: φk (x) = x k . .2. Chebyshev (of the first kind): φk (x) = cos(k cos−1 (x)). .. Degree-graded: φk (x) is of degree k. 3 . . . ... ... 4 5 Lagrange: φk (x) = Lk (x). ( ) Bernstein: φk (x) = kn x k (1 − x)n−k . . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Global eigenvalue finding Characteristic polynomial: p(x) = det (xI − A), A ∈ Cn×n . Polynomials of degree N N x N matrix conjugacy classes Many, many eigenvalue and generalised eigenvalue problems. Specht (1957), Barnett (1975), Feidler (2003), Corless (2010), Mackey, Mackey, Mehl and Mehrmann (2005). . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Double ansatz spaces Part I: Double Ansatz Spaces . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Companion form (of the first kind) C1 (x) = an x 1 .. . an−1 −1 + an−2 .. ... a0 −1 0 . 1 . It satisfies the following n−1 x p(x) n−2 x 0 C1 (x) . = . .. .. 0 1 and the column shift sum relation 0 an 0 0 1 0 .. + .. .. . . . 0 1 0 an−1 −1 an−2 .. ... a0 −1 0 . . Alex Townsend . > = e1 ⊗ a . . . . Double ansatz spaces and barycentric rootfinding . . Companion form (of the second kind) The companion form of the second an 1 .. C2 (y ) = y . 1 kind: an−1 an−2 .. + . 1 It satisfies the following ( n−1 y y n−2 ... 0 0 ... 0 0 . a0 0 −1 . −1 0 0 0 ... −1 .. a0 . Alex Townsend −1 .. ) ( 1 C2 (y ) = p(y ) and the row shift sum relation 0 an an−1 1 an−2 .. . + . .. 1 1 −1 . ... 0 0 ) > = a ⊗ e1 . −1 0 . . . . Double ansatz spaces and barycentric rootfinding . . Generalising the companion form The companion forms motivate finding pencils L1 (x) = Ax + B, A, BRn×n such that [A|0] + [0|B] = v ⊗ a> , and pencils L2 (x) = Ax + B such that [ ] [ ] A 0 + = a ⊗ w >, 0 B v ∈ Rn×1 w ∈ Rn×1 . These linearisations form vector spaces L1 (p) and L2 (p). Of particular interest is their intersection: DL(p) = L1 (p) ∩ L2 (p). These spaces are studied in the M4 paper. . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Thinking in a continuous mode Let’s replace matrices with functions: an−1,n−1 an−1,n−2 . . . an−1,0 an−2,n−1 an−2,n−2 . . . an−2,0 A= .. .. .. .. . . . . a0,n−1 a0,n−2 ... a0,0 Column-shift in a continuous mode is an−1,n−1 an−1,n−2 . . . an−1,0 an−2,n−1 an−2,n−2 . . . an−2,0 .. .. .. .. . . . . a0,n−1 a0,n−2 ... a0,0 f (x, y ) = n−1 ∑ n−1 ∑ aij y i x j . i=0 j=0 multiplication in ‘x’: 0 ( n−1 n−1 ) 0 ∑∑ i j f (x, y )x = a y x x .. ij . i=0 j=0 0 Hence, [A|0] + [0|B] = v ⊗ a> [ ] [ ] A 0 + = a ⊗ w> 0 B f (x, y )x + g (x, y ) = v (y )p(x). yf (x, y ) + g (x, y ) = p(y )w (x). . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . L1 and L2 in a continuous mode In a continuous mode this is: L1 (p) = {f (x, y )x + g (x, y ) : f (x, y )x + g (x, y ) = v (y )p(x)} . L2 (p) = {yf (x, y ) + g (x, y ) : yf (x, y ) + g (x, y ) = p(y )w (x)} . Notice these definitions are basis independent. . Double Ansatz Space . .. Choose w (x) and v (y ) as polynomials of degree n and find f (x, y ) and g (x, y ) such that f (x, y )x + g (x, y ) = v (y )p(x) and yf (x, y ) + g (x, y ) = p(y )w (x). . . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . .. . . A single ansatz space . Lemma (Double Ansatz space is a single ansatz) .. We . must choose v (x) = w (x). .. . Proof. .. . . . . Hence, w (x) and v (x) are continuous and equal up to set of measure zero ⇒ v (x) = w (x). . .. This in a technical appendix of the M4 paper. . Alex Townsend . . . . . Double ansatz spaces and barycentric rootfinding . p(x)w (x) = xf (x, x) + g (x, x) = f (x, x)x + g (x, x) = v (x)p(x) . . Eigenvalue Exclusion Theorem . . Theorem (Eigenvalue Exclusion (‘only if’ direction)) . .. If p(x) is a regular polynomial and L(x) is in DL(p) with ansatz v (y ) then L(x) is a linearisation of p(x) only if v (y ) does not share a. root with p(x). .. . . Proof. . .. yf (x, y ) − f (x, y )x = p(y )v (x) − v (y )p(x) yg (x, y ) − g (x, y )x = yv (y )p(x) − p(y )v (x)x. If p(y0 ) = v (y0 ) = 0 then and y0 g (x, y0 ) − g (x, y0 )x = 0. For all x, det(L(x)) = det(p(x)) = 0 which contradicts p(x) being regular. . .. . . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . y0 f (x, y0 ) − f (x, y0 )x = 0 . . Multiplication matrices A column and row shift can be written as > 1 0 1 0 [ ] X .. . . . .. = [X |0] .. .. X = X . . 0 1 0 1 0 | {z } | {z } M> M M represents multiplication. For the Chebyshev basis it is: 1 1 2 0 2 1 1 0 2 2 .. .. . . M= 1 2 .. . .. . 1 ∈ Rn×n+1 . 1 2 0 . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Constructing DL We have yf (x, y ) − f (x, y )x = p(y )v (x) − v (y )p(x) yg (x, y ) − g (x, y )x = yv (y )p(x) − p(y )v (x)x. These become Sylvester matrix equations: ] [ 0 ] [ ] [ 0 ] [ > > 0|M X − = 0|av − XM va> [ ] [ 0 ] [ 0 ] [ ] > > 0|M Y − = − 0|av M . YM M > va> These can be solved by the Bartels–Stewart algorithm while taking into account the extra degrees of freedom. . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Example: For the cubic polynomials in the Chebyshev basis, i.e. p(x) = AT3 (x) + BT2 (x) + CT1 (x) + DT0 (x) we have: v DL Linearisation 1 0 0 2A x 0 0 0 1 0 0 0 1 0 2A − 2C −2D 0 x 2A 0 0 x 0 2A 2A 2B 2A 0 4A 2B 0 B −2D + C − A A−C D 0 −A 2A + 0 B −D −A 0 C − 3A D −B 2A 0 2B + −2A C +A 0 −A D − B −A 0 −2A D −B −2A −2B −2A . Alex Townsend D C − A D C −A 2D C −A . . . . Double ansatz spaces and barycentric rootfinding . . Barycentric rootfinding Part II: Barycentric rootfinding . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Barycentric rootfinding The roots of the polynomial p(x) = n ∑ ∏n p(xk )`k (x), k=0 j=0,j6=k (x − xj ) `k (x) = ∏n j=0,j6=k (xk − xj ) are the eigenvalues of the generalised eigenvalue system associated to 0 0 p0 p1 . . . pn −1 w0 x0 −1 w x 1 1 B(x) = x + . . . . . . . . . . −1 wn xn Exactly two eigenvalues are spurious. Lawrence and Corless (2011). . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Barycentric nodes and weights Barycentric nodes: x0 , x1 , . . . , xn are the roots of φn+1 (x). Barycentric weights: wk = const. φ0n+1 (xk ) Golub–Welsch algorithm (1969) can be used to compute the barycentric (and quadrature) weights in O(n2 ) operations. Glaser–Lui–Rokhlin (2007) algorithm requires O(n) operations. Newton’s method has been forgotten! T. & Hale (2012) Do not want to solve two eigenvalue problems! . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Newton’s method Newton’s method in θ-space, x = cos(θ). Newton’s method in θ−space We will need: .1. Fast and accurate evaluation of Legendre polynomial → asymptotic formulae. .. Fast evaluation of derivative → recurrence relations. 2 . . ... 3 Good initial guesses → asymptotic approximations. . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . What does a Legendre polynomial look like? Boundary Region: Bessel−like Interior Region: Trig−like cos(π/6) cos(5π/6) We use two asymptotic expansions: interior and boundary. . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Interior asymptotic formula φn (cos θ) = Cn M−1 ∑ cos(αn,m ) hn,m + Rn,M (θ) m+ 12 (2 sin θ) m=0 ( ) ( ) 1 where αn,m = n + m + 2 θ − m + 12 π2 and { } max |cos θ|−1 , 2 sin θ |Rn,M (θ)| < Cn hn,M . 1 M+ 2 (2 sin θ) Absolute error of interior asymptotic for n=200 0 Convergence of Interior Asy formula 0 10 10 n=10 n=20 n=50 n=100 n=200 n=1000 −20 10 −5 10 Max Absolute error Log error −40 −10 10 10 −60 10 −80 10 −15 10 −100 10 −20 10 −1 −120 −0.8 −0.6 −0.4 −0.2 0 x 0.2 0.4 0.6 0.8 10 1 0 50 100 . Alex Townsend 150 Terms . 200 . 250 300 . . Double ansatz spaces and barycentric rootfinding . . Boundary asymptotic Formula √ φn (cos θ) ∼ θ sin(θ) where ρ = n + 1 2. ( M M−1 ∑ ∑ Bm (θ) Am (θ) J0 (ρθ) + θJ (ρθ) 1 ρ2m ρ2m+1 m=0 ) , m=0 Only the first few terms are known explicitly. ( ) π c θO n−2M− 23 n ≤θ ≤ 2 ( ) error = θ3 O n−2M+ 12 0 ≤ θ ≤ nc . Absolute error of boundary asymptotic for n=200 0 10 −5 Log error 10 −10 10 −15 10 −20 10 −1 −0.8 −0.6 −0.4 −0.2 0 x 0.2 0.4 0.6 0.8 1 . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Initial guesses Sufficiently good: Chebyshev points work! Petras (1998) Initial guesses come from the asymptotic formulae. Analogously, there are interior and boundary initial guesses. Lether & Wenston, (1995). Max error in the initial guesses −4 10 Caused by the 5th node changing from interior to boundary −6 10 −8 Max Error 10 −10 10 −12 10 −14 10 n = 5000 −16 10 −18 10 1 10 2 3 10 4 10 10 n . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Gauss–Legendre nodes and barycentric weights Gauss–Legendre nodes and barycentric weights. Relative error in Barycentric weights for 1000 Error in nodes for degree 1000 GLR Asy GW −14 10 GW GLR Asy −10 10 −12 10 −16 10 −14 10 −18 10 −16 10 200 400 600 800 1000 0 200 400 600 800 1000 This method can also compute the Gauss quadrature rules. . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Timing comparison Timing comparison with GW, GLR and Asy. Comparison of execution time 2 10 GW GLR Asy 1 Execution Time 10 0 10 −1 10 −2 10 0 2000 4000 6000 8000 10000 n This asymptotic algorithm is default for Chebfun’s legpts and jacpts command. . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding . . Conclusions: ... DL literature can be simplified by thinking in continuous mode. ... Almost all the results from the M4 paper holds for degree-graded bases. ... ... 3 Polynomial rootfinding can be done in the Lagrange basis. 4 Newton’s method with asymptotic evaluation can compute the barycentric weights. 1 2 Thank you! . Alex Townsend . . . . Double ansatz spaces and barycentric rootfinding .