Re: Linking with C++
- To: mathgroup at smc.vnet.net
- Subject: [mg23614] Re: [mg23570] Linking with C++
- From: Preston Nichols <pnichols at wittenberg.edu>
- Date: Wed, 24 May 2000 02:16:15 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
At 05:44 PM 05/20/2000 -0400, Mike Chesterman wrote: >Hi, > I want to construct a mini package for Mathematica which involves >defining new types of objects and functions of these objects , (to be >specific 2D conformal fields in physics). Anyhow, I've only used >Mathematica once 5 years ago and I need to know: > >1) Can you define new types of objects, relations between them and >functions of them purely in Mathematica? >2) If not is it possible to interface between Mathematica and >C++, whereby the C++ bit can return expressions as well as numbers? > >Any advice welcome > >Mike C. > The answer to question 1 is YES. Mathematica's pattern-matching system makes it possible to define "operations" (or "transformation rules", or "functions") for any well-formed Mathematica expression. Section 2.1.2 of the Mathematica Book describes the basic idea (very tersely), and there are a few more clues at the end of section 2.4.10. Some excellent, detailed examples may be found in a book called Mastering Mathematica by John W. Gray, in Part III of which is impressively titled "Mastering Knowledge Representation in Mathematica". Preston Nichols Mathematics and Computer Science Wittenberg University P.S. The answer to question 2 is also YES, via MathLink.