Short of Proof: How Many Digits are Nonetheless Correct?

Folkmar Bornemann

Warm-Up Quiz

>> exp(pi*sqrt(67)/6) - sqrt(5280) ans = 6.12120487630818e-08

How many digits are correct? No tools allowed . . .

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 1 CAVEAT

At its highest level, is a mixture of science, art and bar-room brawl. —T.W. Körner: The Pleasures of Counting

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 2 THE TITLE-QUESTION IS A WEE BIT OLDFASHIONED, ISN’TIT?

ultimately, numerical analysis is about efficient algorithms/software ...... so, answering the title-question is left to the discretion of the educated user?

prevalent attitudes towards the accuracy of numerical output

level 0: scared! (errors all over the place: roundoff, approximation, . . . ) level 1: far more accurate than ever needed in practice (lots of plots) level 2: as good as it gets in the realm of noisy data (a.k.a. backward stability) level 3: adaptivity steered by accuracy requirement (“user tolerance”)

in short 0: pessimistic; 1: optimistic; 2: blame the data; 3: gimme steering wheel

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 3 Prologue Setting the Stage

The mathematical proposition has been given the stamp of incontestability: “dispute other things; this is immovable.” —L. Wittgenstein: On Certainty

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 4 POINT OF ENTRY I: THE SIAM 100-DIGIT CHALLENGE

prehistory: Problem Solving Squad @ Stanford George Pólya George Forsythe Bob Floyd Don Knuth ! ! ! ! the challenge (Nick Trefethen, SIAM News & Science, January ’02) 10 problems, the answer to each is a real number sought to 10 sig. digits • the rules teams w/ six people maximum • any ideas and advice from friends and literature far and wide admissible • three months • the award $100 for the team w/ most accurate answers •

They’re hard! If anyone gets 50 digits in total, I will be impressed. — Nick Trefethen

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 5 THE OUTCOME

contestants: 94 teams from 25 countries, 20 teams w/ perfect score among the winners (A, D, CH, GB, NL, AUS, CAN, USA, ZA) D. Lichtblau/M. Trott (team Mathematica); R. Israel/ G. Gonnet (of Maple fame) • the book

Folkmar Bornemann (D) Dirk Laurie (ZA) Stan Wagon (USA) Jörg Waldvogel (CH)

interviews • a wealth of different methods • 9 problems to 10,000 digits • 6 problems w/ proven digits SIAM 2004 Springer 2006 •

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 6 HOW DO YOU KNOW YOUR DIGITS ARE CORRECT?

letter to the editor of SIAM News by Joe Keller (Dec. ’02)

I found it surprising that no proof of the correctness of the answers was given. Omitting such proofs is the accepted procedure in scientific computing. However, in a contest for calculating precise digits, one might have hoped for more.

answers ranged from psychological, to sociological, to pragmatic

proofs of correctness of digits are rote & dull (would have killed fun/contest) • different algorithms/programs/computers/countries, still same result • tools of the trade provide “incontestability” which is short of proof •

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 7 POINT OF ENTRY II: DISTRIBUTIONS IN RANDOM THEORY

experimental evidence for universal fluctuations Takeuchi/Sano/Sasamoto/Spohn ’11 (Nature) 15 6

(b) (a) (b) 1.2 (a) 1000 0.8 int 500 g int int 2/3 2 0 g – C (t) ) 2 s ζ t B./Ferrari/Prähofer ‘08 1 10 0 slope -1/3 Γ ) d -500 0.6 ζ '( ) / ( ) / 0.8 s -1000 l (

Circular, Airy C t (s) -1000 -500 0 500 1000 s -1 2 (µm) 10 C ∞ 0 0 1 2

(d) 0.4 ∫ (c) 0.6 10 10 10 ≡

2000 ≡ [email protected] ) int ζ

