MathGroup Archive 2009

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

Search the Archive

Re: Should I be using Mathematica at all?

  • To: mathgroup at
  • Subject: [mg98624] Re: Should I be using Mathematica at all?
  • From: Albert Retey <awnl at>
  • Date: Tue, 14 Apr 2009 06:19:21 -0400 (EDT)
  • References: <gruppj$nk$>

Hi Paul,

> 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?

I don't know what kind of encryption is used for Encode, but I don't
think that that is the weak part of it: since mathematica is a very open
system you need some extra protection to inhibit people from reading
the code by simply typing Information[function] or something alike. The
combination of attributes ReadProtect, Protect, Locked will make this
much more difficult, but still not impossible. You might want to use
some additional protection but that will as usual be a competition with
the one who tries to hack your code which you might or might not win...

As with every code you give away, there is no 100% insurance that people
will not hack it. If the winnings are high enough there will be a good
chance that someone will hack it.

If you use encryption with the above attributes I think it will
definitely need some criminal effort and nontrivial knowhow to hack it
and probably be about as save as delivering compiled code (from whatever
compilable language that was generated...)

Since Mathematica knowhow is much less spread than hacking in general, I
would guess that it would probably be done by hacking the decryption
that mathematica does when reading the package (at some stage it will
probably have the unencrypted code in memory) and can be studied from
anyone running a copy on their machines.

> 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.

that is really a drawback which of course only WRI can change. I also
think that a network license mechanism would be adequate for Player
_Pro_ to be fit for rollout in a _Pro_-fessional environment.

> 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 think the crucial question is whether or not any symbolic code needs
to run in the delivered code. If yes, you will have a hard time to
replace mathematica and probably won't have an option. If what you do is
numeric only, it is just a matter of how much work you can spend in the
recoding. Concerning speed I would guess that any reasonable written
C/C++ code that implements the same algorithm should rather be faster
than slower than the corresponding mathematica code -- it might just
take much longer to write it...

> 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?

there are plenty of libraries for various languages that let you do
graphics output. Depending on what you do you might need more than one
library, learn each of them and find out under which conditions you can
build a commercial application on them. Much work, but certainly
possible. What you could consider is to write the pure algorithms in
C/C++ (or Java or C#) which would probably solve some concerns with IP.
Then you could use rather weakly protected mathematica code to just do
the visualization and include the compiled code via MathLink, JLink or
NETLink. This shouldn't be too much effort but would need to ensure that
this is still supported with the current version of Player Pro. I think
it was allowed to at least use JLink and NETLink with Player Pro 6.0.

> If anyone out there has experience of preparing Mathematica code for sale
> using PlayerPro, are there any pitfalls I should know about?

yes I have, and the pitfalls are exactly the ones you have mentioned...



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