Re: New package proposal: Math_Calculus
| From: | Jesus M. Castagnetto | Date: | Mon, 19 May 2003 22:46:12 +0000 |
| Subject: | Re: New package proposal: Math_Calculus | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-16480@lists.php.net to get a copy of this message | ||
Hi Johannes,
--- Johannes Schlueter <phpng@schlueters.de> wrote:
> On Friday 16 May 2003 23:45, you wrote:
> > The class looks OK for simple functions withouth many singular points.
> > As it stands now, I would not recommend its inclusion in PEAR: -1
>
> Ok.
>
> > 1) The name of the class: Perhaps you will be better of having 2 or more
> > Math_Numerical_Differentiation, Math_Numerical_Integration, etc. Or how
> > about a Math_Numerical (or Math_NumericalMethod or Math_NumericalSolution?)
> > class that works as facade to the ones implementing the algorithms?
>
> Math_Numerical looks good, but then we need many method's with it, but I'll
> look how I can implement all useful Numerical Alogrithms with PHP ;-)
You could release Math_Numerical_Differentiation (or Derivative) and
Math_Numerical_Integration. That way, the code is in easily digestible bits ;-)
>
> > 2) The implementation of your differentiation function, if you are handed a
> > non-continuous function, then you will be in trouble using the simple
> > approach, w/o previously testing for continuity in the interval where you
>
> Yes, that's true. The version I posted was the work of very few hours, just
> for solving a problem I had. Therefore it worked. Then I saw there's no such
> thing for PEAR so I wrote some comments to see the reactions, imho it don't
> make sense spending hours of work if nobody wants it ;-)
Agree, perhaps coordinating the work w/ the phpmath.com people will be a good
solution. The more people involved the better the code can be.
> > are calculating the derivative. A look at:
> > http://lib-www.lanl.gov/numerical/index.html, and in
> > particular at:
> > http://lib-www.lanl.gov/numerical/bookfpdf/f5-7.pdf, will
> > surely help in
> > this respect. Might also need to be careful not to generate an floating
> > point overflow.
>
> The links look really interesting. All have a closer look over these an
> improve my code.
The 'Numerical Recipes in XX' (where XX = Fortran, C, C++, etc.) is a good
collection of books. It is just great that the people at Los Alamos National
Lab (LANL) have put them up on the web as PDFs
> > 3) The implementation of the Romberg's integration method tries to minimize
> > errors by using iterations of the trapezoidal rule. But for analytical
> > functions, you might be better using other approaches.
>
> Romberg'smethod was the one I've found most implementations for and the one
> I've understood easily ;-)
Indeed, the trapezoidal rule and variants are the simplest to grok. It is quite
interesting that there are more methods for performing numerical integration
than numerical differentiation. AFAICT, it is because integration does not
suffer from the continuity limitation that differentiation does.
> > 4) The method that finds point of a function where the derivative is zero
> > is OK, but it is of no use if it is not coupled with one that find the
> > extrema (minima and maxima). Also, if might be better named
> > findZeroDerivative() instead. Of course you will need to define a second
> > derivative method for the extrema.
>
> Yes...
>
> > Overall the idea is good. The implementation needs some work. For example,
> > a stable and reliable differentiation package could be use to solve funding
> > the roots of an equations using any of the well-known methods (e.g.
> > Newton-Raphson's).
> >
> > The URL mentioned above has a lot of great numerical recipes. And as we
> > cannot add GSL to PECL due to licensing conflicts, perhaps implementing
> > them in PHP would be nice.
>
> If I'm going to implement all of them I'll never be bored again. And if I'm
> still bored I can implement it using BCMath, GMP and PEAR Math_Complex. ;-)
Indeed, Math is not boring if one has a use for it in mind (or if you like
strange and interesting stuff) ;-)
>
> johannes
=====
--- Jesus M. Castagnetto (jcastagnetto@yahoo.com)
Research:
http://metallo.scripps.edu/
Personal: http://www.castagnetto.org/
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com