1500 s ( ' C s 0.2 1000 Flat, 0.4 C 500 Airy 1 int 0 g 0 1000 2000 3000 1 (µm) 0 0.2 0 1 2 3 0 20 40 60 Fig. 3 Growing DSM2 cluster with a circular (a,b) and flat (c,d) interface. (a,c) Raw images. Indicated below each image is the elapsed time after the emission of laser pulses. (b,d) Snapshots of the interfaces at t = 3,8,...,28 s for the circular case (b) and -2/3 t = 10,20,...,60 s forgrowth the flat case (d).in The gray turbulent dashed lines indicate liquid the mean radius crystal (height) of all the circular (flat) interfaces t (s) recorded at t = 28 s (t = 60 s). See also Supplementary Movies of Ref. [96]. ζ ≡ (Al/2)(Γt) 1/3 h(t, x) lt + Gt c Fig. 10 Spatial correlationtwo-point function C covariance(l;t). (a) Rescaled of c correlation function C (z;t) C (l;t)/(G t)2/3 against rescaled length recent study showed that overhangs are irrelevant' for the scaling of the interfaces [79], here, for the sake of s s0 s simplicity and direct comparison to theoretical predictions, we take the mean of all the detected heights at a 2/3 ⌘ given coordinate x to define a single-valued function h(x,t) for each interface. The spatial profilez h(xAl,t) is/ sta-2)(G t) . The symbols indicate the experimental data for the circular and flat interfaces (top and bottom pairs of tistically equivalent at any point x because of the isotropic and homogeneous growth of thesymbols, interfaces,⌘ which, respectively), obtained at t = 10 s and 30 s for the former and t = 20 s and 60 s for the latter (from bottom to top). together with the large numbers of the realizations, provides accurate statistics for the interface fluctuations analyzedKPZ below. equation & universality The dashed and dashed-dotted lines indicate the correlation function for the Airy2 and Airy1 processes, respectively, estimated Before presenting the results of the analysis, it is worth noting different characters of the “system size” int • L, or the total lateral length, of the circular and flat interfaces in general. While the systemnumerically size of the flat by Bornemann et al. [9, 10]. (b) Integral of the rescaled correlation function Cs (t) 0 Cs0(z;t)dz for the circular interfaces is chosen a priori and fixed2 during the evolution, that of the circular interfaces is(blue the circumference circles) and flat (red diamonds) interfaces. The dashed and dashed-dotted lines indicate the⌘ values for the Airy and Airy whichh grows= linearlyh with+ timeh and is therefore• not+ independentspace-time of dynamics. This white matters most noise when one Kardar/Parisi/Zhang ’86 (4990 citations) 2 1 t xx x int • int int R takes an average of a stochastic variable, e.g., the interface height. For the flat interfaces,processes, the spatial and respectively, gi 0 gi(z)dz. The inset shows the difference g Cs (t) for the circular interfaces, with a guide ensemble averages are equivalent provided that the system size L is much larger than the correlation length ⌘ 2 l t1/z. In contrast, for the circular interfaces, the two averages make a significant difference,for the because eyes the indicatingrigorous the slope solution1/3. concept: M. Hairer ’13 system⇤ ⇠ size is inevitably finite and the influence of finite-size effects varies in time. To avoid this complication, R we take below the ensemble average denoted by unless otherwise stipulated, which turns out to be the right choice when one measures characteristic quantitiesh···i such as the growth exponent b. ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 8 3 Experimental results the KPZ-class interfaces. We note that this actually implies qualitative difference between the circular and flat 3.1 Scaling exponents 2 cases; it is theoretically known that the Airy2 correlation for the circular interfaces decreases as g2(z) z First we test the Family-Vicsek scaling (2) and (4) and measure the roughness exponent a and the growth ⇠ exponent b. Figure 4 shows the interface width w(l,t) and the square root of the height-differencefor large correlationz, while the Airy1 correlation g1(z) for the flat interfaces decays faster than exponentially [10]. 1/2 function Ch(l,t) measured at different times t, for both circular and flat interfaces [Fig. 4(a,b) and (c,d), respectively]. They grow algebraically for short lengths l l and converge to time-dependent constants for ⇤ ⌧ a 1/2 a large l, in agreement with the Family-Vicsek scaling (2) and (4). Fitting w l and Ch l in the power- law regime of the data at the latest time in Fig. 4, we estimate a = 0.48(5)⇠and 0.43(6) for⇠ the circular and 3.6 Temporal correlation function

