Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Re: [mg4362] Re: c code generation
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Mark Evans

Posts: 63
Registered: 12/7/04
Re: [mg4362] Re: c code generation
Posted: Jul 19, 1996 3:03 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Ross,

Your reply is a little off-base; we don't really have an argument. You
shouldn't try so hard to dismantle every point in a reply, especially out of
context. There is an old joke about the Bible that runs, "A text out of
context is a pretext."

A long time ago, I posted a very long message echoing all your themes about the
utility of Mathematica as a front end for C. I use C and MathLink all the
time. Maybe the moderator can insert a reference to my old message for you. I
don't have the savvy to find it.

On the other hand, it is a lot easier to type Prime[100000] in Mathematica to
find the 100,00th prime number than it is to write, compile, debug, recompile,
and test any C routine you care to name. Even if the C program has already
gone through the usual paces, it's still easier to type Prime[100000] than to
execute a separate, special-purpose program, MathLink or no. In other words,
Wolfram Research has done all the work for you, why not take advantage of it?
"You always endeavour to use the best tool, or the most convenient set of
tools, for the job at hand" is right.

I use MathLink under two general scenarios. (1) Mathematica can't do what I
need, or its interpreted language is too slow. (2) Mathematica can do what I
need, but I require a stand-alone C routine for some reason, and want to debug
it through MathLink.

So I was making a point about productivity more than anything else. It struck
me at the time that the person asking how to turn Mathematica code into C code
was somewhat missing the point of Mathematica. He clearly fell into case (2),
because he proposed to write the original code in Mathematica. Contrary to
your statement that "Nobody asks it [Mathematica] to [write C code]," that was
exactly the capability the original questioner had in mind. Given that
Mathematica does not write C code, I tried to push him in the right direction.
For general numerics work there is little reason to leave the Mathematica
environment unless compelled to do so by deficiencies in Mathematica itself.


Mark


P.S. I found very interesting the work that a graduate student has done on a
package that converts Mathematica to C. This kind of tool certainly has some
good uses, and maybe even satisfies the original post. I point out, however,
that all the output examples supplied convert procedural Mathematica to
procedural C, and while that much is wonderful, there is no way to convert
shorthand Mathematica (e.g. Prime[100000]) into procedural C. To do that you
would have to build a library of functions identical to those contained within
Mathematica and convert MMA function calls into C function calls on a
one-to-one basis.







Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.