#### Maxima Primer

Full documentationis available.
• Assignment
• variable assignment a:3 returns Result
• function definition f(x):=x+2;f(8) gives Result
• function definition with a variable number of arguments. Here two are required and the rest are put in a list. f(a,b,[x]):=[a,b,x];f(1,2,3,4,5,6) gives Result
• array assignment jim[1]:7; returns Result
• array assignment jim[bob]:8; produces Result
• define a function with right side preevaluated define(f(x),diff(cos(x),x));f(x) produces Result
This is equivalent to f(x):=-sin(x)
• Lists
• a list bil:[9,10,23] gives Result
• referencing bil[1] gives Result
• appending joe:append([1,2],[7,8,9]); returns Result
• get the length length(joe) evaluates to Result
• modifying joe[2]:15; joe gives Result
• Matrices
• a matrix is entered as a list of rows a: matrix([x^2,x+1],[1,x+2]) evaluates to Result
• multiplication is using`.', a.matrix([1],[2]) yields Result
• select a column Col(a,1) produces Result
• select a row Row(a,2) produces Result
• select the first row second column entry a[1,2] produces Result
• Matrix exponents use ^^ instead of just ^ratsimp((a^^2).a^^-1) should just give A back: Result.
• Note that if you had just done (a^^2).a^^-1 gives Result
you might not have recognized the result, because no rational simplification was done. Ratsimp stands for rational simplification.
• Some other handy functions are COPYMATRIX, TRANSPOSE, ECHELON, INVERT, CHARPOLY, EIGENVALUES, DETERMINANT .
• Iteration
• for iterates over a range s:0;for i:1 thru 7 do (s:s+x^i);s yields Result
• iterates in a list for u in [1,7,9] do (u:u^2,print("hello",u)); returns Result
• iterates with a step for i:1 thru 7 step 2 do(print(i)) gives Result
• iterates with while i:2; while (i < 10) do (print(i), i:i+3); gives Result
• do a sum sum(x^i,i,0,5) evaluates to Result
• create a list create_list(x^i,i,0,5) produces Result
• create a list from a list create_list(x^i,i,[2,7,9]) returns Result
• iterate several times create_list(x^i+y^j,i,[1,2,3],j,[3,4,5]) produces Result
• Local variables
• The following will side effect a f(x):=(a:x,a:a/4,a);[f(8),a]; produces Result
• keep value of a private f(x):=block([a:x^2],a:a/4,a);[f(23),a] yields Result
• you may keep several variables private block([a:7,b,c],b:a^2,c:a^3,a+b+c) gives Result
• We repeat killing the value of a that was left by the first line kill(a);f(x):=block([a:x^2],a:a/4,a);[f(23),a] yields Result
• the block does not protect arrays block([jim],jim[7]:8);jim[7] returns Result
• You must use local kill(jim);block(local(jim),jim[7]:8);jim[7] produces Result
• Substitution
• substitute for variables sublis([a=3,b=7],a^2+b^2+c^2) yields Result
• substitute for a subexpression subst(a,sqrt(x),1/sqrt(x)) evaluates to Result
• evaluate ev(x^3,x=3) yields Result
• Simplification
• Sometimes you need to simplify f:diff(integrate(1/(1+x^3),x),x) evaluates to Result
• you can use ratsimp to do rational simplification ratsimp(f) produces Result
• Plotting
• simple 2d plot of a list of functions plot2d([sin(x),cos(x)],[x,-2,20]);
• A plot specifying ranges plot2d([8*sin(2*x)/(1+(x^2)/2)],[x,-3,3],[y,-10,10]);
• using create_list you can create almost any data set and then
modify the plot behavior by adding extra info for openplot. block([numer:true,pts,extra], pts:create_list([i,i^2],i,-3,4), extra:["{bargraph .8}","{ylabel Production}"], openplot_curves([append(extra,pts)]))
• pts:create_list(.05*i,i,-20,100);numer:true; openplot_curves([["{pointsize 3}"],create_list([p,sin(p)],p,pts), create_list([p,cos(p)],p,pts)]);
• a more complex example: openplot_curves([["{plotpoints 1}", " {xrange -2 6} " , "{linecolors {red orange black}}", "{xfun {sin(x);cos(x)}}"], [1,2,3,4,5,6], [0,2,1,7,2,6]]);
• Group theory
• Compute the size of a group G with given relations, Todd_Coxeter([x.x,y.y,(x.y)^^3]) produces Result
• Compute the index of a subgroup in the above group G. The generators for the subgroup are passed as the second argument, and the relations of the group are passed in as the first. Todd_Coxeter([x.x,y.y,(x.y)^^3],[x]) evaluates to Result

Other help is available for maxima.