<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Le 26/04/2012 14:02, Adrien Vogt-Schilb a écrit :
    <blockquote cite="mid:4F993946.4050108@centre-cired.fr" type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      Hi<br>
      <br>
      Scilab has a proceudre that integrates any given real function or
      external:<br>
      <br>
      <div class="refsynopsisdiv">
        <h3 class="title"> </h3>
        <div class="synopsis">
          <pre><span class="default">[v]=</span><span class="functionid">intg</span><span class="default">(a,b,f)</span></pre>
        </div>
      </div>
      <br>
      I have a function f and would like to calculate the integral for a
      set of values , say in A:B<br>
      <br>
      Does anyone know if there is something more efficient than a loop
      on b to do? Currently I do this:<br>
      <br>
      segment = A:B;<br>
      <br>
      for i=1:size(segment,"*")    <span class="default"><br>
            [v(i)]=</span><span class="functionid">intg</span><span
        class="default">(A,segment(i),f)</span>
      <div class="synopsis"> </div>
      end<br>
      <br>
      It's a shame, because I guess that that there should be a way to
      optimize what intg does in this case<br>
      <br>
      <br>
      <div class="moz-signature">-- <br>
        Adrien Vogt-Schilb (Cired) <br>
        Tel: (+33) 1 43 94 <b>73 77</b></div>
    </blockquote>
    The following code should be more efficient<br>
    for i=2:size(segment,"*")    <span class="default"><br>
          v(i)=</span><span class="functionid">intg</span><span
      class="default">(segment(i-1),segment(i),f)</span>
    <div class="synopsis"> </div>
    end<br>
    v=cumsum(v)<br>
    <br>
    Serge Steer<br>
    <br>
  </body>
</html>