quadl crashes on evaluation
Ben Abbott
bpabbott at mac.com
Sat Sep 20 05:13:02 CDT 2008
On Sep 19, 2008, at 11:46 PM, rmcd wrote:
>
> I find that using quadl in Cygwin Octave 3.0.2-1 crashes octave,
> dumping me
> at the prompt.
>
> Let y=f(x) where f(x) = x .* sin (1 ./ x) .* sqrt (abs (1 - x));
>
> (This is the example from p. 272 of the 3.0.2 manual)
>
> v=quad ("f",0,3) % produces the result 1.9819.
> v=quadl("f",0,3) % crashes cygwin 3.0.2, generates numerous errors in
> Ubuntu 3.0.0
>
> Am I doing something wrong or is there a problem with quadl in this
> case?
>
> Thanks!
>
> Bob
When you say "crash" what do you get, exactly?
I get the following errors repeated many times
error: evaluating binary operator `+' near line 169, column 3
error: evaluating binary operator `+' near line 170, column 3
error: evaluating binary operator `+' near line 171, column 3
error: evaluating binary operator `+' near line 172, column 3
error: evaluating binary operator `+' near line 173, column 3
error: evaluating assignment expression near line 168, column 7
error: evaluating if command near line 157, column 3
error: called from `quadl:adaptlobstp' in file `/Users/bpabbott/
Development/Octave Toolbox/quadl/quadl.m'
error: evaluating assignment expression near line 126, column 5
error: called from `quadl' in file `/Users/bpabbott/Development/Octave
Toolbox/quadl/quadl.m'
error: evaluating assignment expression near line 14, column 3
Looking in quadl.m we have
> x = [a, m-x1*h, m-alpha*h, m-x2*h, m-beta*h, m-x3*h, m, m+x3*h, ...
> m+beta*h, m+x2*h, m+alpha*h, m+x1*h, b];
>
> y = feval (f, x, varargin{:});
When called, the first element of "x" is zero, thus your function
returns a NaN.
If your function is modified
f(x) = x .* sin (1 ./ (x+eps)) .* sqrt (abs (1 - x));
and an integration tolerance is added
v = quadl ('f' ,0, 3,. 0001)
v = 1.9818
If any event, please describe what you mean by "crash".
Ben
More information about the Help-octave
mailing list