Elliptic Integrals * request help *

In summary, the individual needs to compute the elliptic integral of the 1st and 2nd kind, but does not need to write the code themselves and is open to using existing code. They have attempted to use Numerical Recipes in C but the code is not working properly, giving a value of 2 consistently. They are willing to send their code to someone for assistance and are also open to using the Gnu Scientific Library. They also mention that they are a beginner programmer and apologize for any simple questions. Other users suggest checking the Wolfram functions site and using a specific algorithm for calculating complete elliptic integrals. The individual eventually figures out their mistake and confirms their results with Abramowitz and Stegun. They also mention their interest
  • #1
astropi
47
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
  • #2
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/
 
  • #3
  • #4
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:
  • #5
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
 

FAQ: Elliptic Integrals * request help *

What are elliptic integrals?

Elliptic integrals are mathematical functions that involve the integration of algebraic expressions with elliptic functions. They have applications in various fields such as physics, engineering, and mathematics.

What is the difference between elliptic integrals and regular integrals?

The main difference between elliptic integrals and regular integrals is that elliptic integrals involve the integration of elliptic functions, which are more complex than regular functions. They also have a more limited range of convergence compared to regular integrals.

How are elliptic integrals used in real-world applications?

Elliptic integrals have various applications in fields such as physics, engineering, and mathematics. They are used to solve problems related to the motion of celestial bodies, the calculation of electric and magnetic fields, and the determination of the period of a pendulum, among others.

What are the different types of elliptic integrals?

There are three types of elliptic integrals: the complete elliptic integral of the first kind, the complete elliptic integral of the second kind, and the complete elliptic integral of the third kind. Each type has its own specific form and properties.

How can I learn more about elliptic integrals?

If you are interested in learning more about elliptic integrals, there are various resources available such as textbooks, online tutorials, and courses. It is also helpful to have a strong understanding of calculus and algebra before diving into elliptic integrals.

Similar threads

Replies
21
Views
2K
Replies
10
Views
2K
Replies
8
Views
3K
Replies
11
Views
5K
Replies
12
Views
1K
Replies
5
Views
2K
Replies
1
Views
942
Replies
8
Views
2K
Back
Top