Maxima in the browser using Embedded Common Lisp on WASM
maxima-on-wasm.pages.dev
maxima-on-wasm.pages.dev
:lisp (+ 2 2)
solve(f(x)^2-1,x);
integrate(x^2,x);
2^1024;
factor(30!);
a:1
b:2
a+b;
sqrt(a^2+b^2);
expr: log((x+2)*(x-2))+log(x);
ratsimp(expr);
fullratsimp(expr);
trigsimp(2*cos(x)^2 + sin(x)^2);
solve(x^3=1,x);
diff(sin(x), x);
float([%e,%pi,%phi,%gamma]);
f(x):=x^2;
f(10);
taylor(sin(x),x,0,5);
plot2d(x^2-x+3,[x,-10,10]);
plot2d([x^2, x^3, x^4 -x +1] ,[x,-10,10]);
f(x,y):= sin(x) + cos(y);
plot3d(f(x,y), [x,-5,5], [y,-5,5]);Note `plot3d(...);` doesn't seem to work: the output image is missing/broken.
Also, if f(x,y) is "broken" (e.g. by a typo like syn instead of sin) then the effect is the same.
??something; to get the internal help. So say I want to know how to solve ODEs in maxima, do
??ode; …and you’ll get help. It generally does a search and presents a numbered list of options and you’ll want to type a number and a semicolon.
1)solve to solve a system and “variable: expression” will assign that expression to that variable. You can then substitute the results into a later expression using a “,”. So you might do
solns:solve([x+3*y=5,5*x-2*y=4],[x,y]);
z:%e^(x,y),solns;
That will solve the system and then substitute those solutions into the expression for z.2)pi, e, and the imaginary unit are called %pi, %e and %i respectively.
3)The symbolic solver is a lot less powerful than mathematica but you can do
load(“to_poly_solve”);
To get a polynomial solver that will at least get you all the roots of polynomials and does better on most trigonometric equations. load(“drawdf”);
Is useful for drawing vector fields, phase portraits and that type of thing.4) you can use a single quote to delay evaluation of something. Like say you want to write a differential equation and you don’t want it to actually try to evaluate the derivative inline, you can write something like
osc:‘diff(x,t,2) + r*’diff(x,t) + k*x = p*cos(omega\*t);
…for a forced harmonic oscilator. Or whatever. This is useful if you want to mess with the expression a bit before you try to solve the expression (eg doing substitutions or whatnot).*I just think it's kinda sad that a lot of people never heard of maxima, as it is a pretty decent tool once you learn how to use it.
That sounds stupid. What if someone doesn't have a laptop? Even if do, cannot see why one's obligated to bring it along.
>in contrast to this implementation it was truly awful
It surely has the advantage of interactivity. The version you linked seems to restart the session in every query. On the other hand, seems more stable. Both `invert(matrix([2,3,1], [a,0,0], [1,4,8]));` and `draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1));` that run fine in UFV's DMa version fail to run in the submitted one.
Where I live, the school issues laptops to students, so not bringing the laptop is today's not bringing your textbook. (As a point of fact, my daughter is in 10th grade and has had exactly one physical textbook so far; the rest have been digital)
Perhaps it could be combined with J (array language), like in the playground https://code.jsoftware.com/wiki/Playground that is using webassembly
It seems to work very well locally without connection to the web.
Of course, another approach would be to use the new wasm GC interface. But that requires defining a new ABI for garbage collected C, writing a new backend for LLVM, etc. So that would also be a lot of work to implement. Right now, there just is no efficient way to run programs that depend on bdwgc on wasm.
* [Maxima on Android](https://play.google.com/store/apps/details?id=jp.yhonda), built with ECL.
* [Maxima on Jupyter](https://github.com/robert-dodier/maxima-jupyter)
* Maxima can be used via [SageMath](https://www.sagemath.org/) and [KDE Cantor](https://apps.kde.org/cantor/).
* Of course, with Emacs: [maxima-mode](https://gitlab.com/sasanidas/maxima) ([screenshot](https://community.linuxmint.com/img/screenshots/maxima-emacs...))
and [maxima-interface](https://github.com/jmbr/maxima-interface) to ease the interface between Maxima and Common Lisp.
* it can be used [from a Lisp REPL](https://mahmoodsheikh36.github.io/post/20230510181916-maxima...).
(and [wxMaxima](https://wxmaxima-developers.github.io/wxmaxima/): a graphical frontend as mentioned earlier)
(find the links and more scientific libraries for CL on https://github.com/CodyReichert/awesome-cl)
Been looking for a self-hosted alternative to Wolfram Alpha, and just stumbled over Mathics, which has a Django front-end[1]. Rough but usable Mathematica alternative, at least for basic use.
All of this is a little new and wobbly, but I expect things to stabilize in a month or so. (And sooner or better if more people get involved).
Mathematica and Sympy also seem to follow this organization.
My take: I blame compatibility on the NIST Digital Library of Mathematical Functions.
(I've tried looking at the doc, and it's clearly not a feature they showcase, and as others have said, the way it works is not intuitive to me. I really need this, but trying to do it in lisp is becoming its own project and I want to get back to my project. I found some really nice online reducers, but the UIs are not conducive to pasting/putting in simultaneous equations, and using those outputs as inputs again)
load(logic);
logic_simp (a or (b or false or (a or b)));
characteristic_vector (a xor b);
zhegalkin_form ((a implies b) or c);
e : ((a or b) xor c) and d$
logic_equiv (e, zhegalkin_form (e));
logic_diff (a or b or c, a);
demorgan (boolean_form (a nor b nor c));
etc. there's more stuff in docsBut it is possible that it's already fast enough for the purposes here, and this doesn't matter.
I'm experimenting with WASI and the GC extension for WASM, but that's months from today if we speak about complete port (given my time capacity at the moment).
WasmGC would be the best solution here, yeah, then the VM handles pointers for you.
Otherwise, I could look into the SpillPointers issue for you if you want - optimizations should not remove GC pointers, so that sounds like a bug. If so feel free to file an issue with a testcase. (But WasmGC would be best, avoiding all that.)
Relevant links: https://gitlab.com/embeddable-common-lisp/ecl/-/merge_reques... https://github.com/ivmai/bdwgc/issues/650
Most notably an entry in the INSTALL file:
``` the optimization level -O0 is used because higher optimization levels seem to interfere with the binaryen options needed to get the garbage collector to work correctly and tend slow down the program (might be worth experimenting with the optimization options) ```
Feature request: A way to easily copy old expressions into the current input field (to fix mistakes).
I always thought TCO was part of the spec itself.
> While this has resulted in some incompatibilities between Macsyma and Maxima, programs written in the Macsyma algebraic language can often be run, with only minor changes, in either system.
Symbolic tensor manipulation is still supported https://maxima-on-wasm.pages.dev/doc/html/Package-itensor#Pa...