[scilab-Users] Convergence problem
Michaël Baudin
michael.baudin at scilab.org
Mon Nov 8 10:13:57 CET 2010
Hi,
I guess that you are expecting too much from the solver. The exact
mathematical result of the integral is 0. Now, the mathematical sin
function is approximated by a floating point implementation, which is so
that :
-->sin(2*%pi)
ans =
- 2.449D-16
See the script :
for atol = [1.e-1 1.e-2 1.e-4 1.e-8 1.e-10 1.e-12 1.e-14]
instr = "I = integrate(""sin(x)"",""x"",0,2*%pi,atol);";
ierr = execstr(instr,"errcatch");
if ( ierr == 0 ) then
mprintf("atol=%e, I=%.17e\n",atol,I)
else
mprintf("atol=%e, I=XXX\n",atol)
end
end
This produces :
atol=1.000000e-001, I=2.26062574420357380e-016
atol=1.000000e-002, I=2.26062574420357380e-016
atol=1.000000e-004, I=2.26062574420357380e-016
atol=1.000000e-008, I=2.26062574420357380e-016
atol=1.000000e-010, I=2.26062574420357380e-016
atol=1.000000e-012, I=2.26062574420357380e-016
atol=1.000000e-014, I=XXX
Hence, it suffices to reduce the request for the absolute error to get
an answer.
Best regards,
Michaël Baudin
PS-1
I admit that there might not be enough informations provided by Scilab
in the gateway.
The various output of the solvers are described in the ier variable of :
http://www.netlib.org/quadpack/dqags.f
There are 6 different causes of failures, all of them being represented
by the single "Convergence problem".
PS-2
A similar problem was discussed at :
http://bugzilla.scilab.org/show_bug.cgi?id=5728
PS-3
There are issues with the integrate function, with the management of
default input arguments:
http://bugzilla.scilab.org/show_bug.cgi?id=8351
Le 18/10/2010 16:25, José Luis Volta Grau a écrit :
> Hi Jean:
> Change the tolerance and you will get the result of
> integrate('sin(x)','x',0,2*%pi,1e-5)
> -->integrate('sin(x)','x',0,2*%pi,1e-5)
> ans =
>
> 2.222D-16
> which is almost zero.
> J.L.
>
> ----- Original Message -----
> *From:* jean podlecki <mailto:jean.podlecki at sfr.fr>
> *To:* users at lists.scilab.org <mailto:users at lists.scilab.org>
> *Sent:* Monday, October 18, 2010 9:22 AM
> *Subject:* [scilab-Users] Convergence problem
>
> God afternoon,
>
> Here's my problem.
>
> -------------------------------------------------
>
> -->integrate('sin(x)','x',0,2*%pi)
> !--error 24
> Problème de convergence ...
>
> at line 70 of function integrate called by :
> integrate('sin(x)','x',0,2*%pi)
>
> -------------------------------------------------
>
> Is it right ? How can I get the correct answer ?
>
> Jean.
>
--
Michaël Baudin
Ingénieur de développement
michael.baudin at scilab.org
-------------------------
Consortium Scilab - Digiteo
Domaine de Voluceau - Rocquencourt
B.P. 105 - 78153 Le Chesnay Cedex
Tel. : 01 39 63 56 87 - Fax : 01 39 63 55 94
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20101108/693a3592/attachment.htm>
More information about the users
mailing list