In contrast to the spatial correlation, correlation in time axis is a statistical property that has not been solved yet by analytical means. It is characterized by the temporal correlation function C (t,t ) h(x,t)h(x,t ) h(x,t) h(x,t ) . (18) t 0 ⌘h 0 ih ih 0 i The temporal correlation should be measured along the directions in which fluctuations propagate in space- time, called the characteristic lines [20, 25]. In our experiment, these are simply perpendicular to the mean spatial profile of the interfaces, namely the upward and radial directions for the flat and circular interfaces, respecitvely, which are represented in both cases by the fixed x in Eq. (18). Figure 11 displays the experimental results for Ct(t,t0), obtained with different t0 for the flat (a) and circular (b) interfaces. Here, again, we find different functional forms for the two cases; with increasing t, the temporal correlation function Ct(t,t0) decays toward zero for the flat interfaces [Fig. 11(a)], while that for the circular ones seems to remain strictly positive indefinitely [Fig. 11(b)]. Recalling that the interface 1/3 fluctuations grow as (G t) , one may argue that a natural scaling form for Ct(t,t0) would be

C (t,t ) (G 2t t)1/3F (t/t ), (19) t 0 ' 0 t 0 with a scaling function Ft. This indeed works for the flat interfaces, showing a long-time behavior Ft(t/t0) l¯ ¯ ⇠ (t/t0) with l = 1 [inset of Fig. 11(a)] in agreement with past numerical studies [38, 47]. For the circular interfaces, in contrast, the natural scaling (19) does not seem to hold as well within our time window, as the ¯ data with different t0 do not overlap on a single curve [inset of Fig. 11(b)]. The autocorrelation exponent l would be formally 1/3 in this case, but this only reflects the observation that the unscaled Ct(t,t0) converges to a non-zero value at t •. These results support Kallabis and Krug’s conjecture [47] that the following scaling relations for the linear! growth equations [47, 88] also hold for nonlinear growth processes, especially in the KPZ class: b + d/z (flat), l¯ = (20) (b (circular), COVARIANCE OF AIRY2 PROCESS

• • 2 ∂ F(t, x, y) 2 cov( 2(t), 2(0)) = dxdy E(F2) A A • • ∂x∂y Z Z

w/ F2 Tracy–Widom distribution and F(t, x, y) given:

Prähofer/Spohn ’02 Adler/van Moerbeke ’05

F(t, x, y)=eG(t,x,y) w/ boundary conditions at •, s.t.

K0 Kt ∂ ∂2 ∂2 F(t, x, y)=det I L2(x,•) L2(y,•) t G 0 0 1| 1 2 2 K t K0 ∂t ∂x ∂y ✓ ◆ @ @ A A ∂3 G ∂2 G ∂2 G ∂2 G = 2 + + x y t2 w/ kernel ∂x2∂y ∂y2 ∂x∂y ∂x2 ✓ ◆ • 3 2 2 2 xt ∂ G ∂ G ∂ G ∂ G e Ai(u + x) Ai(v + x) dx t > 0 2 + x + y t2 0 ∂y2∂x ∂x2 ∂x∂y ∂y2 8 Z ✓ ◆ Kt (u, v)= > 0 ∂3 G ∂ ∂3 G ∂ ∂ ∂ > xt < e Ai(u + x) Ai(v + x) dx t < 0 + 3 3 + G • ∂x ∂y ∂y ∂x ∂x ∂y Z ✓ ◆✓ ◆ > :> numerical method for operator determinants (B. ’10): Matlab toolbox RMTFredholmV1.4

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 9 THE COVARIANCE TABLES

