Hacker News new | ask | show | jobs
by r85804306610 511 days ago
because nobody knows maxima, some things to try. also plot2d/plot3d work, so that's pretty neat. the whole thing is powered by https://ecl.common-lisp.dev and the op announcement is here https://mailman3.common-lisp.net/hyperkitty/list/ecl-devel@c...

  :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]);
2 comments

One thing I would add for people who are new to this is you can do

??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.

Some other useful things:

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).*
Thank you! As someone with no prior Maxima experience, those were some great starting points for me to learn and explore!

Note `plot3d(...);` doesn't seem to work: the output image is missing/broken.

you probably didn't define the function, f(x,y), which is the line before plot3d. it's a slightly buggy behavior
Ah, yes, can reproduce the problem if f(x,y) isn't defined.

Also, if f(x,y) is "broken" (e.g. by a typo like syn instead of sin) then the effect is the same.

plot3d did work for me (on Chrome). Impressive.