[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 08:15:51 -0700 |
On 09/29/2017 05:27 AM, Nicholas Jankowski wrote:
> Rik, can you or someone else check the following against your newly
> pushed quadcc? this throws an error in the 4.2,1 release version. unless
> it's something now fixed in your version I think it calls for a bug
> report. I stumbled on it when I tried to pass a function of x only to
> integral2:
>
> >> quadv(@(x) 1, 0,1)
> ans = 1
> >> quad(@(x) 1, 0,1)
> ans = 1
> >> quadgk(@(x) 1, 0,1)
> ans = 1
> >> quadcc(@(x) 1, 0,1)
> error: quadcc: integrand F must return a single, real-valued vector
It throws an error, but I think it might be correct. The integrand is
supposed to return a vector for vector inputs. This allows the quadrature
routine to call f(x1, x2, x3, ..., xn) and get y1,y2,y3, ..., yn.
Vectorization is always far faster than having to write this as a for loop
from 1:n and then call the function repeatedly.
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