Dez 16, ’09. K.A. Takeuchi @ University of Tokyo tAiry2-cov ======I’m writing to you to ask for 0.0 0.81319 47928 32_ atableofthevaluesofthe 0.1 0.72238 6316_ ___ covariance of the Airy1 and Airy2 0.2 0.64599 22576 82_ processes. 0.3 0.58059 79929 11_ 0.4 0.52404 24147 80_ . . 0.5 0.47476 29136 97_ Nov 13, ’13. T. Halpin-Healy @ Columbia University 0.6 0.43156 58701 6__ 0.7 0.39350 99273 38_ You have become the mecca to which 0.8 0.35983 66565 2__ all pilgrims journey for Airy 1&2 0.9 0.32992 54726 56_ covariance. I apologize, but... 1.0 0.30326 25145 3__ Could I trouble you for the same? ......

goal: 10 digits accuracy (using IEEE 754 hardware arithmetic) • 1000 entries until matching asymptotic expansion for t • • ! 36 hours CPU time (90% spent at error control) •

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 10 ASHORT HISTORY OF MATHEMATICAL TABLES

table when what # digits Napier 1614 ln 7 Kepler 1627 ln 5 Briggs 1624 lg 14 Vlacq 1628 lg 10 Vega 1794 lg 10

Napier’s ln 2 = 0.69314 69 errs by 3 ulps • Vega’s log tan errs upto 3 ulps • Vega offered a ducat ($100) for each error Gauss (1851) projected at least 5670 errors in log tan: For the cost of so many ducats one could well have commissioned able people with a full recalculation.

Math. Comp. used to publish about 100 “Table Errata” (’43–’84) frontispiece Kepler’s Tabulae Rudolphinae

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 11 ALOOK AT OLD TEXTBOOKS

example in C. Runge, H. König (1924)

wealth of numerical examples • estimating correct digits • accuracy matched to precision • true solution to gain confidence This way we get • 1 dx Swiss Army Knife: differences = 0.7853 9816 8 + 2 Z0 1 x as compared to

p = 0.7853 9816 34. 4

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 12 ALOOK AT MODERN TEXTBOOKS

example in textbook ? (201?)

Taking n = 48 we get 1 dt 0.616117002990640 1 (1 + 25t2)p1 t2 ⇡ Z while the true value is 0.616117009400542. The error is 9 about 6 10 , which is pretty good for 48 points. ⇥ a wealth of code and figures • example in textbook ? (201?) numbers shown to full precision • f=@(x)1.0/(1+x.^64); true solution: “deus ex machina” q=quad(f,0,1,1.0e-6,1) •

0.989366564796066 In comparison to Maple we see that the answer is accurate to about six figures. We are not commenting on how, exactly, Matlab’s quad is estimating its accuracy. Of course, details matter, but for now we merely note that it is so doing.

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 13 SOLUTION OF THE QUIZ

>> exp(pi*sqrt(67)/6) - sqrt(5280) ans = 6.12120487630818e-08

How many digits are correct? No tools allowed . . .

order of magnitude 10 < p5280 < 100 the calculation takes the form

??. ??? ????? ??????

??. ??? ????? ?????? ======

00.000 00006 1212048763 0818 noise | {z }

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 14 ERROR MODEL

numerical computation yields

numerical error = approximation error + noise

= (local errors)+(roundoff) P Q w/ propagators , P Q

aim: quantitative diagnostic tools on top of software running in hardware arithmetic • just using a couple (3–8) re-runs • order of magnitude of error • no analysis of propagators needed •

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 15 Act I: The Three-t-Tool

approximation error O(tk) noise

adaptive methods • discretizations with algebraic convergences rates • iterations with linear convergence •

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 16 EXAMPLE 1: HASTINGS–MCLEOD SOLUTION OF PAINLEVÉ II

