# slow integration

4 messages
Open this post in threaded view
|

## slow integration

 Hello, I guess that I am doing something not very good because it is slow. function y = Lor (x, amp, x0, g)  y = amp ./ ((x - x0).**2 .+ g .* g) ; endfunction function y = Sat (x, t, shift, wD, g, s)  tt = t ./ wD ;  tmp = Lor ((x .- t), 1, -shift, g) ;  tmp += Lor ((x .+ t), 1, -shift, g) ;  tmp += Lor ((x .- t), 1, shift, g) ;  tmp += Lor ((x .+ t), 1, shift, g) ;  y = exp (-tt .* tt) .* tmp ./ (1 .+ tmp .* s) ; endfunction function y = Int_Sat (x, Shift, wD, g, s) y = quad (@(t) Sat (x, t, Shift, wD, g, s), 0, 15) ; endfunction N=101; x_min = -10 x_max = 10 step = (x_max - x_min) / (N - 1) for i = 0:N   ii = i + 1 ;   xx (ii) = x_min + i * step;   yy2 (ii) = Int_Sat (xx (ii), 2, 5, 0.0005, 0.01) ; endfor Some ideas? Thank. ===========================================================================  Patrick DUPRÉ                                 | | email: [hidden email]  Laboratoire de Physico-Chimie de l'Atmosphère | |  Université du Littoral-Côte d'Opale           | |  Tel.  (33)-(0)3 28 23 76 12                   | | Fax: 03 28 65 82 44  189A, avenue Maurice Schumann                 | | 59140 Dunkerque, France ===========================================================================
Open this post in threaded view
|

## Re: slow integration

 On Wed, Apr 11, 2018, 8:09 AM Patrick Dupre <[hidden email]> wrote: function y = Int_Sat (x, Shift, wD, g, s) y = quad (@(t) Sat (x, t, Shift, wD, g, s), 0, 15) ;endfunctionHave you compared performance using any other integrators than just quad?
Open this post in threaded view
|

## Re: slow integration

 Hello,   I compare to c/gsl routines. There is a factor maybe 100 or more.   =========================================================================== Patrick DUPRÉ | | email: [hidden email] Laboratoire de Physico-Chimie de l'Atmosphère | | Université du Littoral-Côte d'Opale | | Tel. (33)-(0)3 28 23 76 12 | | Fax: 03 28 65 82 44 189A, avenue Maurice Schumann | | 59140 Dunkerque, France ===========================================================================     Sent: Wednesday, April 11, 2018 at 3:21 PM From: "Nicholas Jankowski" <[hidden email]> To: "Patrick Dupre" <[hidden email]> Cc: "Help GNU Octave" <[hidden email]> Subject: Re: slow integration   On Wed, Apr 11, 2018, 8:09 AM Patrick Dupre <[hidden email]> wrote: function y = Int_Sat (x, Shift, wD, g, s) y = quad (@(t) Sat (x, t, Shift, wD, g, s), 0, 15) ; endfunction   Have you compared performance using any other integrators than just quad?
Open this post in threaded view
|

## Re: slow integration

 On Wed, Apr 11, 2018, 10:40 AM Patrick Dupre <[hidden email]> wrote:Hello,   I compare to c/gsl routines. There is a factor maybe 100 or more.I would be interested to see his the timing results change with any of the other integrators.