Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'Gaussian Quadrature in C using Mathlink' topicStudent Support Forum > General > "Gaussian Quadrature in C using Mathlink"

Next Comment >Help | Reply To Topic
Author Comment/Response
09/02/10 10:56pm


I am attempting to write a gaussian quadrature scheme in C to do integrals numerically. Also, I am using Mathematica's gaussianquadratureweights function which gives you the weights and abcissas for the integral approximation.

In order to use the function "gaussianquadratureweights", one has to first load the package "NumericalDifferentialEquationAnalysis".

[Problem]: The problem is that I can't get mathlink to give me back the right list of weights and abcissas for the above function.

[Code]: In my C code I have defined a function called "gaussquad" which takes in the number of intervals n, xmin value a, and xmax value b for integration of some function , say sin(x) over the interval [a,b]. Also, my gaussquad should return two vectors xi[n] and ci[n] to the main program and these are the abcissas and weights, respectively.

Then, one can simply do a sum, essentially a dot product of the two vectors, in the main program to obtain an approximation to the integral.

I am attaching my C code and also the mathematica file to do gaussian quadrature.

Attachment: gaussquad.c, URL: ,

Subject (listing for 'Gaussian Quadrature in C using Mathlink')
Author Date Posted
Gaussian Quadrature in C using Mathlink Sunny 09/02/10 10:56pm
Re: Gaussian Quadrature in C using Mathlink Sunny 09/04/10 2:44pm
Next Comment >Help | Reply To Topic