solve the IVP

3 u00(x)=xu(x)+2u(x) , u(x)=Ai(x)(x •) !

Matlab’s state-of-the-art solver ode45 (L. Shampine et al.): t = RelTol

RelTol - Relative error tolerance [ positive scalar {1e-3} ] This scalar applies to all components of the solution vector, and defaults to 1e-3 (0.1% accuracy) in all solvers. The estimated error in each integration step satisfies e(i) <= max(RelTol*abs(y(i)),AbsTol(i)).

caveat: the steering wheel t controls the local error

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 17 DEUS-EX-MACHINA ASSESSMENT

true error v. RelTol @ x = -6 0 understanding the propagator 10 P perturbation u(x)=q Ai(x)(x •) -1 10 1 digit ! u!x"

-2 10 2 digits 4

relative error 2 -3 10 3 digits x !14 !12 !10 !8 !6 !4 !2 2 4

10-4 !2 -12 -10 -8 -6 -4 10 10 10 10 10 u(x) mit q = 1 10 8, 1, 1 + 10 8 [RelTol]

Theorem (A. Stuart ’97) w/ high probability:

ode45 yields approximation error of the size O(t)

in the example, the hidden constant is 108 ... ⇡

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 18 THE THREE-t-TOOL

“steering wheel” t-model

X (t) X + ctk num ⇡ true

use three different t 1 t+ := ht > t > h t =: t 1 1 with h = exp(k arsinh 2 ), there holds the error estimate

Xnum(t) Xtrue Xnum(t+) Xnum(t ) 1 | | | | ⇡ approximation error . easily computable | {z } | {z }

experience: surprisingly robust tool

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 19 RUNGE–KÖNIG-STYLE ASSESSMENT

three- -tool estimate @ x = -6 100

-1 10 1 digit

-2 blue: true error 10 2 digits red: estimated error relative error -3 10 3 digits

10-4 10-12 10-10 10-8 10-6 10-4 [RelTol] Three-t-Tool yields

u( 6)=1.7316 77463 03812

compare u( 6)=1.7310 24958 83178

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 20 EXAMPLE 2: PROBLEM 10 OF THE SIAM 100-DIGIT CHALLENGE

A particle at the center of a 10 x 1 rectangle undergoes Brownian motion till it hits the boundary. What is the probability p that it hits at one of the ends rather than at one of the sides?

16 Chapter 10. Hitting the Ends conformal invariance: p = f/p

z w = w = f(z) = B A

B0 A0 z w < <

C0 D0

C D

Schwarz-Christoffel Toolbox for Matlab (T. Driscoll ’96): t = Tolerance Figure 10.4. Symmetry preserving conformal mapping f : D R ! ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 21 imaginary axis are the axes of symmetry. The vertices of the rectangle are then given by (A, B, C, D) = (a + ib, a + ib, a ib, a ib). By the Riemann mapping theorem [Hen74, Cor. 5.10c] and the reflection principle of Riemann and Schwarz [Hen74, Thm. 5.11b], there is a conformal one-one map f : D R that respects the symmetries, cf. Fig 10.4, ! f( z) = f(z), f(z) = f(z). (10.12) In particular we have f(0) = 0: the center of the rectangle is the image of the center of the disk. By the Osgood-Carath´eodory theorem [Hen86, Thm. 16.3a] the conformal mapping f extends as a homeomorphism of the closure of D onto the closure of R. The preimages of (A, B, C, D) are therefore

i/2 i/2 i/2 i/2 (A0, B0, C0, D0) = e , e , e , e ⇣ ⌘ for some angle 0 < < ⇡. By taking 1 as the union of the arc from B0 to C0 and the arc from D0 to A0, Lemma 10.2 and the invariance of the value p of the harmonic measure at the center show that

= p ⇡.

