[Scilab-users] integral of th discontinuous function

Serge Steer Serge.Steer at inria.fr
Tue May 12 18:08:34 CEST 2015


Le 12/05/2015 17:31, fujimoto2005 a écrit :
> I want to integrate a discontinuous function whose number of discontinuous
> points are 3-4.
> I know I can get an enough accurate result when I divide whole integrate
> range to sub-ranges over which the function is continuous and apply the
> standard intergration program such as inttrap for each range and sum the
> results.
is your function beeing given by a scilab function like y=f(t) or by a
sequence (t(k),y(k)) in the first case the inegration of the continuous
part can be done using the intg function and in the second one by inttrap.

In the second case the notion of discontinuity is not clear because you
only have a discret sequence of points

in the first case it seems that intg gives quite good results even with
a discontinuous function:

function y=f(t)
if t<=1 then
    y=sin(t)
elseif t<=3
    y=10+sin(t)
else
   y=-10*sin(t)
end
endfunction
e=1e-13;
i1=intg(0,5,f,e,e);
i2=intg(0,1,f,e,e)+intg(1+2*%eps,3,f,e,e)+intg(3+2*%eps,5,f,e,e);
i1-i2
 ans  =
 
    1.421D-14 

Serge Steer
> But I want to integrate with one whole range.
> Is there a such program?
>
>
>
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/integral-of-th-discontinuous-function-tp4032242.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>




More information about the users mailing list