Open rtoy opened 2 months ago
Imported from SourceForge on 2024-07-06 10:01:32 Created by macrakis on 2022-01-27 16:27:30 Original: https://sourceforge.net/p/maxima/bugs/3928/#97b1
integrate
performs symbolic, not numeric, integration. Wrapping it in float(...)
simply converts the symbolic value to a floating value after first calculating it symbolically. In some cases, floating point exponents can cause problems because they get converted to very messy rationals.
That said, I cannot reproduce your problem in Maxima 5.45.1.
In any case, it is unnecessary to substitute mu and sigma before evaluating the integral. Maxima is perfectly happy to integrate symbolically:
integrate( 1/(sqrt(2*%pi)*sigma*x)*exp(-(log(x)-mu)^2/(2*sigma^2)), x, 0, 10)
(Is sigma positive or negative? pos)
((sqrt(%pi)*sigma)/sqrt(2)-(sqrt(%pi)*erf((sqrt(2)*mu-sqrt(2)*log(10))/(2*sigma))*sigma)/sqrt(2))/(sqrt(2)*sqrt(%pi)*sigma)
You can then substitute numerical values into that.
Imported from SourceForge on 2024-07-06 10:01:35 Created by macrakis on 2022-01-27 16:28:27 Original: https://sourceforge.net/p/maxima/bugs/3928/#3d65
Imported from SourceForge on 2024-07-06 10:01:31 Created by pavel1murat on 2022-01-27 15:56:13 Original: https://sourceforge.net/p/maxima/bugs/3928
I'd like to report a numerical instability in the maxima integration of the lognormal function. In the example below, small variations of the parameter sigma change the outcome of the integration from fast convergence to failure due to exhausted memory - the diagnostics and the build information
follow below. The nature of failure suggests that the issue may be more general than just the lognormal function and affect other cases. Just to comment, I'm getting maxima as a part of Fedora distribution, so the version I'm using is not the latest one.
-- thanks for the great program, Pavel
1) here is the output of the failed integration:
2) and her is the build info: