Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-03 Thread Ajo Fod
I agree that the choice of quadrature rules is orthogonal to Adaptive strategy. But, can one quadrature rule be more efficient than another by points evaluated per digit of accuracy? It seems like in GKQ, the G and K nodes are different points at each level of resolution. However in CCQ, the high

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-03 Thread Gilles
On Wed, 3 Jul 2013 07:39:00 -0700, Ajo Fod wrote: I wonder if Clenshaw-Curtis Quadrature (CCQ) is more adapted for Adaptive Quadrature than Gauss-Kronrod (GKQ). As Konstantin already pointed out, the choice of a quadrature rule is orthogonal to the choice of an adaptive strategy. It seems l

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-03 Thread Ajo Fod
I wonder if Clenshaw-Curtis Quadrature (CCQ) is more adapted for Adaptive Quadrature than Gauss-Kronrod (GKQ). It seems like with CCQ the points at one level of resolution can be reused for the next level. The error bounds for a given level of resolution is the comparable to GKQ, so I'm guessing t

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-02 Thread Gilles
On Tue, 2 Jul 2013 12:54:12 -0400, Konstantin Berlin wrote: IterateiveLegendreGaussIntegrator should be replaced by adaptive guass-kronrod. The simpson and trapezoidal methods should be replaced by their adaptive versions, or at least adaptive wrapper provided for them. [I mentioned Gauss-Kro

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-02 Thread Gilles
Hi. Thanks for pointing out the inefficiency in AQ. I just improved the efficiency of AQ to 1.41x that of LGQ (up from 1.05x) - measured in digits of accuracy per evaluation for integral of normal with sigma 1000 in range [-5000, 5000] Efficiency improvement is another type of enhancement

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-02 Thread Ajo Fod
Gauss-Kronrod is an improvement over the current AQ promise because of its improved efficiency. That would be a good upgrade to the proposed AQ. Also, Gauss-Kronrod will allow the elimination of the fix to the bounds of integration problem with Simpsons rule. -Ajo. On Tue, Jul 2, 2013 at 9:54

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-02 Thread Konstantin Berlin
IterateiveLegendreGaussIntegrator should be replaced by adaptive guass-kronrod. The simpson and trapezoidal methods should be replaced by their adaptive versions, or at least adaptive wrapper provided for them. On Tue, Jul 2, 2013 at 12:51 PM, Ajo Fod wrote: > Konstantin, > > In essence, we're

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-02 Thread Ajo Fod
Konstantin, In essence, we're both rooting for Adaptive Quadratures. IMHO AdaptiveQuadrature (or some form of it that passes all Apache standards) must replace IterateiveLegendreGaussIntegrator as soon as possible before somebody else gets hit by a report of convergence to the wrong answer. ** Ch

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-02 Thread Ajo Fod
Phil, Adaptive Quadrature is defined here ... Gilles mentioned this: http://en.wikipedia.org/wiki/Adaptive_quadrature We have discussed why AQ is better in the email chain. The differences have been discussed in this email chain and are quite minor. Based on the tests done so far the question sho

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-02 Thread Konstantin Berlin
At first it seems you are still compute redundant points. See my example that I posted, where I propagate 3 functional values not two. In regards to improvement. I am not an expert of different integration strategies but: The concept of adaptive quadrature is separate from how you integrate the su

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-02 Thread Phil Steitz
On 7/1/13 8:37 PM, Ajo Fod wrote: > Hi Konstantin, > > Thanks for pointing out the inefficiency in AQ. I just improved the > efficiency of AQ to 1.41x that of LGQ (up from 1.05x) - measured in digits > of accuracy per evaluation for integral of normal with sigma 1000 in range > [-5000, 5000] > > Pl

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-01 Thread Ajo Fod
Hi Konstantin, Thanks for pointing out the inefficiency in AQ. I just improved the efficiency of AQ to 1.41x that of LGQ (up from 1.05x) - measured in digits of accuracy per evaluation for integral of normal with sigma 1000 in range [-5000, 5000] Please let me know if this doesn't answer your que

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-01 Thread Konstantin Berlin
I am not understanding the discussion here. Adaptive integration is designed for functions that have different behavior in different regions. Some regions are smoother, some have higher frequeniesy. How you integrate a divided region, Simpson rule or whatever is a separate question. Adaptive integ

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-01 Thread Ajo Fod
Hi Gilles, Your accuracy concern made me wonder. So, I dropped the AdaptiveQuadrature.EPS to 1e-2 from 1e-9 in the code and ran the test in the patch. I computed the log of the error per evaluation ...i.e a measure of the efficiency of the algorithm. And wait for it ... AQ beats LGQ by about 5% f

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-01 Thread Konstantin Berlin
private void proc(UnivariateFunction fn) { +Calc calc = calcs.pop();// pop a calculation to be done. +double a = calc.a; +double b = calc.b; + +// back off slightly from the edges (function evaluations typically go haywire) +// scale for the edge a

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-01 Thread Gilles
Hi. On Mon, 1 Jul 2013 10:50:19 -0700, Ajo Fod wrote: If you wanted to use the Math 3 codebase in AdaptiveQuadrature, you'd compute the calculations of Q1 and Q2 with something else. I'm not entirely familiar with the apache Math codebase [...] You could file a "wish" request as a Commons Ma

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-01 Thread Ajo Fod
1> Could you provide an example of redundant function evaluations in my code? 2> I made the adjustment in AQ because the size of the segment that was excluded from the integration could be determined adaptively to keep the error arbitrarily low. Note the size of the segment that is excluded (at th

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-01 Thread Konstantin Berlin
Just a few thoughts. It seems to me that this code suffers from redundant function evaluations. I am not sure what to think about the movement from edges since it violates proper behavior for well behaved functions in order to work for some special cases. In case of infinite integrals it might

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-01 Thread Ajo Fod
If you wanted to use the Math 3 codebase in AdaptiveQuadrature, you'd compute the calculations of Q1 and Q2 with something else. I'm not entirely familiar with the apache Math codebase so my guess would be that you can replace the following line in AdaptiveQuadrature.proc(): double Q1 = delta / 6

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-07-01 Thread Gilles
Hi. I just noticed your request to write the algorithm along the lines of the wikipedia article. The only major difference between my code and the article on Wikipedia is that I found it necessary to move the recursive stack in into a data structure to avoid a StackOverflowException when t

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-06-28 Thread Ajo Fod
Gilles, I just noticed your request to write the algorithm along the lines of the wikipedia article. The only major difference between my code and the article on Wikipedia is that I found it necessary to move the recursive stack in into a data structure to avoid a StackOverflowException when the

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-06-28 Thread Ajo Fod
BTW, it is possible that I'm not using LGQ correctly. If so, please show how to pass the tests I've added. I'd much rather use something that is better tested than my personal code. -Ajo. On Fri, Jun 28, 2013 at 11:04 AM, Ajo Fod wrote: > I just posted a patch on this issue. Feel free to edit

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-06-28 Thread Ajo Fod
I just posted a patch on this issue. Feel free to edit as necessary to match your standards. There is a clear issue with LGQ. Cheers, Ajo. On Fri, Jun 28, 2013 at 10:54 AM, Gilles wrote: > Ted, > > > >> Did you read my other (rather more lengthy) post? Is that "jumping"? >>> >>> >> Yes. You

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-06-28 Thread Gilles
Ted, Did you read my other (rather more lengthy) post? Is that "jumping"? Yes. You jumped on him rather than helped him be productive. The general message is "we have something in the works, don't bother us with your ideas". Then please read all the messages pertaining to those issu

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-06-28 Thread Ajo Fod
Hey guys, Ted/Gilles, thanks for the support and reviewing the code. I realize that there is no Junit test with the files. I'll make a working patch to make life easier on everyone. Cheers, Ajo. On Fri, Jun 28, 2013 at 9:06 AM, Ted Dunning wrote: > On Fri, Jun 28, 2013 at 9:05 AM, Gilles >wr

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-06-28 Thread Ted Dunning
On Fri, Jun 28, 2013 at 9:05 AM, Gilles wrote: > Did you read my other (rather more lengthy) post? Is that "jumping"? > Yes. You jumped on him rather than helped him be productive. The general message is "we have something in the works, don't bother us with your ideas".

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-06-28 Thread Gilles
On Fri, 28 Jun 2013 08:32:49 -0700, Ted Dunning wrote: On Fri, Jun 28, 2013 at 8:14 AM, Gilles wrote: Hello. The existing LegendreGaussQuadrature class incorrectly assumes that it has converged for functions where the polynomial approximation fails in a small corner of the integral space.

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-06-28 Thread Ted Dunning
On Fri, Jun 28, 2013 at 8:14 AM, Gilles wrote: > Hello. > > The existing LegendreGaussQuadrature class incorrectly assumes that it has >> converged for functions where the polynomial approximation fails in a >> small >> corner of the integral space. >> >> This situation is handled much better wit

Re: [math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-06-28 Thread Gilles
Hello. The existing LegendreGaussQuadrature class incorrectly assumes that it has converged for functions where the polynomial approximation fails in a small corner of the integral space. This situation is handled much better with the AdaptiveQuadrature class in the path for MATH-995. This p

[math] On MATH-995: Problems with LegendreGaussQuadrature class.

2013-06-27 Thread Ajo Fod
The existing LegendreGaussQuadrature class incorrectly assumes that it has converged for functions where the polynomial approximation fails in a small corner of the integral space. This situation is handled much better with the AdaptiveQuadrature class in the path for MATH-995. This problem should