From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@inria.fr
Subject: Interactive technical computing
Date: Thu, 8 Mar 2007 01:13:22 +0000 [thread overview]
Message-ID: <200703080113.22721.jon@ffconsultancy.com> (raw)
Being a user of both OCaml and Mathematica, playing with the new F# language
from Microsoft and watching tutorial videos about VPython:
http://showmedo.com/videos/series?name=pythonThompsonVPythonSeries
has given me a lot of inspiration about interactive technical computing
environments. This class of applications is hugely useful for working
scientists and engineers because it lets you slice and dice your data in
interesting ways whilst also giving you visual throwback and even letting you
do some fancy visualisations.
For example, I'm in the process of updating my ray tracer language comparison:
http://www.ffconsultancy.com/languages/ray_tracer/index.html
and I'm using a mix of OCaml (to fire off compilation and execution commands)
and Mathematica (to dissect the results, compute verbosity using regexps and
plot graphs):
http://www.ffconsultancy.com/tmp/mathematica.png
Mathematica's equivalent of the OCaml top-level is called a notebook. It
provides expression input and result output, just like OCaml, but integrates
graphics, adds typesetting and lots of mathematical functions. However, it is
widely used for more general purpose programming despite being very slow.
Using F# from Visual Studio 2005 provides some of this functionality. The
following screenshots illustrate 2D and 3D graphics spawned from an F#
interactive session using a little of my own code and DirectX/ComponentsXtra:
http://www.ffconsultancy.com/tmp/fs_xygraph.png
http://www.ffconsultancy.com/tmp/fs_3dplot.png
For all non-trivials examples in F# it is necessary to spawn a separate thread
to handle the GUI of the visualization, or the GUI will hang when the
top-level is doing an intensive computation.
I think F# has a great future because of its ability to spawn visualizations
from a running interactive session. Expensive commercial offerings like
Matlab and Mathematica are ok when you're doing something they have built-in
(e.g. a Fourier transform) but when you're problem is not trivially
decomposed into their built-in operators (e.g. a wavelet transform), F# and
OCaml are typically 2-5x faster, and when you must resort to more general
purpose programming F# and OCaml are often 100x faster.
However, there is a lot of work to be done in getting competitive charting and
visualization tools into F# and I'm thinking that OCaml could benefit from a
joint venture here. Low-level routines would target DirectX in F# and OpenGL
in OCaml but high-level routines could be language and platform agnostic,
handling a scene graph that is essentially a typed version of Mathematica's
to provide much faster graphics and even interactive visualisation
(Mathematica is software rendered and not interactive!).
This raises several questions:
. What OCaml programs currently allow OpenGL-based visualizations to be
spawned from the top-level?
. Has anyone tried to write an IDE that mixes OCaml code with graphics?
. Would anyone here be interested in a low-cost cross-platform technical
computing environment based upon the OCaml and F# languages?
Obviously I'm interested in this from a commercial perspective. That looks
easy for F# but not so easy for OCaml. Compiled OCaml+OpenGL code is not as
portable (between machines) as F#+DirectX. Also, I can sell F# DLLs and even
make the library available to other .NET languages (albeit with a
significantly less productive API).
Finally, I'd like to note that operator overloading is probably the single
biggest difference between my F# and OCaml code. The ability to apply + and -
to many types, particularly vectors and matrices, makes this kind of work so
much easier. Even if you have to add the odd type annotation. So I'd love to
see a compatible implementation of overloading introduced into OCaml.
I'd like to hear everyone's opinions on this as, it seems to me, we're sitting
on the foundations of a great technical computing system.
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists
next reply other threads:[~2007-03-08 1:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-08 1:13 Jon Harrop [this message]
2007-03-08 1:49 ` [Caml-list] " Jim Miller
2007-03-08 2:52 ` skaller
2007-03-08 3:00 ` Jim Miller
2007-03-08 3:10 ` skaller
[not found] ` <beed19130703071919g1f537f59o93ce06871fba8f3a@mail.gmail.com>
2007-03-08 3:27 ` skaller
2007-03-08 3:36 ` Jim Miller
2007-03-08 21:16 ` Richard Jones
[not found] ` <45F10E90.5000707@laposte.net>
2007-03-09 7:43 ` Matthieu Dubuget
2007-03-10 14:58 ` Richard Jones
2007-03-08 12:22 ` Gerd Stolpmann
2007-03-08 14:24 ` Christophe TROESTLER
2007-03-08 19:34 ` Jon Harrop
2007-03-08 20:34 ` Christophe TROESTLER
2007-03-09 10:22 ` Jon Harrop
2007-03-09 10:45 ` Christophe TROESTLER
2007-03-08 2:12 ` Erik de Castro Lopo
2007-03-08 12:41 ` [Caml-list] F# Jon Harrop
2007-03-08 11:12 ` [Caml-list] Interactive technical computing Andrej Bauer
2007-03-08 11:59 ` Vu Ngoc San
2007-03-08 12:43 ` Jon Harrop
2007-03-08 21:28 ` Vu Ngoc San
2007-03-09 0:14 ` skaller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200703080113.22721.jon@ffconsultancy.com \
--to=jon@ffconsultancy.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox