----- Message d'origine -----<br>
De : Ginters Bušs<br>
Date : 20/05/2011 13:09:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear all,<br>
<br>
Let's integrate:<br>
<br>
function y=f(x, a, sigma),y=(1/sqrt(2*%pi))*log(abs(a+sigma*x))*exp(-(x^2)/2),endfunction<br>
<br>
out=intg(-1e+2,1e+2,list(f,1,.1))<br>
<br>
out=8.605D-49<br>
<br>
but Wolfram Alpha gives out= -0.111<br>
<br>
which is a totally different answer.<br>
<br>
I've noticed that intg and integrate incline to give values close to 
zero when boundaries tend to infinity. So, I trust Wolfram Alpha more. 
How to get around the apparent mistakes in intg, integrate 
(particularly, I'm interested in indefinite integrals)?<br>
<br>
Gin.<br>
<br>
<br>
</blockquote>
<br><br><div class="gmail_quote">On Sat, May 21, 2011 at 1:20 PM, Samuel GOUGEON <span dir="ltr"><<a href="mailto:Samuel.Gougeon@univ-lemans.fr">Samuel.Gougeon@univ-lemans.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
 Hello,<br>
The following thread on Bugzilla may also feed the present discussion:<br>
<a href="http://bugzilla.scilab.org/show_bug.cgi?id=5728" target="_blank">http://bugzilla.scilab.org/show_bug.cgi?id=5728</a><br>
Regards<br>
Samuel<br>
<br><div><div class="h5">
<br>
</div></div></blockquote></div>Thanks. I like your insistance in that discussion, Sam. <br><br>Although a "known-limitation-of-current-algorithm" might be a correct description of the current algorithm, it nevertheless does not help much when one wants the algorithm to give the correct solution and observes that a guy like Wolfram has apparently has done something about this issue: for y given function, Scilab's intg/integrate gives ok value for bounds (-50,50), but screws up for (-100,100) and larger bounds, which I consider still pretty narrow. On the contrary, Wolfram Alpha <br>
<br><a href="http://www.wolframalpha.com/input/?i=integration&a=*C.integration-_*Calculator.dflt-&f2=%281%2Fsqrt%282*pi%29%29*log%28abs%281%2B.1*x%29%29*exp%28-%28x">http://www.wolframalpha.com/input/?i=integration&a=*C.integration-_*Calculator.dflt-&f2=%281%2Fsqrt%282*pi%29%29*log%28abs%281%2B.1*x%29%29*exp%28-%28x</a>^2%29%2F2%29&x=0&y=0&f=Integral.integrand_%281%2Fsqrt%282*pi%29%29*log%28abs%281%2B.1*x%29%29*exp%28-%28x^2%29%2F2%29&f3=-infinity&f=Integral.rangestart_-infinity&f4=%2Binfinity&f=Integral.rangeend_%2Binfinity&a=*FVarOpt.1-_**-.***Integral.variable---.**Integral.rangestart-.*Integral.rangeend---<br>
<br>gives ok values for bounds (-50,50), (-100,100), (-1000,1000) and it allows to directly use infinite bounds and get ok result (interim bounds like (-1e9,1e9) are not ok). I consider this a superior solution. If Wolfram can, why shouldn't Scilab try? The status quo might hurt Scilab's reputation in the domain in long run.<br>
<br>Gin.<br>