(SR-52) In defense of linear quadrature rules
12-22-2019, 06:23 PM (This post was last modified: 01-16-2020 02:13 PM by Albert Chan.)
Post: #2
 Albert Chan Senior Member Posts: 2,066 Joined: Jul 2018
RE: (SR-52) In defense of linear quadrature rules
Thank you, SlideRule.
I tried this modified point / weight quadrature on $$\int _0^6 e^{x^3}\; dx ≈ 5.963938092 × 10^{91}$$

gp/gw from Gaussian Quadrature Weights and Abscissae (n=10, rounded to 10 digits)
mp/mw is modified points/weights from In Defense of Linear Quadrature Rules, table 1

lua> gp = {0.1488743390, 0.4333953941, 0.6794095683, 0.8650633667, 0.9739065285}
lua> gw = {0.2955242247, 0.2692667193, 0.2190863625, 0.1494513492, 0.06667134431}
lua> mp = {0.2295037173, 0.6364758401, 0.9015072053, 0.9928383122, 0.9999843443}
lua> mw = {0.4501100825, 0.3483026852, 0.1744679776, 0.02696299772, 0.0001562579734}

lua> function integ(f,a,b,p,w) -- 10 points quadrature
: ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ local t, m, c = 0, (b-a)/2, (b+a)/2
: ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ for i=1,5 do t = t + (f(-m*p[i]+c) + f(m*p[i]+c)) * w[i] end
: ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ return m * t
: ﻿ ﻿ ﻿ ﻿ end

lua> function f(x) return math.exp(x^3) end
lua> integ(f, 0, 6, gp, gw) ﻿ ﻿ ﻿ ﻿ → 3.052910317e+089
lua> integ(f, 0, 6, mp, mw) ﻿ ﻿ ﻿→ 5.444304730e+091

Modified point/wieght looks much closer.
However, if we integrate only the dominant part, plain guassian points is better.

lua> integ(f, 5.50, 6, gp, gw) ﻿ ﻿ ﻿ ﻿ → 5.942395811e+091
lua> integ(f, 5.50, 6, mp, mw) ﻿ ﻿ ﻿→ 5.577982336e+091

lua> integ(f, 5.75, 6, gp, gw) ﻿ ﻿ ﻿ ﻿ → 5.963893713e+091
lua> integ(f, 5.75, 6, mp, mw) ﻿ ﻿ ﻿→ 5.907966288e+091
 « Next Oldest | Next Newest »

 Messages In This Thread (SR-52) In defense of linear quadrature rules - SlideRule - 12-22-2019, 02:14 PM RE: (SR-52) In defense of linear quadrature rules - Albert Chan - 12-22-2019 06:23 PM

User(s) browsing this thread: 1 Guest(s)