MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Should I be using Mathematica at all?

  • To: mathgroup at
  • Subject: [mg98629] Re: Should I be using Mathematica at all?
  • From: David Bailey <dave at>
  • Date: Tue, 14 Apr 2009 06:20:15 -0400 (EDT)
  • References: <gruppj$nk$>

Paul Ellsmore wrote:
> Hello again,
> I have had several questions answered by this group, for which I am very
> grateful. Now I have a more general topic, which I know will not have
> single, clear answers.  I just would like to hear your opinions.
> I have some (fairly complicated) legacy Mathematica v5 software which we
> currently use in-house. Our intention is to turn this software into a
> saleable product. At the moment, I am contemplating upgrading to V7, writing
> a GUI for our code (which has no compatibility issues with V7) and
> distributing it using PlayerPro.
> To protect our IP, I will be using Encode to make it impossible for it to be
> reverse engineered. Does anyone know how secure this will actually be? Is it
> more or less secure than a compiled C++ program would be, for instance? Are
> there any particular issues I should be aware of?
> It turns out that there are some serious problems for us using PlayerPro
> (apart from the price!) which are making us reconsider using Mathematica at
> all. Top of the list is the inability of Wolfram to offer a trial license
> for PlayerPro. What this would mean is that we would be losing 100 or so
> every time someone ordered a trial version but did not subsequently buy the
> package, because there is no way for us to get our PlayerPro license back.
> This is not viable. The best Wolfram can offer is to give our prospective
> client a trial version of the full Mathematica package (say for 15 days). As
> a workaround, this is very clunky,  when I requested my trial of V7 it took
> 4 days to get the license. I think that, these days, people expect to go to
> a website, download a trial version and start working with it immediately.
> So, I am considering our options, in particular open source code, such as
> C++, and I'd be interested in your opinions about this. Our V5 code doesn't
> involve any exotic maths, but it makes extensive use of SetDelayed, and
> these definitions are frequently nested within long and complicated Do
> loops. Speed is crucial to our application, so is there any, in principle,
> reason why Mathematica might be able to do things significantly faster than
> a compiled C++ program (assuming the C++ code is written by someone who
> knows what they are doing)? Is there a better language than C++, bearing in
> mind the need to compile (or encode in some way) and distribute the
> resulting code? I know there used to be a compiler for Mathematica once upon
> a time, is there any easy way to get from mathematica code to a compilable
> program. I should stress that we are very happy with Mathematica in terms of
> developing our application, it's just generating anything that we could sell
> that is problematical.
> I have some experience of writing VB, Visual C and similar applications, but
> these never had a large graphical content. Our code will require a lot of
> plotting of data (2D only, but lots of curves which need to be interactive
> in some sense). Mathematica can do everything we want in this respect, but I
> am less sure about the open source code. I am sure there are add-on
> packages, but never having used them I don't know whether they can match
> Mathematica's built in abilities,  any comments?
> If anyone out there has experience of preparing Mathematica code for sale
> using PlayerPro, are there any pitfalls I should know about?
> Finally, would anyone care to recommend a consultant(s) who could translate
> our Mathematica code into C++?
> I know this is a bit of a vague set of questions, but I'll be happy with
> vague answers too!
> Cheers,

Clearly, since Mathematica is itself written in C+Mathematica, it is 
always possible in principle to rewrite code in C and gain performance 
(often substantial), so what you need to consider is:

a)   Whether your code uses a feature of Mathematica that requires a lot 
of work to reproduce in C - e.g. symbolic calculations, extended 
precision, fancy graphics etc.

b)   Whether you can afford the time and effort to debug the C code. 
Java might be a better choice, because at least it is not subject to 
subtle memory overwriting bugs.

If you stay with Mathematica, you might want to use my Super Widget 
Package to create a Java GUI (it is available free from my website) - 
which is much easier than using GUIKit (IMHO) - though writing a GUI in 
Java, and calling it via J/Link is also a good solution.

Another approach might be to deliver your solution using Web Mathematica 
(which might offer greater protection for your IP because your code 
would not run on the client's PC) - however, I have never used Web 
Mathematica, so others can advise you in detail.

PlayerPro worked well for me, but I did not explore it exhaustively. It 
requires extra packages to be encoded (to avoid exposing the entire 
functionality of Matheamatica!), but you will be doing that anyway.

David Bailey

  • Prev by Date: Re: Should I be using Mathematica at all?
  • Next by Date: Re: How to find current ViewAngle, ViewPoint during Rotating graphics?
  • Previous by thread: Re: Re: Should I be using Mathematica at all?
  • Next by thread: Re: Should I be using Mathematica at all?