Integrating Numerical Methods in VC++: Library Recommendations and Compatibility

In summary: If you have an existing project, you can also just add the necessary include files to your project using the Add Library dialog box (Window > Project > Properties). Alternately, you can search for the library in the Project Search tab of the Project Explorer.If you have an existing project, you can also just add the necessary include files to your project using the Add Library dialog box (Window > Project > Properties). Alternately, you can search for the library in the Project Search tab of the Project Explorer.In summary, there are many free online libraries that can help with numerical integration. The GNU library is a good option, but it only works on Linux. Boost is a powerful set of libraries that is well-suited
  • #1
DukeLuke
94
0
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.
 
Technology news on Phys.org
  • #2
DukeLuke said:
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.

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?
 
  • #3
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?

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.
 
  • #4
DukeLuke said:
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.

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).
 
  • #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.
 
  • #6
DukeLuke said:
Is there a place where I learn the basics of using other libraries in my program.

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
http://msdn.microsoft.com/en-us/library/e6w9eycd(VS.80).aspx

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.
 
  • #7
I place all of the following information in the stdafx.h file.


This is an example linking to Oracle libraries...

Code:
#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:
#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:

1. What is numerical integration?

Numerical integration is a method used to approximate the value of a definite integral by dividing the interval into smaller subintervals and using numerical techniques to calculate the area under the curve.

2. How is numerical integration implemented in VC++?

In VC++, numerical integration is implemented through the use of the integrate() function in the cmath library. This function takes in the integrand, the lower and upper limits of integration, and the desired precision as parameters and returns the approximate value of the integral.

3. What are the advantages of using numerical integration in VC++?

Numerical integration in VC++ allows for accurate and efficient computation of definite integrals that may be difficult or impossible to solve analytically. It also provides flexibility in choosing the level of precision needed for the calculation.

4. Are there any limitations to using numerical integration in VC++?

One limitation of numerical integration in VC++ is that it is only an approximation and may not give the exact value of the integral. Additionally, the accuracy of the result may depend on the chosen precision and the complexity of the integrand.

5. What are some common applications of numerical integration in VC++?

Numerical integration in VC++ is commonly used in various fields such as physics, engineering, and finance to solve problems involving definite integrals. It is often used to calculate areas, volumes, and probabilities in scientific and mathematical models and simulations.

Similar threads

  • Programming and Computer Science
Replies
8
Views
2K
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
7
Views
1K
Replies
2
Views
375
  • Calculus and Beyond Homework Help
Replies
4
Views
703
  • Science and Math Textbooks
Replies
12
Views
924
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
Back
Top