Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
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$1@fred.mathworks.com>
References: <i735gj$782$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1284854824 20685 172.30.248.37 (19 Sep 2010 00:07:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 19 Sep 2010 00:07:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:671169

"Alexander Pohl" <alexander.pohl@stfc.ac.uk> wrote in message <i735gj$782$1@fred.mathworks.com>...
> 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.

John