help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implementing AbsTol for quadcc


From: Rik
Subject: Re: Implementing AbsTol for quadcc
Date: Fri, 29 Sep 2017 09:44:21 -0700

On 09/29/2017 09:27 AM, Nicholas Jankowski wrote:
Just to test, if you change the integrand to a vector function it works
correctly.

quadcc (@(x) ones (size (x)), 0, 1)
ans =  1.00000

Cheers,
Rik

Yes, I just find it curious that the other functions do not error on the same integrand despite having the same vector function requirements.

Peeking in quadgk I assume it's because of the transform that occurs on lines 235-236, that essentially redefines the function as a vector function whether it starts as one or not.  maybe similar things happen in quadl. quad and quadv don't have the same requirement.

I bring this up because I was trying out some compatibility tests with integral2. 

Matlab gives the same vector function error as quadcc for all of its vectorized quad functions (quadgk, quadl) and integral. similar for dblquad:

>> dblquad(@(x,y) x, 0,1,0,1)
ans =
    0.5000
>> dblquad(@(x,y) y, 0,1,0,1)
Error using quad (line 70)
The integrand function must return an output vector of the same length as the input vector.

but not for integral2:
>> integral2(@(x,y) x, 0,1,0,1)
ans =
    0.5000
>> integral2(@(x,y) y, 0,1,0,1)
ans =
    0.5000

since we switched integral2 over to using quadcc, we get the same effort as dblquad
>> integral2(@(x,y) x, 0,1,0,1)
ans =  0.50000
>> integral2(@(x,y) y, 0,1,0,1)
error: quadcc: integrand F must return a single, real-valued vector


just leave this under the category of 'undocumented matlab we aren't going to worry about'?


I think that's good enough for now.

--Rik

reply via email to

[Prev in Thread] Current Thread [Next in Thread]