Elliptic Integrals * request help *

  • Thread starter Thread starter astropi
  • Start date Start date
  • Tags Tags
    Integrals Request
AI Thread Summary
A user is seeking assistance in computing the elliptic integrals of the first and second kind (F and E) and is open to using existing code or libraries. They initially attempted to write their own code in C++, which consistently returned a value of 2, indicating an error in their implementation. Suggestions included simplifying their code to test basic functions and utilizing resources like the Wolfram functions site and the Gnu Scientific Library for pre-existing solutions. The user later resolved their coding issue and confirmed their results with a reliable reference. They expressed interest in eventually using the GNU library for their calculations.
astropi
Messages
47
Reaction score
0

Homework Statement


I need to write a program (or use one that's already written) to compute the elliptic integral of the 1st and 2nd kind - ie F and E respectively. Please note that this is NOT a homework assignment. Thus, I do not actually need to write the code, and will be happy to use something that's already written. (In fact, I would be surprised if this hasn't been done quite a lot already, I just can't seem to find any code/library)!

Homework Equations


No equations. I looked to see if I could find this code already implemented in C or Fortran, and no luck thus far. So, I decided to try and see if I could get my own code to work via Numerical Recipes in C. I wrote the code, and the code is giving me a value of 2, always. Clearly it's not working.

The Attempt at a Solution


I will be happy to e-mail someone my code if he/she is willing to look at it (it's written in C++). Consequently, if anyone knows if this is already implemented in some library, please let me know. Also, please note that I am a beginner programmer, so I apologize ahead of time if my questions are "simple"! Thank you.
 
Physics news on Phys.org
Probably nobody is going to want to wade through your code and figure out what you did wrong. If it's always giving 2, you probably have something simple wrong. I suggest you simplify the problem to trying to calculate something easy (like x^2 or cos(x)), and get this working, then move on to more complicated functions. The Wolfram functions site is a great resource for formulas on functions like this:

http://functions.wolfram.com/
 
Not sure if you're looking for "complete" elliptic integrals or not. If you want the complete elliptic integrals of first and second kind, there's a very efficient algorithm using arithmetic-geometric means. I discuss it on my site, and have example code in Open Office Basic and Javascript.
http://electronbunker.sasktelwebsite.net/CalcMethods1a.html
 
Last edited by a moderator:
Thanks everyone for your helpful replies. Shortly after I posted I figured out what I did wrong (isn't that always the case :)

I checked my results with Abramowitz and Stegun and they agree perfectly. I would eventually like to get the GNU library to work, I haven't done that yet.

cheers,

-astropi
 

Similar threads

Back
Top