POV-Ray : Newsgroups : povray.advanced-users : Gauss-Laguerre quadrature : Gauss-Laguerre quadrature Server Time
27 Jul 2024 12:16:31 EDT (-0400)
  Gauss-Laguerre quadrature  
From: Bald Eagle
Date: 25 Jul 2024 20:30:00
Message: <web.66a2ecec4ab7f2f1f9dae3025979125@news.povray.org>
I somehow got off on a tangent graphing some orthogonal polynomials, and then
went the rest of the way and implemented the Gauss-Laguerre integration method.

Amazingly, it "works", and I get a ballpark answer for all of the equations that
I've found exact answers for the integrations - however I feel like I ought to
be getting far more accurate answers.  Like, to 6 decimal places or more.

https://thoughts-on-coding.com/2019/04/25/numerical-methods-in-cpp-part-2-gauss-legendre-integration/

Using Laguerre polynomial level 5

Integral of (5/(pow(e, pi)-2)) * exp(2*_X) * cos(_X) dx      from: [0.000] to:
[1.571]      = 0.9914612      Actual answer = 1.0000000

Integral of pow(x,2) + 1 dx      from: [0.000] to: [2.000]      = 4.6207326
Actual answer = 4.6666667

Integral of pow(x,2) + pow(x,-2) dx      from: [1.000] to: [2.000]      =
2.8064163      Actual answer = 2.8333333

Integral of 6*pow(x,2) - 5*x + 2 dx      from: [-3.000] to: [1.000]      =
83.1007807      Actual answer = 84.0000000

Integral of sqrt (x) * (x-2) dx      from: [4.000] to: [0.000]      = -2.0968530
     Actual answer = 2.1333333

Integral of (2*pow(x,5) - x + 3) / pow(x,2) dx      from: [1.000] to: [2.000]
  = 8.2261864      Actual answer = 8.3068528

Integral of 4*x - 6*pow(pow(x,2), 1/3) dx      from: [0.000] to: [1.000]      =
-1.5870838      Actual answer = -1.6000000

Integral of 2*sin(x) - 5*cos(x) dx      from: [0.000] to: [1.047]      =
-3.2996419      Actual answer = -3.3301270

Integral of 3/exp(-x) - 1/3*x dx      from: [-20.000] to: [-1.000]      =
2.0601572      Actual answer = 2.1022157

Integral of abs(3x-5) dx      from: [0.000] to: [3.000]      = 6.7223530
Actual answer = 6.8333333

Integral of 4*pow(x,4) - pow(x,2) + 1 dx      from: [-2.000] to: [2.000]      =
41.3601713      Actual answer = 49.8666667


Post a reply to this message


Attachments:
Download 'laguerrepolynomials.png' (103 KB)

Preview of image 'laguerrepolynomials.png'
laguerrepolynomials.png


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.