<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi,<br>
    <br>
    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 :<br>
    <br>
    -->sin(2*%pi)<br>
     ans  =<br>
      - 2.449D-16  <br>
    <br>
    See the script :<br>
    <br>
    for atol = [1.e-1 1.e-2 1.e-4 1.e-8 1.e-10 1.e-12 1.e-14]<br>
      instr = "I = integrate(""sin(x)"",""x"",0,2*%pi,atol);";<br>
      ierr = execstr(instr,"errcatch");<br>
      if ( ierr == 0 ) then<br>
        mprintf("atol=%e, I=%.17e\n",atol,I)<br>
      else<br>
        mprintf("atol=%e, I=XXX\n",atol)<br>
      end<br>
    end<br>
    <br>
    This produces :<br>
    <br>
    atol=1.000000e-001, I=2.26062574420357380e-016<br>
    atol=1.000000e-002, I=2.26062574420357380e-016<br>
    atol=1.000000e-004, I=2.26062574420357380e-016<br>
    atol=1.000000e-008, I=2.26062574420357380e-016<br>
    atol=1.000000e-010, I=2.26062574420357380e-016<br>
    atol=1.000000e-012, I=2.26062574420357380e-016<br>
    atol=1.000000e-014, I=XXX<br>
    <br>
    Hence, it suffices to reduce the request for the absolute error to
    get an answer.<br>
    <br>
    Best regards,<br>
    <br>
    Michaël Baudin<br>
    <br>
    PS-1<br>
    I admit that there might not be enough informations provided by
    Scilab in the gateway.<br>
    The various output of the solvers are described in the ier variable
    of :<br>
    <br>
    <a href="http://www.netlib.org/quadpack/dqags.f">http://www.netlib.org/quadpack/dqags.f</a><br>
    <br>
    There are 6 different causes of failures, all of them being
    represented by the single "Convergence problem".<br>
    <br>
    PS-2<br>
    A similar problem was discussed at :<br>
    <br>
    <a href="http://bugzilla.scilab.org/show_bug.cgi?id=5728">http://bugzilla.scilab.org/show_bug.cgi?id=5728</a><br>
    <br>
    PS-3<br>
    There are issues with the integrate function, with the management of
    default input arguments:<br>
    <br>
    <a href="http://bugzilla.scilab.org/show_bug.cgi?id=8351">http://bugzilla.scilab.org/show_bug.cgi?id=8351</a><br>
    <br>
    Le 18/10/2010 16:25, José Luis Volta Grau a écrit :
    <blockquote
      cite="mid:3777DD50587E4370999184E3BEE4DF26@usera1d930417d"
      type="cite">
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      <meta name="GENERATOR" content="MSHTML 8.00.6001.18975">
      <style></style>
      <div><font face="Arial" size="2">Hi Jean:</font></div>
      <div> </div>
      <div><font face="Arial" size="2">Change the tolerance and you will
          get the result of integrate('sin(x)','x',0,2*%pi,1e-5)</font></div>
      <div> </div>
      <div><font face="Arial" size="2">-->integrate('sin(x)','x',0,2*%pi,1e-5)<br>
           ans  =<br>
           <br>
              2.222D-16 </font></div>
      <div> </div>
      <div><font face="Arial" size="2">which is almost zero.</font></div>
      <div> </div>
      <div><font face="Arial" size="2">J.L.</font></div>
      <blockquote style="border-left: 2px solid rgb(0, 0, 0);
        padding-left: 5px; padding-right: 0px; margin-left: 5px;
        margin-right: 0px;">
        <div style="font: 10pt arial;">----- Original Message ----- </div>
        <div style="font: 10pt arial; background: none repeat scroll 0%
          0% rgb(228, 228, 228);"><b>From:</b> <a
            moz-do-not-send="true" title="jean.podlecki@sfr.fr"
            href="mailto:jean.podlecki@sfr.fr">jean podlecki</a> </div>
        <div style="font: 10pt arial;"><b>To:</b> <a
            moz-do-not-send="true" title="users@lists.scilab.org"
            href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
        </div>
        <div style="font: 10pt arial;"><b>Sent:</b> Monday, October 18,
          2010 9:22 AM</div>
        <div style="font: 10pt arial;"><b>Subject:</b> [scilab-Users]
          Convergence problem</div>
        <div><br>
        </div>
        <span style="font-family: Helvetica; font-size: medium;"
          class="Apple-style-span">God afternoon,</span>
        <div style="font-family: Helvetica; font-size: medium;"><br>
        </div>
        <div style="font-family: Helvetica; font-size: medium;">Here's
          my problem.</div>
        <div style="font-family: Helvetica; font-size: medium;"><br>
        </div>
        <div style="font-family: Helvetica; font-size: medium;">-------------------------------------------------</div>
        <div style="font-family: Helvetica; font-size: medium;"><br>
        </div>
        <div style="font-family: Helvetica; font-size: medium;">
          <div>-->integrate('sin(x)','x',0,2*%pi)</div>
          <div> !--error 24 </div>
          <div>Problème de convergence ...</div>
          <div><br>
          </div>
          <div>at line      70 of function integrate called by :  </div>
          <div>integrate('sin(x)','x',0,2*%pi)</div>
        </div>
        <div style="font-family: Helvetica; font-size: medium;"><br>
        </div>
        <div style="font-family: Helvetica; font-size: medium;">-------------------------------------------------</div>
        <div style="font-family: Helvetica; font-size: medium;"><br>
        </div>
        <div style="font-family: Helvetica; font-size: medium;">Is it
          right ? How can I get the correct answer ?</div>
        <div style="font-family: Helvetica; font-size: medium;"><br>
        </div>
        <div style="font-family: Helvetica; font-size: medium;">Jean.</div>
        <br>
      </blockquote>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Michaël Baudin
Ingénieur de développement
<a class="moz-txt-link-abbreviated" href="mailto:michael.baudin@scilab.org">michael.baudin@scilab.org</a>
-------------------------
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

</pre>
  </body>
</html>