Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Could you find good numerical approximations to math. problem with a PC?

  1. Jun 14, 2012 #1
    I've recently taken a basic numerical analysis course in university and the subject intrigues me so much. I know Pascal and C++ fairly well, not very good like a professional programmer, but just to tell you how good I am, I've coded several programs for numerical integration using trapezoidal method, Simpson's rule, midpoint rule and Gaussian quadrature rule.
    So my main question is, how far I could go forward doing amateur research in numerical analysis? I've seen that when I try to do arithmetic on large numbers things go wrong and with my limited knowledge of CS I guess a buffer overflow happens. So I guess I need to know some professional programming to be able to get some fascinating results. For example can I approximate pi up to 1000 decimals on a PC? Can I approximate e up to 1000 decimals? Things like that.

    I feel I have very little information about the subject, that's why I can't explain myself very well, but I think I've somehow tried my best to tell you what my intention is, I leave the rest up to the reader that helps me what I should do. My goal is to do amateur research in numerical methods of computing math. operators by computer. What things do I need to know? What limits will I face? etc. Thanks in advance.
  2. jcsd
  3. Jun 14, 2012 #2
    Arbitrary Precision Arithmetic is what you need. Here you have a package for C++ since you know how to program on C++. http://www.apfloat.org/apfloat/

    you can do more research on your own, the term is "arbitrary precision arithmetic". That's what Mathematica and other programs use I guess.

    Here's a citation of what the website says:
    EDIT: Perhaps you would like this one too: http://gmplib.org/
    Last edited: Jun 14, 2012
  4. Jun 14, 2012 #3
    Have a look at the Wiki entry for Arbitrary Precision Arithmetic http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic

    I use Mathcad as a general purpose mathematical tool and make use of its symbolic processor (either Maple or MuPad based, depending upon version) for large numbers.

    There are also some interesting algorithms for generating large numbers, such as the spigot algorithm for pi. In the image below, I show one such implemented in Mathcad. It calculates each digit of pi and stores them in a vector. I then reduce the vector to a string for more convenient display (if you'd be so good as to ignore the missing decimal point between the first '3' and '1', I'd be grateful).

    Attached Files:

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook