Serving the Quantitative Finance Community

 
User avatar
Geist
Topic Author
Posts: 0
Joined: May 16th, 2003, 10:25 am

Is anyone doing any serious work with Mathematica?

August 12th, 2005, 7:38 pm

I'm wondering whether anyone has implemented an industrial-strength pricing/analytics in Mathematica. By 'industrial-strength' I mean used all day every day for trading or investment decision purposes. It seems that most people out there use Mathematica as a tool to build prototypes and to do symbolic math, but not as the heart of any serious number-crunching or as their main pricing tool.I am in the process of building a reasonably complex analytics tool + pricer in Mathematica (partly because I'm too lazy to code and implement the necessary numerical routines in C++, partly because I actually like Mathematica and partly because it's cross-platform with no porting effort required), but I haven't seen anything similar before. Is the general opinion that Mathematica is too slow/not flexible enough to take over from C-based languages? Or is there some other reason for not using it? I can see a few downsides to using it:-It's cumbersome to build a GUI for Mathematica programs (Java-based stuff is available but from what I've seen it ain't great)-You need Mathematica installed on every workstation-If you don't go for a GUI, the Mathematica front end is far too threatening for the end user-There aren't as many libraries available for it as for some other languages-It's more expensive to deploy than a C-based solutionBut I think the upsides outweigh those:-It's got LOADS of mathematical functions readily implemented-It allows for symbolic math, which is handy for derivatives pricing-It's easy to learn, the documentation is great and so is the support-It's cross-platform-It's easily portable to allow for parallel computing-It doesn't require compiling so it's easy to test bits and pieces of a big program-Wolfram seem to keep the updates coming (sometimes they're great, sometimes they're just ok)What do you guys think about it?
 
User avatar
ZmeiGorynych
Posts: 6
Joined: July 10th, 2005, 11:46 am

Is anyone doing any serious work with Mathematica?

August 13th, 2005, 7:46 am

QuoteOriginally posted by: GeistI'm wondering whether anyone has implemented an industrial-strength pricing/analytics in Mathematica. Well, there's http://www.unriskderivatives.com/product/.QuoteIs the general opinion that Mathematica is too slow/not flexible enough to take over from C-based languages? Or is there some other reason for not using it? I can see a few downsides to using it:1. It's cumbersome to build a GUI for Mathematica programs (Java-based stuff is available but from what I've seen it ain't great)2. You need Mathematica installed on every workstation3. If you don't go for a GUI, the Mathematica front end is far too threatening for the end user4. There aren't as many libraries available for it as for some other languages5. It's more expensive to deploy than a C-based solution2,3: yes, especially with free C++ compilers abounding1,3: well, that's deadly enough4: There are more C++ libraries than Mathematica libraries, I'll bet.Quote1. It's got LOADS of mathematical functions readily implemented2. It allows for symbolic math, which is handy for derivatives pricing3. It's easy to learn, the documentation is great and so is the support4. It's cross-platform5. It's easily portable to allow for parallel computing6. It doesn't require compiling so it's easy to test bits and pieces of a big program7. Wolfram seem to keep the updates coming (sometimes they're great, sometimes they're just ok)1. So do most reasonable libraries. And do you really need Bessel functions in derivatives?2. Why is that handy? The formulas are simple enough, and in cases when they are not you have to solve numerically anyway.3. Well, I hated it when I tried it...4. Who cares? Only clients need to be cross-platform, data crunching doesn't. see DCFC's comments in http://wilmott.com/messageview.cfm?cati ... adid=29967 6: if it's not a compiled language, it's probably slow as all hell. As for testing bits and pieces, ever heard of unit tests?7: True of most environments out there.The strengths of C++ are speed (really primitive language, concepts close to what the computer does) and the support for building big programs by using strictly defined interfaces. And if you want a scripting engine, I think Matlab beats Mathematica
 
User avatar
Geist
Topic Author
Posts: 0
Joined: May 16th, 2003, 10:25 am

