From: "John D'Errico" <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to optimise numerical integration?
Date: Sun, 19 Sep 2010 00:07:04 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 16
Message-ID: <i73k78$k6d$>
References: <i735gj$782$>
Reply-To: "John D'Errico" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1284854824 20685 (19 Sep 2010 00:07:04 GMT)
NNTP-Posting-Date: Sun, 19 Sep 2010 00:07:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: comp.soft-sys.matlab:671169

"Alexander Pohl" <> wrote in message <i735gj$782$>...
> Hi,
> I would like to calculate the integral of exp(-t^2)sin(t) from 0 to t and make the following calculation as efficient as possible. Currently each point of the t vector has to be evaluated individually inside the 'for loop' which takes a long time.
> Does anybody know how to vectorise the 'for loop' or any other method which would beat the current code in calculation time? I've got the optimisation toolbox and the NAG toolbox available if that's of any use.

They won't help much.

Personally, I'd be tempted to integrate a piecewise Hermite
interpolant. You know the derivatives of this function. They
are trivial to evaluate. So build a 5th or 7th order Hermite 
interpolant, then integrate that interpolant exactly.