Elliptic Integrals * request help *

  • Thread starter Thread starter astropi
  • Start date Start date
  • Tags Tags
    Integrals Request
Click For Summary

Discussion Overview

The discussion revolves around the computation of elliptic integrals of the first and second kind, specifically F and E. Participants explore programming solutions, existing libraries, and algorithms related to these integrals, with a focus on practical implementation rather than theoretical derivation.

Discussion Character

  • Homework-related
  • Technical explanation
  • Experimental/applied

Main Points Raised

  • One participant seeks assistance in finding or writing a program to compute elliptic integrals, mentioning difficulties in getting their code to work correctly.
  • Another participant suggests simplifying the problem to basic functions to troubleshoot the code, implying that the issue may be fundamental.
  • A third participant recommends the Gnu Scientific Library as a potential resource for computing elliptic integrals.
  • Another participant mentions an efficient algorithm for complete elliptic integrals using arithmetic-geometric means, providing a link to their site for further details and example code.
  • The original poster later reports resolving their issue after checking results against a reference, indicating progress in their understanding and implementation.

Areas of Agreement / Disagreement

Participants generally agree on the usefulness of existing libraries and the importance of debugging code. However, there is no consensus on the best approach to compute elliptic integrals, as various methods and resources are suggested.

Contextual Notes

The discussion reflects a range of programming experience among participants, with some providing links to resources while others focus on troubleshooting specific code issues. The original poster's initial misunderstanding highlights the challenges faced by beginner programmers.

Who May Find This Useful

This discussion may be useful for individuals interested in programming for mathematical computations, particularly those working with elliptic integrals or seeking guidance on debugging code in C or related languages.

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

  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
1
Views
4K
  • · Replies 11 ·
Replies
11
Views
6K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K