.GNU_ScientificLibrary.Examples.integration.UnfairComparison.UnfairComparison

Information

Example integral: 

       /1 
I(a) = | x-1/2 ln(x) dx 
       /a 

using the GSL QAGS routine and Modelica.Math.Nonlinear.quadratureLobatto(). Several values of a from 0.1 to 10-6 are explored and the integral is reevaluated for each one. The ratio of the results from the two methods is also calculated for comparison. As the integrand contains a singularity at x=0, the integration is stopped at a=10-6. Only the QAGS result is evaluated for the full range (qAGS_quad0.y = I(0) = -4). The Lobatto routine will hang or crash for values of a < 10-6.

IMPORTANT!!!: The integrand-setup model 'CreateIntegrand2' (or a duplicate) must be run before using GSL integration routines within a larger Modelica model (like this one). (Alternatively, one could edit integrand.c directly and then compile "by hand" in a command window:
gcc -fPIC -c integrand.c integration_mi.c
gcc -shared integration.o integration_mi.o -o libgsl_integration_MI.so  [.dll for windows])


Contents

NameDescription
 func

Generated at 2025-01-08T19:40:16Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos