Closed bendudson closed 6 years ago
Hello, I myself can absolutely not tell you if there's a good guide about this out there :] but I can encourage you to write about it, yes, please write about this and about math in CL in general (issue about math: https://github.com/LispCookbook/cl-cookbook/issues/17).
Though, is Maxima not helpful ? algebra system,
system for the manipulation of symbolic and numerical expressions, including differentiation, integration, Taylor series, Laplace transforms, ordinary differential equations, systems of linear equations, polynomials, sets, lists, vectors <--- \o/, matrices and tensors.
Also just stumbled across https://github.com/sjl/vex/ "yet another vector library", not ready but by an awesome CL hacker, to whom you could ask.
Also reddit/r/common_lisp is a good place for this question, you'll get more answers.
and just in case: https://github.com/CodyReichert/awesome-cl#numerical-and-scientific
Thanks very much; I had come across most of those but not vex. I have not tried using Maxima, though it does look quite neat. It appears to be a full DSL, mainly for symbolic manipulation, with a very different syntax to Common Lisp forms. Some posts indicate that using it as a library (combining with other lisp libraries, quicklisp etc) is somewhat clunky, and that it is not optimal for numerical calculations. I will try it out though and see.
At the moment the start of the guide is on using native arrays, with small quicklisp-loadable libraries, then link to the full systems like Maxima. Starting section currently:
Common Lisp has native support for multidimensional arrays, with some special treatment
for 1-D arrays, called vectors
. Arrays can be generalised and contain any type (element-type t
), or they can be specialised to contain specific types such as single-float
or integer
.
There are limitations to the native arrays, in particular
(+ a b)
works when a
and/or b
are arrays. Both of these problems can be solved by using CLOS to define an extended array class, with native arrays as a special case.
Some libraries available through quicklisp
which take this approach are:
Taking this approach further, full DSLs have been built on Common Lisp for treating mathematical objects. At the time of writing the most widely used and supported of these are:
https://www.pvk.ca/Blog/LowLevel/ is one of the lisp numerical masters. Might be worth digging through his works or talking with him.
https://github.com/takagi/avm ?
Efficient and expressive arrayed vector math library with multi-threading and CUDA support in Common Lisp.
I would like to make a start at writing a page on arrays in Common Lisp, aiming at something like this https://docs.julialang.org/en/stable/manual/arrays/ . I am interested in numerical/scientific computing, mainly solving PDEs from plasma physics, but would like to help this project if possible. Topics would include:
Practical Common Lisp has a section on vectors and arrays, but does not go into much detail or cover much of this. I think most of this functionality is provided by libraries rather than the core language.
I am very new to CL, so I plan to write a guide for my own benefit anyway. This is my impression, apologies in advance for errors or omissions:
There seem to be some quite mature libraries like Antik and GSLL, though the manual link here https://www.common-lisp.net/project/antik/index.html is broken, and documentation in general seems to be sparse. The other active(ish) library seems to be matlisp ( https://github.com/matlisp/matlisp ), though I am not sure how well these packages interact.
Several other projects exist, but most seem to be abandoned. Lisplab has a manual (https://common-lisp.net/project/lisplab/) but it's not on quicklisp. Other interesting but abandoned projects include http://quickdocs.org/array-operations/ which is on github (https://github.com/tpapp/array-operations).
A relevant question on SO is: https://stackoverflow.com/questions/4116069/lisp-multidimensional-array-elementwise-operations
Is there a good guide to array operations in CL which I have missed? I understand that technical computing is not a focus for CL, but perhaps putting together a guide for new users would help consolidate the various libraries out there. Any suggestions or starting points welcome.