mathlink

*To*: mathgroup at yoda.physics.unc.edu*Subject*: mathlink*From*: Robert Singleton <bobs at thnext.mit.edu>*Date*: Wed, 24 Mar 93 10:57:17 -0500

Hello mathgroup, I have a problem that I know can be solved with MathLink - but I haven't been able to figure out how from just the Mathematica book. Here is my problem. Since Mathemaica is so lousy at 2 Dim numerical integrals (i.e. it typically takes too long for anything but the simplest functions) I want to use a nice montecarlo C program called Vegas. I want to call vegas from WITHIN mathematica and have it integrate a functions that I've defined within Mathematica. Vegas is sort of long and so the user communicates to it with a subroutine called 'vegas', which passes the function to be integrated and returns the answer along with the sd and ch^2. There are control parameters, like the accuracy, integration limits and such that are specified by global variables. My question: how do I call the subroutine vegas from within Mma? I would eventually like to make a package that calls vegas and use this when I do 2 Dim integrals. Why is the 2D integration in Mma so BAD?!? I timed it last night and Vegas works about 100 times faster!?! Any way. thank very much. Regards, bob singleton bobs at thnext.mit.edu