[scilab-Users] equivalent of intg on a "discrete interval" (cumsum-like behaviour)

Adrien Vogt-Schilb vogt at centre-cired.fr
Thu Apr 26 14:36:35 CEST 2012


Good answer, thanks!

For the record: instead of calculating  F = intg (a,b,f), i should solve 
F' = f  on a..b with the scilab macro ode

On 26/04/2012 14:33, Stéphane Mottelet wrote:
> (sorry for the incomplete message)
>
> I suggest sorting all the bounds ti and then solve the ode y'=f, then 
> compute the integrals  by substracting y(tj)-y(ti), where A=tj, B=tj. 
> See ?
>
> S.
>
> Le 26 avr. 2012 à 14:02, Adrien Vogt-Schilb <vogt at centre-cired.fr 
> <mailto:vogt at centre-cired.fr>> a écrit :
>
>> Hi
>>
>> Scilab has a proceudre that integrates any given real function or 
>> external:
>>
>>
>> [v]=intg(a,b,f)
>>
>> I have a function f and would like to calculate the integral for a 
>> set of values , say in A:B
>>
>> Does anyone know if there is something more efficient than a loop on 
>> b to do? Currently I do this:
>>
>> segment = A:B;
>>
>> for i=1:size(segment,"*")
>>     [v(i)]=intg(A,segment(i),f)
>> end
>>
>> It's a shame, because I guess that that there should be a way to 
>> optimize what intg does in this case
>>
>>
>> -- 
>> Adrien Vogt-Schilb (Cired)
>> Tel: (+33) 1 43 94 *73 77*

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20120426/1c5b2c7e/attachment.htm>


More information about the users mailing list