Re: [Scilab-users] integral of th discontinuous function

2015-05-12 Thread Serge Steer
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@lists.scilab.org
 http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] integral of th discontinuous function

2015-05-12 Thread Samuel Gougeon

Le 12/05/2015 18:08, Serge Steer a écrit :

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


Actually, the algorithm used by intg() is self-adaptative. It 
automatically refine the sampling of intervals where the function varies 
rapidly.
However, it is not perfect. Cases with isolated values cannot be always 
efficiently integrated.


Samuel

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] integral of th discontinuous function

2015-05-12 Thread fujimoto2005
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.
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@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users