Is anyone doing any serious work with Mathematica?

August 13th, 2005, 9:05 am

Quote 4: There are more C++ libraries than Mathematica libraries, I'll bet. Well.. yeah, that's why I put it as a downside of using Mathematica.Quote 1. So do most reasonable libraries. And do you really need Bessel functions in derivatives? Funny you should say that - I'm actually using them in my implementation of a CEV swaption model.Quote 2. Why is that handy? The formulas are simple enough, and in cases when they are not you have to solve numerically anyway. Well, because you can leave some models explicit and that makes them easy to troubleshoot.Quote6: if it's not a compiled language, it's probably slow as all hell No, you can compile stuff in Mathematica as well to speed it up but you don't have to. the numerical routines are actually quite fast. Maybe not as fast as C++, but not dog slow either.I'm not saying that C++ sucks or that you shouldn't use it and use Mathematica instead - I'm just wondering whether there are fundamental reasons for not wanting to use it (preferably without turning this thread into a flame war). Look from your comments above that the less-than-adequate GUI functions are the main reason. I'll give you that, but obviously it's easy to tie Mathematica into Excel so maybe that alleviates the problem a bit... Any other views?Disclaimer: I am in no way affiliated with Wolfram reasearch.
Last edited by Geist on August 12th, 2005, 10:00 pm, edited 1 time in total.
 
User avatar
ZmeiGorynych
Posts: 6
Joined: July 10th, 2005, 11:46 am

Is anyone doing any serious work with Mathematica?

August 13th, 2005, 11:14 am

I think you can hardly beat C++ on speed as it is so close to how the computer views things; doing your own memory allocation etc. is a nuisance, but having the system do it for you, like in Java, imposes a runtime cost. Not vital for every application, I guess. I don't know Mathematica well enough - can it support things like strict typing, inheritance, polymorphism, templates? When building reasonably large systems, these matter. I note that while UnRisk uses Mathematica for frontend, the engine is C++.The trained programmer pool is way larger for C++, which matters for employers, availability of books, etc. - you don't depend on any one firm to provide the docs.I think the niceness of Mathematica as a frontend (as most niceness) is largely in the eye of the beholder - if you already know it, it makes sense to use it; but if you don't know it, the only edge I see over, say, matlab, is symbolic math - and as Mathematica is a whole language in itself, that might not be enough to justify learning it. Did not mean to start a flame war either - sorry if it sounded that way
Last edited by ZmeiGorynych on August 12th, 2005, 10:00 pm, edited 1 time in total.
 
User avatar
saliq
Posts: 0
Joined: April 10th, 2005, 1:55 am

Is anyone doing any serious work with Mathematica?

August 13th, 2005, 2:21 pm

I am Student and agree C++ is best but the standarad C++ not have all liabrary... so i used Mathematica for building fast and reliable mathematical modeling......I know it can be done in C++ but due to the testing and time of each implemented stuf.. it realy bother me to test those mathematical stuf that Mathmatica already built-in. And One more thing the modeling stuf is also very presentable in Mathematica.....
 
User avatar
Witt
Posts: 0
Joined: February 26th, 2004, 4:20 am

Is anyone doing any serious work with Mathematica?

August 14th, 2005, 2:59 am

I think Mathematica is good for fast prototyping, and C++ type of language - for developing end product.
 
User avatar
MattF
Posts: 6
Joined: March 14th, 2003, 7:15 pm

Is anyone doing any serious work with Mathematica?

August 15th, 2005, 2:47 pm

QuoteI'm not saying that C++ sucks or that you shouldn't use it and use Mathematica instead - I'm just wondering whether there are fundamental reasons for not wanting to use it It's extremely undesirable to lock in a dependency on any proprietary closed-source product. You've now lost control of your program as you can't sell it, distribute it freely, or change (even see) the internal workings. That seems a pretty fundamental reason for not using it.
Last edited by MattF on August 14th, 2005, 10:00 pm, edited 1 time in total.
 
