[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: quadl can't integrate sin or cos over a period
From: |
LUK ShunTim |
Subject: |
Re: quadl can't integrate sin or cos over a period |
Date: |
Tue, 08 Jul 2008 17:24:36 +0800 |
User-agent: |
Mozilla-Thunderbird 2.0.0.14 (X11/20080509) |
Dmitri A. Sergatskov wrote:
> On Mon, Jul 7, 2008 at 11:41 PM, Adam Higuera <address@hidden> wrote:
>> When I enter the command:
>>
>> quadl(@sin, 0, 2*pi)
>>
>> octave 3.0.1 under Fedora 9 hangs and fails to produce a result. However,
>>
>
> Perhaps it is a bug in the algorithm itself. In any case it does not
> really hangs,
> it just take a very long time to finish. You can speed it up by specifying
> tolerance :
>
> octave:12> tic; x=quadl(@sin, 0, 2*pi, 1e-2); toc
> Elapsed time is 0.6039 seconds.
> octave:13> x
> x = 1.3878e-16
> octave:14> tic; x=quadl(@sin, 0, 2*pi, 1e-3); toc
> Elapsed time is 2.542 seconds.
> octave:15> x
> x = 1.1102e-16
> octave:16> tic; x=quadl(@sin, 0, 2*pi, 1e-4); toc
> Elapsed time is 7.278 seconds.
> octave:17> x
> x = 1.1102e-16
> octave:18> tic; x=quadl(@sin, 0, 2*pi, 1e-5); toc
> Elapsed time is 28.99 seconds.
> octave:19> x
> x = 1.1102e-16
> octave:20>
>
> Dmitri.
> --
The integral of sine from 0 to 2\pi is, of course, 0. It seems we have a
variant of another recent thread. :-)
Regards,
ST
--