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

Numerical Integration in VC++

  1. Jan 16, 2009 #1
    I'm doing some numerical integration using C++ with Visual Studio. Are there any free online libraries where I can find routines to help with this? If there are, what is recommended and would be compatible with VC++? I have looked at the GNU library, but from what I understand this only works on Linux. Any advice would be great.
  2. jcsd
  3. Jan 16, 2009 #2
    GSL works perfectly well under Windows; it is, after all, portable code. The first result on a google search for "gnu scientific library" + "visual studio" gives here, for example.

    There are also loads of other relevant libraries. Given that you're developing in C++ I'll assume that you're already familiar with Boost. Why not use that?
  4. Jan 17, 2009 #3
    Thanks, I took a trip to the library and found a lot of what I was looking for in a few books. I have heard a lot about boost, so I downloaded the standard package. I'm not sure how to use it though, becuase I have never used outside libraries before. I tried to read the instructions, but most of it was over my head. Is there a place where I learn the basics of using other libraries in my program.
  5. Jan 19, 2009 #4
    If you've never used an external library in your code you're probably getting a bit ahead of yourself by attempting to use Boost; it's an immensely powerful set of (mainly header) libraries and, as a result, requires a correspondingly large investment of time to understand.

    If you're interested to see how to include external libraries you could do worse than checking out Jeff Cogswell's C++ Cookbook (O'Reilly).
  6. Jan 31, 2009 #5
    Are you integrating a function all the time?
    Is it the same function all the time?

    Or are you integrating data from a plot?

    The NETLIB site might have a routine, but most of the routines posted there are written in FORTRAN. You would either have to f2c the code, or translate it manually.
  7. Jan 31, 2009 #6
    In Visual studio that's equivalent to adding references. You left click your project and add reference. Browse to .dll files and add them. (I have been doing this in c# and I am sure that c++ should be very similar).
    Rest is same as using any other standard library.

    Refer to

    P.S. Using external libraries is really easy and you do not need to know anything about it other than 6-10 lines instructions. Yes, first time can be bit hard.
  8. Feb 3, 2009 #7
    I place all of the following information in the stdafx.h file.

    This is an example linking to Oracle libraries...

    Code (Text):

    #include "C:\Oracle\Ora92\oo4o\CPP\INCLUDE\oracl.h"

    #ifdef _DEBUG
        #pragma comment(lib, "C:\\Oracle\\Ora92\\oo4o\\CPP\\LIB\\DBG\\ORACLM32.lib")
    #else // _DEBUG
        #pragma comment(lib, "C:\\Oracle\\Ora92\\oo4o\\CPP\\LIB\\ORACLM32.lib")
    #endif // _DEBUG
    This is an example linking to OpenGL libraries...

    Code (Text):

    #include <gl\gl.h>
    #include <gl\glu.h>
    #include <gl\glaux.h>

    #pragma comment(lib, "glu32.lib")
    #pragma comment(lib, "glaux.lib")
    #pragma comment(lib, "opengl32.lib")
    Last edited: Feb 3, 2009
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Numerical Integration VC++ Date
Python Numerical integration 'quad' error Jan 29, 2018
Numerical Integration with variable limits MATLAB Jan 15, 2018
Python Integrating to Infinity Numerically Sep 14, 2017
C/++/# How to integrate when one of the limits is a variable? Jun 13, 2017
Numerical methods of integration Nov 2, 2015