User avatar
alexv
Posts: 0
Joined: March 14th, 2005, 9:45 pm

Is anyone doing any serious work with Mathematica?

August 15th, 2005, 4:19 pm

QuoteOriginally posted by: GeistI'm wondering whether anyone has implemented an industrial-strength pricing/analytics in Mathematica. By 'industrial-strength' I mean used all day every day for trading or investment decision purposes. It seems that most people out there use Mathematica as a tool to build prototypes and to do symbolic math, but not as the heart of any serious number-crunching or as their main pricing tool.I used Mathematica to build VAR calculator which is in production now and produces regular reports. See the WRI web site for the users' listhttp://wolfram.com/products/mathematica/usersanduses/institutions.html#instI heard one of them implemented full-blown trading system in Mathematica. There is nothing in Mathematica preventing from using it for building production systems. One must be careful though to keep track of all the exceptions/errors caused by calculations and use packages to modularize the code but that really applies to any other tool as well.QuoteI am in the process of building a reasonably complex analytics tool + pricer in Mathematica (partly because I'm too lazy to code and implement the necessary numerical routines in C++, partly because I actually like Mathematica and partly because it's cross-platform with no porting effort required), but I haven't seen anything similar before. Is the general opinion that Mathematica is too slow/not flexible enough to take over from C-based languages? Or is there some other reason for not using it? It is NOT slow. I don't even mention advanced stuff like special functions/statistics/etc. One must really know what one is doing to even match performance of Mathematica's vector/matrix/tensor operations (used properly) in STL. It is extremely well optimized. As far as flexibility goes, what do you mean by flexibility? Being able to get as close to hardware as possible? Or, say, being able to use higher order functions on the fly without prior definitions and apply them to slices of multidimensional arrays implicitly without using loops? It depends on what a particular developer feels more comfortable with. The latest version (5.2) takes advantage of 64-bit and multicore architectures automatically. There is also gridMathematica to build distributed systems.QuoteI can see a few downsides to using it:-It's cumbersome to build a GUI for Mathematica programs (Java-based stuff is available but from what I've seen it ain't great)-You need Mathematica installed on every workstation-If you don't go for a GUI, the Mathematica front end is far too threatening for the end userIf you don't like Java GUI (I don't), you can use webMathematica to build web-based interface or you can just call Mathematica from any jsp/servlet/etc web container using JavaLink or MathLink or just in batch mode using command line interface. You can use Excel to build VBA/Excel-based interface using ExcelLink for Mathematica. Both approaches do not require installation of Mathematica on users' workstations. Mathematica frontend is not for the end user clearly Quote-There aren't as many libraries available for it as for some other languagesAny library (C, Java, C#) can be used with Mathematica using MathLink, JavaLink, .NetLink. For instance, I use .NetLink to output results to running Excel via OLE.Quote-It's more expensive to deploy than a C-based solutionIt may be (WAY) more expensive in terms of software/licensing costs. But development time will be much shorter. On the other hand if you start factoring in costs of third-party C/C++ libraries (RogueWave etc), the C(++) solution doesn't look that cheap anymore. Of course you can try using opensource tools and libraries exclusively.In my opinion the real (and fundamental) downside of using Mathematica for production systems is (lack of) availability of qualified developers for both initial development and ongoing support/maintenance and this argument alone can outweigh any of the advantages easily.
 
User avatar
Geist
Topic Author
Posts: 0
Joined: May 16th, 2003, 10:25 am

Is anyone doing any serious work with Mathematica?

August 15th, 2005, 7:09 pm