The conformal transformation f is explicitly given by the Schwarz-Christo↵el for- mula [Hen86, Eq. (16.10-1)],

z d⇣ f(z) = 2c 0 (1 e ip⇡/2⇣)(1 + eip⇡/2⇣)(1 + e ip⇡/2⇣)(1 eip⇡/2⇣) Z z d⇣ p = 2c . ip⇡ 2 ip⇡ 2 0 (1 e ⇣ )(1 e ⇣ ) Z p ASSESSMENT

three- -tool estimate 10-4

10-6 6 digits pol = polygon([10+1i -10+1i -10-1i 10-1i]); f=center(crdiskmap(pol,... 10-8 8 digits scmapopt(’Tolerance’,tau)),0);

relative error prevert = get(diskmap(f),’prevertex’); 10-10 10 digits p=angle(prevert(1))/pi;

10-12 10-12 10-10 10-8 10-6 10-4 [Tolerance] Three-t-Tool yields 7 p = 3.8375 87979 10069 10 ·

compare B. (March 11, ’03) Ramanujan-style expression for singular modulus k100 2 p = arcsin (3 2p2)2 (2 + p5)2 (p10 3)2 (51/4 p2 )4 p ⇣ ⌘ = 3.8375 87979 25123 10 7 · ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 22 Act II: Chebyshev-Noise-Estimator

k/t approximation error O(e ) noise ⌧

math libraries • spectral methods • iterations with quadratic convergence •

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 23 ABAYESIAN APPROACH

the prior

f (x)= f (x)+noise, noise = e num k k• the idea

“uncorrelated” computation for different values of parameter x • inverse problem noise model & robust statistics estimate of e • the tool 1. transform (FFT) value space to coefficient space

m 1 fnum(x)= Â akTk(x)(Tk Chebyshev polynomials) k=0

2. study decay of ak

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 24 EXAMPLE 3: MATLAB’S AIRY FUNCTION

Airy function on [ 50, 5] (sampled on m = 400 and m = 40000 points) values space coefficient space 0.6 100 low frequency modes 0.4 10-5 0.2

-10 high frequency : 0 10

Ai(x) modes noisy tail -0.2 magnitude ✓ 10-15 -0.4

-0.6 10-20 -50 -40 -30 -20 -10 0 0 100 200 300 400 x degree

9.5 10 15 n = 400 m · eest = max ak = 2 · k: noisy tail | | 8 r 1.3 10 14 n = 40000 < · compare: e = 1.5 10 14 : ·

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 25 NOISE MODEL

random field w/ values uniformly distributed in [0, 1] sampled on m = 200 points sampled on m = 20 000 points 100 100

10-1 10-2

10-2 10-4 10-3 magnitude magnitude

10-6 10-4

-8 10-5 10 0 50 100 150 200 0 0.5 1 1.5 2 4 degree degree/10000Ambreen 10

robust statistics of Chebyshev coefficients

2 max ak k=1:m | |⇡r m

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 26 VIRTUAL DE-CORRELATON:PARAMETER-EMBEDDING

problem: F(X)=0 Xnum = X + noise

w/ (a) no natural parameter or (b) correlated computation for varying parameter

virtual parameter: solve

(1 + h)F(X)=0 (h [0, 1]) 2 h X constant just a few samples suffice 7!

experience: very effective, uncorrelated, sample-size m = 8 often sufficient

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 27 EXAMPLE 4: BADLY-CONDITIONED LINEAR SYSTEM

standard test problem

1 1 Hnx = w/ Hilbert matrix Hn = i+j 1 for n = 10 i,j=1:n ⇣ ⌘ GEPP w/ Chebyshev-Noise-Estimator compare: true solution

9.9973 90445 93986 10 0 . 1 0 . 1 . . B C B C x = B 12610 51.604 89065C x = B 1261260C B C B C B C B C B . C B . C B . C B . C B C B C B C B C B 92367 5.1276 83663 C B 923780 C B C B C @ A @ A

