You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Vanessa Sabino <bo...@gmail.com> on 2005/11/06 05:09:26 UTC

[math] Numerical integration proposal and Linear system solving suggestion

Hi,

I've read in the Numerical Analysis section of the Commons Math
documentation that numerical integration was a possible future addition, so
I've decided to adapt my Simpson's Rule implementation to follow the same
structure I've seen in the rest of the code of the
org.apache.commons.math.analysis package, so that it could be added to the
commons math if you like it.
It can be found at http://www.linux.ime.usp.br/~bani/jakarta/

Actually, this code was part of a whole program to find solutions for
differential equations using the Galerkin minimization method and there is
one more thing I've implemented in it that I think might be useful:
I've noticed that RealMatrix in the org.apache.commons.math.linear package
uses LU decomposition to solve the system. Although LU is good in the
general case, there are better algorithms for specific cases, so it might be
a good idea to have an overloaded version of solve which receives an int
indicating which method to use.
We could have the constants:
CHOLESKY (much faster and more precise, but only works with Symmetric
Positive-Definite systems - we could automatically switch to LU if it isn't
symmetric positive-definite)
QR_GRAM-SCHMIDT
QR_HOUSEHOLDER (QR has the advantages of orthogonal matrices and retains the
condition number of the system, one method is better when there are a lot of
zeros in the matrix)
ans so on...

What do you think?


-- Vanessa Sabino

Re: [math] Numerical integration proposal and Linear system solving suggestion

Posted by Vanessa Sabino <bo...@gmail.com>.
> Have a look in the analysis package in
> svn trunk (see http://jakarta.apache.org/commons/math/developers.html


Ok, now I have the latest version :)

> decomposition into separate classes. If you have ideas and/or code
> implementing other decompositions, this would make a good addition to
> [math]. If you are interested in contributing this, the first thing
> to do is discuss design options.


The code I had was for Cholesky, which is already implemented in the
experimental dir, but I'll let you know if I have anything else to
contribute.


Thanks,
Vanessa

Re: [math] Numerical integration proposal and Linear system solving suggestion

Posted by Phil Steitz <ph...@gmail.com>.
Hi Vanessa,

Thanks for your interest and comments and thanks in advance for your
contributions.  See responses interspersed below.

On 11/5/05, Vanessa Sabino <bo...@gmail.com> wrote:
> Hi,
>
> I've read in the Numerical Analysis section of the Commons Math
> documentation that numerical integration was a possible future addition, so
> I've decided to adapt my Simpson's Rule implementation to follow the same
> structure I've seen in the rest of the code of the
> org.apache.commons.math.analysis package, so that it could be added to the
> commons math if you like it.
> It can be found at http://www.linux.ime.usp.br/~bani/jakarta/

This looks good; but we have actually already implemented this and
some other numerical integration algorithms.  These have just not been
released and - sigh - we have not gotten round to updating the site
docs to reflect the progress.  Have a look in the analysis package in
svn trunk (see http://jakarta.apache.org/commons/math/developers.html
for information on how to view / checkout the latest sources and don't
hesitate to ask questions if you have problems getting set up).  If
you can improve the code, documentation or test cases for these
classes, please have at it, posting any questions or comments that you
have here.
>
> Actually, this code was part of a whole program to find solutions for
> differential equations using the Galerkin minimization method and there is
> one more thing I've implemented in it that I think might be useful:
> I've noticed that RealMatrix in the org.apache.commons.math.linear package
> uses LU decomposition to solve the system. Although LU is good in the
> general case, there are better algorithms for specific cases, so it might be
> a good idea to have an overloaded version of solve which receives an int
> indicating which method to use.
> We could have the constants:
> CHOLESKY (much faster and more precise, but only works with Symmetric
> Positive-Definite systems - we could automatically switch to LU if it isn't
> symmetric positive-definite)
> QR_GRAM-SCHMIDT
> QR_HOUSEHOLDER (QR has the advantages of orthogonal matrices and retains the
> condition number of the system, one method is better when there are a lot of
> zeros in the matrix)
> ans so on...
>
> What do you think?

Definitely something we would like to have and where we could use some
help, but not sure using flags / overloaded methods in RealMatrixImpl
is the way to go.  If you can figure out a way to have the "default"
impl in RealMatrixImpl adaptively determine the best (among pluggable)
algorithm(s), then that would be a good modification to make; but
otherwise, we have been thinking about separating out the
decomposition into separate classes.  If you have ideas and/or code
implementing other decompositions, this would make a good addition to
[math].  If you are interested in contributing this, the first thing
to do is discuss design options.

Thanks!

Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org