Matlab for Lisp programmers?

330 views
Skip to first unread message

CuppoJava

unread,
Sep 11, 2009, 10:43:00 AM9/11/09
to Clojure
Hi guys,
I'm just wondering if there's anybody here that knows of a good Matlab
book to teach the semantics and syntax of the language? The books that
I've run into so far mostly focus on teaching the library and teach
the syntax in an ad-hoc learn-it-as-you-go fashion, which I don't
like. After Clojure, all other syntax seems difficult now.

Thanks a lot
-Patrick

David Cabana

unread,
Sep 11, 2009, 10:59:11 AM9/11/09
to clo...@googlegroups.com
If clean syntax really matters to you, you might want to take a look
at Mathematica. Its syntax is extremely simple and regular, very
lispy. Check out this link:

http://reference.wolfram.com/mathematica/tutorial/EverythingIsAnExpression.html

CuppoJava

unread,
Sep 11, 2009, 11:10:09 AM9/11/09
to Clojure
Hi David,
Thanks for the link. I am interested in Mathematica, but for numerical
matrix crunching, I prefer Matlab. I just don't really get the
peculiarities of the syntax and am hoping there is a book out there
that explains it in a nice clean way.
-Patrick

Max Suica

unread,
Sep 12, 2009, 12:17:52 PM9/12/09
to Clojure
I've been playing with matlab, and I'm liking it... the built in
documentation on the language is actually excellent, and the language
itself is pretty clean if you're used to java/c/algol type languages.
I like especially the built in syntax for matrix and tensor
operations, and the fact that operations corresponding to the various
special syntaxes are just overrideable methods. But yes, from basic
grammar to the fine points of matrix syntax, the built in help desk is
the best place to start research, I think you might be surprised by
how well written and organized things are; the must have spent mad
cash on that.

As for clojure with matlab, you can compile java classes from matlab
and use those in your clojure code, and similarly, java classes can be
interfaced inside m-files. There's a useful tutorial on the first part
which I followed and it was neat to see my clojure code spitting out
1000x1000 magic squares, but I haven't taken it further.

You might look at Octave, which is an open source clone of matlab, but
with nothing like simulink :/ . Still, for pretty involved number
crunching and plotting, Octave can do what matlab can, and its
language is similar (it might try to actually be compatible with m-
files - I'm not sure about this). Anyways, there might be more free
books about octave :)

peh

unread,
Sep 12, 2009, 1:20:32 PM9/12/09
to Clojure
I don't see that anyone has answered your question. I too like Matlab
and I have also used
Mathematica and see the value in both. Matlab though is the superior
platform for numerical
analysis and computation (in my opinion). I think it offers better
features for extensibility
and tons of built in numerical functions plus a great library of
contributed works. Of course,
Mathematica includes symbolic algebra and calculus and this is a $1000
added feature
for Matlab.

I think the best book I have seen for learning how to "program" using
Matlab is:
"An Introduction to Programming and Numerical Methods in MATLAB" by
S. R. Otto and J.P. Denier and published by Springer. A simpler and
more
direct expository that covers more of the MatLab features is
"Essential MATLAB
for Engineers and Scientists", 3rd edition, by Hahn and Valentine,
published
by BH (Elsevier).

And, one book that I do not like and wish that I could sell it for the
money I paid
is the book "Practical MATLAB: Basics for Engineers" by Misza
Kalechman,
published by CRC Press. The layout and approach this book takes to
the
subjects makes it harder to read and use for quick lookup of
information but it
probably fits better as a course text book.

There are also a number of other MATLAB books that are probably pretty
good
but I actually own these and so feel OK about recommending them (or
the
anti-recommendation in that last case).

phil
phy...@mac.com
phil....@gmail.com

Stuart Sierra

unread,
Sep 12, 2009, 2:41:56 PM9/12/09
to Clojure
On Sep 12, 12:17 pm, Max Suica <max.su...@gmail.com> wrote:
> You might look at Octave, which is an open source clone of matlab, but
> with nothing like simulink :/ . Still, for pretty involved number
> crunching and plotting, Octave can do what matlab can, and its
> language is similar (it might try to actually be compatible with m-
> files - I'm not sure about this).

Octave is (mostly) source compatible with Matlab .m files, including
plotting. But it lacks many proprietary extensions, and is not
compatible with any extensions written in C.

-SS

Sean Devlin

unread,
Sep 12, 2009, 2:56:13 PM9/12/09
to Clojure
Ah Matlab... reminds me of school. Culturally, it's the new FORTRAN.

I agree, a good Matlab book is hard to find. I'd look into a couple
things:

1. Find an engineering book on the problem you're studying. They all
include "how to do this in Matlab" nowadays.
2. Google "atlas linear algebra", it's the engine that runs matlab &
octave.
3. There is some stuff with matlab & java interaction. I'm not sure
how mature it is

On Sep 11, 11:10 am, CuppoJava <patrickli_2...@hotmail.com> wrote:

Garth Sheldon-Coulson

unread,
Sep 12, 2009, 4:37:30 PM9/12/09
to clo...@googlegroups.com
Patrick and Phil,

Consider giving Mathematica another look. I wouldn't repeat David's suggestion if there weren't so many reasons to be enamored of it. Mathematica is to Matlab as Clojure is to Fortran. Mathematica is functional and wonderfully expressive. Matlab is basically the opposite. A comparison with which I agree is here:
http://www.helium.com/items/895074-comparing-matlab-and-mathematica

These days Mathematica's numerical routines are just as fast as Matlab's. I believe both packages use LAPACK and BLAS under the hood. If anything, Mathematica will be faster in general because you can use it to do symbolic preprocessing.

Which leads me to a shameless plug: Another reason to use Mathematica is that you can interface it tightly with Clojure =D. http://clojuratica.weebly.com

Garth

sirpi

unread,
Sep 12, 2009, 5:22:17 PM9/12/09
to Clojure

It also should be interesting to create a bridge between clojure and
Maxima.
Transforming clojure expression into maxima expression,

for example the Maxima list ((mlist) 1 2 3 4)) is the clojure list
'(1 2 3 4)


jvt

unread,
Sep 13, 2009, 10:56:17 AM9/13/09
to Clojure
Not true, actually. The latest octaves support c code, if you can
recompile it yourself. It is pretty easy.

CuppoJava

unread,
Sep 13, 2009, 12:44:31 PM9/13/09
to Clojure
Thanks for all the replies.
I'm now really interested in Mathematica. I still need to learn Matlab
(as the rest of my lab uses it, and can't read Mathematica code) so I
think I'll just learn enough to get by, and spend my time learning
Mathematica for myself on the side.

Thanks
-Patrick
Reply all
Reply to author
Forward
0 new messages