MattF: Yeah, I can see how that would be a problem, but I was thçinking in terms of internal development in an i-bank like development. But obviously if you're an independent developer you would just cut off a huge section of the market if you used Mathematica.Alexv: That's quite an interesting insight. So there seem to be some serious users out there... It seems that it's a great tool if you have limited resources availablle in terms of development time, but that the end product isn't necessarily less capable than a C++ equivalent. However, I'd wish Wolfram somehow made it possible to create stand-alone apps from Mathematica code (no mean feat considering the built-in libraries would somehow have to be included in the app). That and an improved GUI solution would make it almost perfect for my needs...
 
User avatar
Athletico
Posts: 14
Joined: January 7th, 2002, 4:17 pm

Is anyone doing any serious work with Mathematica?

August 15th, 2005, 8:01 pm

> However, I'd wish Wolfram somehow made it possible to create stand-alone apps from Mathematica codeit'd be great if Mathematica offered something like Matlab's COM Builder, which lets you create COM objects from Matlab .m source files.
 
User avatar
exneratunrisk
Posts: 0
Joined: April 20th, 2004, 12:25 pm

Is anyone doing any serious work with Mathematica?

August 16th, 2005, 11:55 am

It took me a while to decide whether I should contribute (obviously biased) or not?my comment (hopefully without promotion for our product). Why did we integrate our numerically optimized C++ engine into Mathematica?1. we thought, that financial instruments can be described in the "Language of Mathematics" (and this is true).2. We wanted to inherit from a large variety of available solvers, visualisation,..... (represented in the LoM) 3. We wanted an open architecture in an document-centered environment (Excel support, ODBC/JDBC support, hybrid language support, web and grid compliance,..)We assessed Mathematica as 1. a very good representation of the LoM (supported by its powerful pattern matching algorithm, functional/logic/...programming paradigms, symbolic computation capabilties,..). Example: we now provide one Valuate function, which has become an extensible interface for a variety of algorithms and polymorphic instruments based on various models.2. a system with a rich base of mathematical knowledge and solvers.3. an open architecture based on the powerful MathLink protocol. Example: we have provided customized solutions where Java calls Mathematica calls C++ (our engine) and vice versa. (Coarse grain) Parallelism? Symbolically, implemented in a few lines of code.We really like hybrid programming and system development. Given a problem, searched for the right decomposition and programming paradigm (data-oriented? functional? logic? object-oriended?). And we like the Mathematica front-end (especially, when we get the inquiry: "can you build me this?") And we are not alone:I think, Niels integrated QuantLib into Mathematica?
Last edited by exneratunrisk on August 15th, 2005, 10:00 pm, edited 1 time in total.
 
User avatar
Geist
Topic Author
Posts: 0
Joined: May 16th, 2003, 10:25 am

Is anyone doing any serious work with Mathematica?

August 16th, 2005, 5:10 pm

Exneratunrisk: Do your clients generally have a Mathematica-based solution already which they need to augment with Unrisk's financial functions or do you market Unrisk as a stand-alone product which just happens to need Mathematica? In the latter case, how do people feel being tied to Mathematica? I'm just trying to assess whether (Mathematica + Unrisk) as a product is aimed to replace a custom C++-based solution...
 
User avatar
exneratunrisk
Posts: 0
Joined: April 20th, 2004, 12:25 pm

Is anyone doing any serious work with Mathematica?

August 17th, 2005, 5:57 am

QuoteOriginally posted by: GeistExneratunrisk: Do your clients generally have a Mathematica-based solution already which they need to augment with Unrisk's financial functions or do you market Unrisk as a stand-alone product which just happens to need Mathematica? In the latter case, how do people feel being tied to Mathematica? I'm just trying to assess whether (Mathematica + Unrisk) as a product is aimed to replace a custom C++-based solution...The Excel front-end user (the majority: traders, treasurers, price/risk controllers) do not even "see" Mathematica. For them it is an operating system (forgive me Stephen), which they need to have or buy to run UnRisk. Quants work/develop in the Mathematica front-end (had already ore moved into Mathematica). Both valuate based on the same engine, which eases collaboration between them and for quants the engine and Mathematica might make the difference.If you need further info, please e-mail to Herbert