* solve two equations with two unknowns eq1: 1/x + 1/y = 1/1200; eq2: 1.8 * (x / (x + y)) = 0.45; ans : solve([eq1, eq2], [x, y]); *** Note : you could put this into a ".mac" file and then load("junk.mac"); * Normal Distribution f(x) := (1/(sqrt(2*%pi))) * exp(-x^2/2); F(x) := integrate(f(u), u, minf, x); ratsimp(F(x)); F1(x) := (1 + erf(x/sqrt(2)))/2; ratsimp(F(x) - F1(x)); * numer : true; * sinc(x) does not exist here are a few tips sinc(x) := sin(x) / x; sinc(%pi); sinc(%pi/2); limit(sinc(x), x, 0); limit(sinc(x), x, inf); * Online Manual http://maxima.sourceforge.net/docs/manual/maxima_singlepage.html https://flex.phys.tohoku.ac.jp/texi/Maxima%205.38.1%20Manual.htm#SEC7 http://maxima.sourceforge.net/docs/manual/maxima.html * save stuff to file load("f90"); f90_output_line_length_max : 200; with_stdout("crap.txt", f90('Gc=Gc), f90('Gd=Gd) ); * always start with "rmaxima" to get use of arrow keys (new versions of maxima don't have rmaxima, but already have commandline editing support) (it seems like rmaxima is something like rlwrap -c rmaxima) (in any case, rmaxima is no longer needed on new installations of maxima) * useful functions /* numerator */ num(expr); /* denominator */ denom(expr); /* derivative */ diff(f(x), x); /* extremely useful to generally simplify an expression */ factor(expr); ratsimp(expr); subst([var1=expr1, var2=expr2], expr); linel : 200; grind(expr) * ************************************************ * You can cause variable to be "rehashed" with '' * ************************************************ bob : gm1 + gm2; gm1 : 1/Rx; bob --> gm1 + gm2 ''bob 1 --> gm2 + --- R2 * ************************************************ * *********************************** * plot a complex function * *********************************** h(x) := (1 - %e^(-%i*x*4)) / (1 - %e^(-%i*x)); plot2d(cabs(h(x)), [x, 0, 20]); plot2d(carg(h(x)), [x, 0, 20]); * *********************************** * Solve a simple differential equation * *********************************** eq : 'diff(y, t, 1) + 3*y = 0; sol : ode2(eq, y, t); ans : ic1(sol, t=0, y = 6); * *********************************** * define some functions - put in funcdef.mac * *********************************** if (t < -1) then 0 elseif (t < 1) then t elseif (t < 2) then 1 elseif (t < 3) then 3 - t else 0 ); u(t) := block([], if (t < 0) then 0 else 1 ); mkdir wwmax cd wwmax wget http://gregbox.org/funcdef.mac maxima load("funcdef.mac") plot2d(x(t-2), [t, -2, 6], [y, -2, 2], [title, "1 a"]); plot2d(x(-2*t-1), [t, -4, 2], [y, -2, 2], [title, "1 b"]); plot2d((x(t)-x(-t))*u(t), [t, -4, 2], [y, -2, 2], [title, "1 d"]); * *********************************** * Simple flow to run * *********************************** mkdir wwmax cd wwmax maxima plot2d(sin(x), [x, 0, 6.28]); * *********************************** * *********************************** * To get help on something : * *********************************** ? stringout; or ?? stringout; * *********************************** * ************************** * special constants * ************************** %i --> sqrt(-1) %e --> natural log base %pi --> pi * ************************** * *************************** * Useful functions * *************************** realpart(%); imagpart(%); expand (%); ratsimp (%); factor (%); solve([%o6, %o7, %o8], [a, b, c]); trigexpand (%); trigreduce (%); diff (f, x); integrate (f, x); integrate (f, x, 1, inf); quit(); * *************************** * **************************************** * To give the numeric result of something * **************************************** float(x) * **************************************** * **************************************** * For extended numeric precision * (not useful for outputing to other programs) * **************************************** fpprec; fpprec : 100; bfloat(%); * **************************************** * **************************************** * Small example of manipulating equations * **************************************** (x + 1) / (x - 1); %, x=2/z; ratsimp(%); * **************************************** * **************************************** * Basic 2D Plot * **************************************** plot2d(sin(x), [x, 0, 4*%pi]); * ****************************************