Since I’ve been using Maxima (circa 2016), I’ve occasionally missed some little feature from matlab and coded up a replacement for maxima, with a corresponding blog piece here at the Maximalist.
Some examples are find(), diff(), pause(), size(), cumsum(), diag(), and a few list indexing utilities. Also a help() utility that mimics matlab.
Here’s a mac file with all of those in one easy-to-load place: matlabesque.mac
Its help() entry reads like this:
matlabesque.mac contains:
find(exp)
ithruj(L,i,j)
indexby(L,indexlist)
matlab_diff(L)
pause([options])
cumsum(l)
size(M)
diag(M)
-
-
for any of the above functions,
help(function_name) returns help lines for function_name
These look handy! Some small suggestions:
For a variable to be local within a block, you need to write block([var],…). Writing block(var:…) assigns a value to var globally.
You should rarely if ever need to use eval_string/simplode in programming. I suggest you rewrite find by recursing on the structure of the expression, not its string representation.
You don’t need to write sequal(oo,”=”) or sequal(oo,”<") etc. You can instead write member(oo,["=","<", …])
Here's a simpler way to define cumsum:
cumsum(l):=block([sum:0],makelist(sum:sum+i,i,l));
Hope this is useful.
-s
LikeLike
Thanks Stavros! I always learn so much from you 🙂
I’ll make changes based on your excellent suggestions.
LikeLike