modelUnfairComparison
Comparison of GSL and Modelica integration routines
Extends from Modelica.Icons.Example (Icon for runnable examples).
Information
Example integral:
I(a) = ∫a1 x-1/2 ln(x) dx
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.
gcc -fPIC -c integrand.c integration_mi.c
gcc -shared integration.o integration_mi.o -o libgsl_integration_MI.so [.dll for windows])

Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n_par | 1 | |
| Real | b | 1 | |
| Real | rel_err | 1.e-7 | |
| Real[n_par] | par | {1.0} | |
| Integer | limit | 1000 |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Real | a | ||
| Real | z | ||
| Modelica.Blocks.Sources.Ramp | a_ramp | ||
| Modelica.Blocks.Sources.RealExpression | res_from_Mod | ||
| Modelica.Blocks.Math.Division | iiratio | ||
| Blocks.integration.QAGS_quadrature | qAGS_quad | ||
| Modelica.Blocks.Sources.Constant[n_par] | p_const | ||
| Modelica.Blocks.Sources.Constant | b_const | ||
| Blocks.integration.QAGS_quadrature | qAGS_quad0 | ||
| Modelica.Blocks.Sources.Constant | const0 |
Contents
| Name | Description |
|---|---|