no need to know about / calculate / estimate the condition (size of propagator)

cond (H )=3.5 1013 • 10 · which would have rendered just about 1 or 2 digits as correct

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 28 EXAMPLE 5: CHEBFUN/APPROXFUN

The aim is to “feel symbolic but run at the speed of numerics”. More precisely our vision is to achieve for functions what floating-point arithmetic achieves for numbers: rapid computation in which each successive operation is carried out exactly apart from a rounding error that is very small in relative terms.

— L.N. Trefethen: Computing Numerically with Functions Instead of Numbers

boundary-layer problem

eu00(x) xu0(x)+u(x)=0, u( 1)=1, u(1)=2 Chebfun/Matlab (Battles/Trefethen ’04, Driscoll/B./Trefethen ’08, . . . )

u=chebop(@(x,u)ep*diff(u,2)-x.*diff(u)+u,[-11],1,2)\0;

ApproxFun/Julia (Olver ’14, . . . )

x, D = Fun(-1..1), Derivative() u=[ep*D^2-x*D+I;Dirichlet()]\[0,[1,2]]

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 29 EXAMPLE 5: DETECTING AHIDDEN NUMERICAL INSTABILITY

Chebfun/ApproxFun (e = 0.012125) zoom into boundary layer 2 0.65

1.5 0.6

1 0.55 u(x) u(x) 0.5 0.5

0 0.45

-0.5 0.4 -1 -0.5 0 0.5 1 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 x x

ultraspherical spectral method in coefficient space (Olver/Townsend ’13)

Chebfun (Matlab): u(0.9)=0.44306 18584 53104 • ApproxFun (Julia): u(0.9)=0.45073 96061 62504 •

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 30 ASSESSMENT

Chebyshev-Noise-Estimator in action

Chebfun ApproxFun 100 100

10-5 10-5 5 digits 5 digits relative error 10-10 relative error 10-10 10 digits 10 digits

10-15 10-15 0.012 0.013 0.014 0.015 0.016 0.017 0.018 0.019 0.012 0.013 0.014 0.015 0.016 0.017 0.018 0.019 e e

Chebfun (Matlab): u(0.9)=0.44306 18584 53104 • ApproxFun (Julia): u(0.9)=0.45073 96061 62504 •

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 31 THE CURE

debugging . . . : the linear solver is to blame . . . Chebfun 100

Matlab’s default 10-5 5 digits automatic AMD ordering in SuiteSparseQR

destroys ultraspherical band structure

relative error 10-10 10 digits switch off: spparms(’autoamd’,0)

10-15 0.012 0.013 0.014 0.015 0.016 0.017 0.018 0.019 e

Chebfun (Matlab): u(0.9)=0.45073 96061 62502 • ApproxFun (Julia): u(0.9)=0.45073 96061 62504 •

compare: u(0.9)=0.45073 96061 62501 (based on symbolic solution involving erfi(z))

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 32 COMPARE WITH KAHAN’S “MINDLESS”METHOD #2

2. Repeat the computation in arithmetic of the same precision but rounded differently and compare three or four results. Though far from foolproof, it is very likely to confirm accidentally exposed hypersensitivity to roundoff. When feasible, this scheme offers the best Benefit/Cost ratio.

—W. Kahan: How Futile are Mindless Assessments of Roundoff?

rounding-mode Chebfun/Matlab ApproxFun/Julia to nearest 0.45073 96061 62502 0.45073 96061 62504 down 0.87311 66316 79749 0.45073 96061 62498 up 0.35446 81929 67560 0.45073 96061 62502 towards zero 0.52549 52713 21002 0.45073 96061 62502

conclusion inconclusive? 0.45073 96061 62504

while still “mindless”, the Chebyshev-Noise-Estimator is more robust and more accurate . . .

ICMS 2018, NOTRE DAME,JULY 26 FOLKMAR BORNEMANN 33