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: ,