Raymond E. Rogers wrote: > Kristjan Onu wrote: >> I noticed some oddities in the way the function ellipke from the >> specfun package handles vector input. For example, >> >> ellipke([.1; .2]) >> >> completes successfully, whereas the following fails: >> >> ellipke([.1 .2]) >> >> I've modified ellipke.m to make both of the above work (patch >> below). If you wish, I can apply the patch to the Octave-Forge >> SourceForge repository myself, however, I don't currently have >> developer access. My SourceForge username is konu. >> > The autoloaded special functions from gsl seem to work as a double > check. > a=ellint_Kcomp([.2 .1],0) > a=ellint_Ecomp([.90 .1; .4 .5],0) > etc... > > Unfortunately there must be a interpretation/scaling error since > they disagree with ellipke. I can look into it later if nobody has > an explanation.
I believe the scaling difference is the following: ellint_Kcomp(m,0) = ellipke(m^2) This can be seen explicitly by comparing the GSL documentation [1] to the Abramowitz and Stegun's, formula 17.3.1 [2]. I think it would be helpful to document ellipke, ellint_Kcomp and ellint_Ecomp with the definitions used for elliptic integrals, i.e. [k,e] = ellipke(m) k = \int_0^\pi/2 dt 1/\sqrt((1 - m \sin^2(t))) e = \int_0^\pi/2 dt \sqrt((1 - m \sin^2(t))) k = ellint_Kcomp(m) k = \int_0^\pi/2 dt 1/\sqrt((1 - m^2 \sin^2(t))) e = ellint_Ecomp(m) e = \int_0^\pi/2 dt \sqrt((1 - m^2 \sin^2(t))) Since ellint_Kcomp and ellint_Ecomp perform the same operations as ellipke, could ellipke be modified to call the GSL functions? This would seem to avoid code duplication; the patch I gave in my first message wouldn't be needed. Thanks for pointing out the GSL functions to me, Raymond! Kristjan [1] http://www.gnu.org/software/gsl/manual/html_node/Definition-of-Legendre-Forms.html [2] http://www.math.sfu.ca/~cbm/aands/page_590.htm ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Octave-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/octave-dev
