zoukankan      html  css  js  c++  java
  • Maxima Overview:


    Maxima Overview

    by Burkhard Bunk 
    19.3.2013 
    Maxima version: 5.21.1 
    wxMaxima version: 0.8.5

    Documentation

    /usr/share/doc/maxima-doc/html/intromax.html    introduction
    /usr/share/doc/maxima-doc/html/maxima_toc.html  full help
    

    Invocation, Help

    Text mode:
          unix> maxima
          interrupt a maxima calculation with
                <CTRL>-G
          terminate maxima with
                quit();
    
    GUI:
          unix> xmaxima
          unix> wxmaxima
    
    Help:
          GUI ->Help
          descripe(string);
          ? string;               /* note the space after "?" */
    
    A perfect way to restart maxima does not exist (see mailing list), use
          reset();
          kill(all);
    

    Commands and Expressions

    Terminate commands with ";" or "$" (quiet mode).
    
    command prompts:  (%i1)  (%i2)  ..
    output labels:    (%o1)  (%o2)  ..
    
    Previous result:              %
    Former output, e.g. (%o5):    %o5
    Redo command, e.g. (%i5) :    ''%i5;
    
    Operators:              + - * / ^ **  ( )  ! !!
    Comparison:             = # > < >= <=           /* "#" is "not equal" */
    Logical:                and or not
    
    Text strings are written as "text".
    

    Names

    Names consist of letters, digits, % (percent) and _ (underscore). Letters are case sensitive, but predefined names are mapped to upper case. Special characters (other than "%" and "_") are allowed after declaring them alphabetic as in
          declare("$", alphabetic);
    
    Pre-defined constants:
          %i %pi %e true false
          %gamma      Euler's constant
          %phi        (1 + sqrt(5))/2
          inf         real infinity
          minf        real (-infinity)
          infinity    complex infinity
    
    Pre-defined functions:
          sqrt  log  exp
          sin ..  asin ..
          sinh ..  asinh ..
          gamma
          zeta
          binomial
          mod  floor
          ..
    
    Reserved names:
          integrate   next        from        diff            
          in          at          limit       sum             
          for         and         elseif      then            
          else        do          or          if
          unless      product     while       thru            
          step                                                                     
    
    Manage user-defined variables:
          values                  list of all user defined variables
          remvalue(var);          delete the value of var
          remvalue(all);          delete the values of all variables
    

    Assignment

    Assignment: :     (without "="!)
                ::    ??
                :=    defines a function
                ::=   defines a macro
    
    Unassign names:
          kill(name1, name2, ..);
          kill(all);
    
          xmaxima:    ->File ->Restart
          wxMaxima:   ->Maxima ->Restart maxima
    

    Lists

          lst: [el1, el2, ...];         contruct list explicitly
          lst[2];                       reference to element by index
                                              (starting from 1)
    
          cons(expr, alist);            prepend expr to alist
          endcons(expr, alist);         append expr to alist
          append(list1, list2, ..);     merge lists
          makelist(expr, i, i1, i2);    create list with control variable i
          makelist(expr, x, xlist);     create list with x from another list     
    
          length(alist);                returns #elements
    
          map(fct, list);               evaluate a function of one argument
          map(fct, list1, list2);       evaluate a function of two arguments
    

    Evaluation

    - automatic

    Many expressions are evaluated automatically: before the are processed, substitutions and obvious simplifications are preformed.

    - explicit

    Sometimes, this should be prevented (e.g. when defining a differential equation), in other cases, an extra evaluation is required (e.g. after changing an item in an expression):
          'expr              don't evalute
          ''expr             do evaluate
    e.g.
          a: b+c;
                c + b
          b:5$
          a;
                c + b
          ''a;
                c + 5
          'b + c;
                c + b
    
    Evalutate variables, based on equations:
          at(expr, var=ex);
          at(expr, [var1=ex1, var2=ex2, ..]);
    
    e.g.  at(diff(sin(x), x), x=%pi);
                -1      
    
    Evaluate with additional settings/flags:
          ev(expr, arg1, arg2...);
          expr, arg1, arg2, ...;        same in short
                args: numer
                      float
                      bfloat
                      simpsum
                      eval
                      ...
    
    Many of the evalutation switches (e.g. numer, simpsum) are actually flags, which are false by default, but can be enabled for subsequent use.

    - numerical

    Numerical evaluation is triggered by decimal numbers in expressions, but note that a dot alone doesn't make it: sqrt(2.) is not evaluated, but sqrt(2.0) is.
          float(expr);                  evaluate to floating point number
          expr, numer;                  return numerical result
          numer: true;                  numerical evaluation on (default: false)
    
          fpprec: digits;               precision of big floats (default: 16)
          fpprintprec: digits;          no. of printed digits
          bfloat(expr);                 evaluate to big float
    
    example:
          fpprec: 30;
          sin(%pi);                     => 0
          sin(float(%pi));              => 1.2246063538223773E-16
          sin(bfloat(%pi));             => 1.69568553207377992879174029388B-31
    
    Note: WxMaxima, with output format set to xml, diplays long numbers with a shortcut - compare the output of
          bfloat(%pi), fpprec:1000;
    

    Substitution

    Functions which perform substitution, with increasing level of sophistication:
          subst(..)         syntactic, symbols and complete sub-expressions only
          ratsubst(..)      similar, but employs some algebra
          at(..)            evaluation, based on equations
          ev(..)            evaluation, with equations, flags etc.
    
    subst(..) and ratsubst(..) in more detail:
          subst(ex, var, expr);         substitute ex for var in expr
          subst(var=ex, expr);          same
          subst([var1=ex1, var2=ex2,..], expr);     multiple substitutions
    
          ratsubst(ex, var, expr);      substitute ex for var in expr
    
          subst(s, a+b, a+b+c);
                c + b + a
          ratsubst(s, a+b, a+b+c);
                s + c
          subst(1-cos(x)^2, sin(x)^2, sin(x)^4 - 5*sin(x)^2);  
                   4                2
                sin (x) - 5 (1 - cos (x))
          ratsubst(1-cos(x)^2, sin(x)^2, sin(x)^4 - 5*sin(x)^2);  
                   4           2
                cos (x) + 3 cos (x) - 4
    

    Functions

    Function definition, general form:
          define(f(x), expr);
          define(f(x,y), expr);         /* etc */
    
    simple form: e.g.
          func(x) := sin(x)/x;
          radius(x,y) := sqrt(x^2 + y^2);
    
    More complicated function definitions can be formulated with the block(..) construct.

    Simplification

    Polynomials

          factor(expr);           factorise polynomials (over integers only)
          expand(expr);           expand polynomials
          ratexpand(expr);        same (more efficient algorithm)
    
          expandwrt(expr, x, ..); expand w.r.t. specified variables
          coeff(expr, x, n);      coefficient of x^n in expr
          ratcoef(expr, x, n);    same, but simplifies expr first
    
          divide(pol1, pol2);     polynomial devision (with remainder)
          quotient(pol1, pol2);   quotient of polynomial devision
          remainder(pol1, pol2);  remainder of polynomial division
    
          realroots(pol, tol);    numerical approx. to all real roots
          realroots(pol);         tol = rootsepsilon (default: 1e-7)
          allroots(pol);          numerical approx. to all complex roots
    

    Rational functions

          ratsimp(expr);          put on common denominator,
                                        cancel factors,
                                        expand numerator and denominator
          fullratsimp(expr);      repeated application of `ratsimp'
    
          factor(expr);           same as `ratsimp', but returns numerator and
                                        denominator in factored form         
    
          expand(expr);           expand numerator and denominator, split numerator
                                        (no common denominator)
          ratexpand(expr);        put on common denominator,
                                        cancel factors,
                                        expand numerator and denominator,
                                        split numerator
          ratdenomdivide: false;  don't split numerator (same as ratsimp?)
    
          facsum(expr, var, ..)   expand w.r.t. specified variables
          facsum_combine: false;  split numerator
    
          partfrac(expr, var);    partial fraction decomposition
    
    examples:
          ratsimp(a/b + c/d);
                a d + b c
                ---------
                   b d
    
          (x-1)/(x+1)^2 - 1/(x-1);
                 x - 1       1
                -------- - -----
                       2   x - 1
                (x + 1)
          ratexpand(%);
                        4 x
                - ---------------
                   3    2
                  x  + x  - x - 1
          factor(%);
                        4 x
                - ----------------
                                 2
                  (x - 1) (x + 1)
    
    
          r: (u+v)^2*u/((u^2-v^2)*v);
                               2
                      u (v + u)
                      -----------
                          2    2
                      v (u  - v )
    
          ratsimp(r);
                        u v + u
                      - --------
                         2
                        v  - u v
    
          factor(r);
                        u (v + u)
                      - ---------
                        v (v - u)
    
          ratexpand(r);
                            2
                           u         u
                      - -------- - -----
                         2         v - u
                        v  - u v
    
          s: a*b/(c*d+c*e) + f*b/(c*d+c*e);
                         b f         a b
                      --------- + ---------
                      c e + c d   c e + c d
          factor(s);
                      b (f + a)
                      ---------
                      c (e + d)
          ratsimp(s);
                      b f + a b
                      ---------
                      c e + c d
    
    Notes: 
    the following appear to be equivalent:
          ratsimp(expr);          and   ratexpand(expr), ratdenomdivide: false;
          ratsimp(expr), factor;  and   factor(expr);
    
    but factor(expr) does not understand algebraic!

    Summary: simplify rational functions with ratsimp(expr), possibly combined with factor and/or algebraic. Use ratexpand(expr), possibly with algebraic, if you prefer to split the numerator.

    Roots

          rootscontract(expr);                products of roots -> roots of products
          ratsimp(expr), algebraic;           rationalise denominators
    
          radcan(expr);                       canonical form, involving roots, logs,
          radcan(expr), algebraic;                   and exponentials
    
    examples:
          ex: 1/(sqrt(a)+sqrt(b));
                        1
                -----------------
                sqrt(b) + sqrt(a)
          ratsimp(ex), algebraic;
                sqrt(b) - sqrt(a)
                -----------------
                      b - a
    
          sqrt(x^2);
                abs(x)
          sqrt(x^2), radexpand:all;
                x
          
    
    In some cases, sqrtdenest can disentangle nested square roots:
          load(sqdnst);
          sqrtdenest(expr);
    e.g.
          sqrt(sqrt(7)+ 4);
                sqrt(sqrt(7) + 4)
          sqrtdenest(%);
                sqrt(7)      1
                ------- + -------
                sqrt(2)   sqrt(2)
          factor(%);
                sqrt(7) + 1
                -----------
                  sqrt(2)
    

    Logarithms

          logexpand:all;                enables automatic expansion of products
    
          logcontract(expr);            contracts sums of logs to logs of products
                                              and _integer_ multiples of logs to
                                              logs of powers
    
          radcan(expr);                 canonical form, involving roots, logs,
          radcan(expr), algebraic;             and exponentials
    
    examples:
          log(a^b);
                log(a) b
    
          log(a*b), logexpand:all;
                log(b) + log(a)
    
          logcontract(2*log(a) + 3*log(b));
                     2  3
                log(a  b )
    

    Trigonometric functions

          trigsimp(expr);         use sin(x)^2 + cos(x)^2 = 1 etc
          trigexpand(expr);       use addition theorems etc
          trigreduce(expr);       powers -> multiple arguments
                                  products -> sums
          trigrat(expr);          simplify rational expressions of trigonometric
                                        functions as well as linear arguments
                                        involving %pi/n
          halfangles:true;        replace half angles by roots
    
          exponentialize(expr);   trig/hyperb -> exponentials
          demoivre(expr);         complex exponentials -> trig (not hyperb)
    
          logarc(expr);           arc trig/hyperb -> logarithms
    
    trigexpand is a flag as well (and an evflag), but the other trigX aren't!

    trigsimp(..) in combination with roots is tricky:

          trigsimp(sqrt(sinh(x)^2 + 1));
                cosh(x)
          trigsimp(sqrt(cosh(x)^2 - 1));
                sqrt(cosh(x) - 1) sqrt(cosh(x) + 1)
    
    instead of the expected abs(sinh(x)). It does not work for sin() and cos(x) either. Is this caused by abs(..)
    ?HOW TO

    There is no command to convert real exponentials to hyperbolic functions - use ratsubst(..) instead.

    Examples:

          sin(x/2), halfangles;
                sqrt(1 - cos(x))
                ----------------
                    sqrt(2)
    
    ?HOW TO:
          sin(x) + cos(x) = sqrt(2) * sin(x + %pi/4)
          try exponentialize(...)
    
    ?HOW TO
          ex1: cos(x) + cos(y);
          ex2: 2 * cos((x+y)/2) * cos((x-y)/2);
    ex2 -> ex1:
          trigreduce(ex2), ratsimp;
    or    trigrat(ex2);
    ex1 -> ex2 ??
    
    logarc examples:
          asinh(x), logarc;
                          2
                log(sqrt(x  + 1) + x)
          
          acosh(x), logarc;
                      sqrt(x + 1)   sqrt(x - 1)
                2 log(----------- + -----------)
                        sqrt(2)       sqrt(2)
          %, logcontract, expand, rootscontract;
                          2
                log(sqrt(x  - 1) + x)
    

    Number Theory

    Compute the prime factorisation of a number:
          factor(n)               basic method
          ifactors(n)             more efficient algorithm
          ifactor_verbose: true   show details
    

    Limit

          limit(f(x), x, a);
          limit(f(x), x, a, dir);       direction dir = plus, minus
    

    Differentiation

          diff(expr, x);
          diff(expr, x, n);       /* n-th derivative */
          diff(expr, x, y);       /* mixed partial derivative */
    
    Convert the derivative to a function with define(..):
          f(x) := sin(x);               /* works */
          diff(f(x), x);
                cos(x)                  /* ok */
          g(x) := diff(f(x), x);        /* doesn't work */
          define(g(x), diff(f(x), x));
                g(x) := cos(x)          /* works */
    
    Compute the derivative at a specific value with at(..):
          at(diff((x-a)^2, x, 2), x=a);
                2
    

    Integration

          integrate(f(x), x);           indefinite integral
          integrate(f(x), x, a, b);     definite integral
          defint(f(x), x, a, b);        same
          ldefint(f(x), x, a, b);       same, but taking limits at the boundaries
    
    Examples:
          assume(a>0)$
          declare(a, noninteger)$
          facts(a);
                [a > 0, kind(a, noninteger)]
          integrate(x^a * exp(-x), x, 0, inf);
                gamma(a + 1)
          kill(all)$
          facts();
                []
    
          integrate(1/(a - cos(x)), x, 0, %pi);
    
          Is  (a - 1) (a + 1)  positive, negative, or zero? pos;
                    2
          Is  sqrt(a  - 1) - a  positive or negative? neg;
                    2
          Is  sqrt(a  - 1) - a + 1  positive, negative, or zero? pos;
              !      2         !
          Is  !sqrt(a  - 1) + a! - 1  positive, negative, or zero? pos;
    
                              2
                  2 %pi sqrt(a  - 1) - 2 %pi a
                - ----------------------------
                             2         2
                  2 (a sqrt(a  - 1) - a  + 1)
    
          ratsimp(%), algebraic;
    
                    %pi
                ------------
                      2
                sqrt(a  - 1)
    

    Summation

    Sums are defined with sum(..) and evaluated (symbolically) with simpsum:
          sum(expr, n, n1, n2);
          ev(sum(...), simpsum);        sum and simplify
          sum(...), simpsum;            same in short
          simpsum: true;                enable summations
    
    Example:
          sum(k^2, k, 1, n);
                                         n
                                        ====
                                        \      2
                                         >    k
                                        /
                                        ====
                                        k = 1
          %, simpsum;
                                       3      2
                                    2 n  + 3 n  + n
                                    ---------------
                                           6
    
    The same is achieved with
          sum(k^2, k, 1, n), simpsum;
    or
          simpsum: true;
          sum(k^2, k, 1, n);
    

    Series expansion

          powerseries(expr, var, point);      symbolic, possibly infinite
          taylor(expr, var, point, order);    truncated at given order
    
          niceindices(expr);                  rewrite symbolic sums
    

    Equations

    Equations (single or systems) are solved by solve.
          solve(eqn, var);
          solve([eqn1, eqn2, ..], [var1, var2, ..]);
    
    It returns a list of solutions resp. solution vectors. 
    Examples:
          sol: solve(x^2 + p*x + q, x);
                       sqrt(p  - 4 q) + p      sqrt(p  - 4 q) - p
                [x = - ------------------, x = ------------------]
                               2                       2
          x1: x, sol[1];
                  sqrt(p  - 4 q) + p
                - ------------------
                          2
          x2: x, sol[2];
                  sqrt(p  - 4 q) - p
                - ------------------
                          2
    
          eqn1: x + y = 4;
                y + x = 4
          eqn2: x - y = 2;
                x - y = 2
          sol: solve([eqn1, eqn2], [x,y]);
                [[x = 3, y = 1]]
          x, sol;
                3
          y, sol;
                1
    Check:
          map(is, ev([eqn1, eqn2], sol));
                [true, true]
    
    Maybe ev(..) needs more flags (e.g. ratexpand).

    Check multiple solutions (equation is formulated as f(x) = 0):

          f(x):= x^2 + 2*b*x + c;
                         2
                f(x) := x  + 2 b x + c
          sol: solve(f(x), x);
                             2                     2
                [x = - sqrt(b  - c) - b, x = sqrt(b  - c) - b]
          map(f, map(rhs, sol)), expand;
                [0, 0]
    
    ?HOW TO:
          solve(sin(x) + cos(x) = 1/2, x);
    
          eqn: sin(x) + cos(x) = 1/2;
          solve(eqn, x);                no success
    
          eqnx: exponentialize(eqn);
          sol: solve(eqnx, x);          solution in terms of complex logs
    
          ratsimp(sol);
          %, numer;
    
          rectform(sol);                imaginary parts are obsolete
          ratsimp(%);                   nicer formula
          %, numer;
    
    ?HOW TO:
          solve(s + sqrt(1-s^2) = 1/2, s);
    
          solveradcan: true;            doesn't help here
                                        (solve calls radcan)
    
          eq1: s + r = 1/2;             aux variable r = sqrt(1 - s^2) > 0
          eq2: r^2 = 1 - s^2;
          solve([eq1, eq2], [s, r]);
                        sqrt(7) - 1      sqrt(7) + 1
                [[s = - -----------, r = -----------], 
                             4                4
                      sqrt(7) + 1        sqrt(7) - 1
                 [s = -----------, r = - -----------]]
                           4                  4
    
    Solution is s = (1 - sqrt(7))/4 .

    ?HOW TO:

          solve([sqrt(x) + y = 0, sqrt(x) = 1], [x, y]);
                []
          eliminate([sqrt(x) + y = 0, sqrt(x) = 1], [x]);
                [1]                     ??? BUG ???
          eliminate([sqrt(x) + y = 0, sqrt(x) = 1], [y]);
                [ sqrt(x) - 1 ]         ok
    
    Note that eliminate() uses resultant(), which is supposed to work with polynomials
    Eliminate variables from a set of (polynomial?) equations:
          eliminate([eqn1, eqn2, ..], [var1, var2, ..]);
    
    Note: there is a new solver package ("topoly" or "to_poly"), see appendix.

    Numerical solution

          find_root(expr, x, a, b)
    
    For polynomials: see realroots(pol), allroots(pol).

    Ordinary Differential Equations

    ode2

    Try to solve general ODEs of first or second order with ode2:
          ode2(eqn, y, x);
    
    E.g. eqn of 2nd order:
          eqn: 'diff(x,t,2) + r*'diff(x,t)^2 = 0;
    general solution, with constants of integration %k1, %k2:
          sol: ode2(eqn, x, t);
                          log(r t + %k1 r)
                      x = ---------------- + %k2
                                 r
    impose initial conditions:
          ic2(sol, t=0, x=x0, 'diff(x,t)=v0), logcontract, ratexpand;
                               log(r t v0 + 1)
                      x = x0 + ---------------
                                      r
    convert solution equation to a function:
          define(x(t), rhs(%));
    
    [TO DO: for the same deqn with exponent 2 -> 3, ic2() fails to solve for the initial conditions. This looks like a problem with solve...] 
    Boundary conditions are imposed with bc2(..)
    For an equation of first order, the initial conditions are specified with ic1(..).

    desolve

    Solve a linear ODE with desolve (using Laplace transformation):
          eqn: 'diff(f(x), x) = 2*f(x);       /* linear ODE of 1st order */
          sol: desolve(eqn, f(x));
                              2 x
                f(x) = f(0) %e      
    
    [Note the different format of derivatives in the equation.] 
    Initial values at x = 0 can be imposed with atvalue before calling desolve:
          eqn: 'diff(f(x), x) = 2*f(x);
          atvalue(f(x), x=0, k);              /* initial value at x=0 */
          sol: desolve(eqn, f(x));            /* solution as an equation */
                           2 x
                f(x) = k %e
          define(f(x), rhs(%));               /* solution function */
                            2 x
                f(x) := k %e
    
    An example of second order:
          eqn: 'diff(f(t), t, 2) + r*'diff(f(t), t) + f(t) = sin(omega*t);
          atvalue(f(t), t=0, 1);
          atvalue('diff(f(t), t), t=0, 0);
    
          desolve(eqn, f(t));     /* omega nonzero, -2 < r < 2 */
    
          define(f(t), rhs(%));
          plot2d(ev(f(t), omega=1.1, r=0.1), [t, 0, 100]);
    
    linear system is solved with desolve as follows:
          eqn1: 'diff(f(x), x) = c*f(x) - g(x);
          eqn2: 'diff(g(x), x) = c*g(x) + f(x);
          atvalue(f(x), x=0, 1);
          atvalue(g(x), x=0, 0);
    
          sol: desolve([eqn1, eqn2], [f(x), g(x)]);
    
          define(f(x), rhs(sol[1]));
          define(g(x), rhs(sol[2]));
          c: 0.1;
          plot2d([parametric, f(t), g(t)], [t, 0, 10], [nticks, 100]);
    

    desolve requires that the inverse Laplace transform (ilt) is applied to a rational function with a denominator of first or second order.

    Vectors and Matrices

          A: matrix([a, b, c], [d, e, f], [g, h, i]);     /* (3x3) matrix */
          u: matrix([x, y, z]);                           /* row vector */
          v: transpose(matrix([r, s, t]));                /* column vector */
    
    Reference to elements etc:
          u[1,2];                 /* second element of u */
          v[2,1];                 /* second element of v */
          A[2,3];   or  A[2][3];  /* (2,3) element */
          A[2];                         /* second row of A */
          transpose(transpose(A)[2]);   /* second column of A */
    
    Element by element operations:
          A + B;      A - B;
          A * B;      A / B;
          A ^ s;      s ^ A;
    
    Matrix operations:
          A . B;                  /* matrix multiplication */
          A ^^ s;                 /* matrix exponentiation (including inverse) */
          transpose(A);
          determinant(A);
          invert(A);
    

    Properties

          assume(pred);           predicate `pred' e.g. a > 0, equal(b,3), notequal(c,0)
          is(expr);               check whether expr is true, based on assumptions
          forget(pred);           remove `pred' from assume database
    
          features                list of mathematical properties
          declare(var, prop);
          remove(var, prop);
    
          facts(item);            list properties associated with item
          facts();                list all properties
    
          domain:real             default
          domain:complex
    
    Examples:
          facts(a);               list of properties involving a
          forget(facts());        remove all properties (but not the features?)
          forget(facts(a));       remove all properties (not features?) involving a
    
    kill(all) clears the facts database (among other things).

    Graphics

          plot2d(expr, range);                /* one curve */
          plot2d([expr1, expr2], range);      /* two curves */
          plot2d([parametric, expr1, expr2], range);      /* parametric */
    examples:
          plot2d(sin(x), [x, 0, 10]);
          plot2d(tan(x), [x, 0, 10], [y, -2, 2]);   /* truncate vertically */
          plot2d([8*sin(x), exp(x)], [x, -2, 2]);
          plot2d([parametric, t*cos(t), t*sin(t)], [t, 0, 10], [nticks, 100]);
    
          plot2d(sin(x), [x, 0, 10],  [gnuplot_term, ps],
                [gnuplot_out_file, "filename"]);    /* write PS file */
    
          plot3d(expr, range1, range2);       /* 3D mesh plot */
    example:
          plot3d(sin(x)^2 * sin(y)^2, [x, -2, 2], [y, -2, 2]);
    
    It appears that in a parametric plot, the parameter has to be named "t".

    I/O

    Console interaction:
          print("text");
          print(expr1, expr2, ..);
          disp(expr1, expr2, ..);
          display(expr1, expr2, ..);
    
          z: read("what is z?");              /* terminate reply with ; */
    
    Read/write data (in matrix or list form) from/to a file (space-separated numbers):
          load("numericalio");
    
          read_matrix("filename");
          write_data(matrix, "filename");
    
          read_nested_list("filename");
          write_data(list, "filename");
    
    File search and display:
          file_search("filename");      check for the existence of a file, using
                                        file_search_maxima etc as search paths
          file_search("filename",["path/"]);  use specified path
                                              (relative or absolute path)
          file_search_maxima            search path list, for load etc
          file_search_usage             search path list, e.g. for printfile
          printfile("filename");        display contents of file
    
    e.g. prepend a directory as follows:
    
          file_search_maxima: cons("/home/me/work/", file_search_maxima);
    
    Notes: 
    o terminate path elements with / 
    o It appears that the current working directory (where maxima was started) is always searched first.

    Running scripts:

          batch("filename");            run maxima commands from file
          batchload("filename");        same, in quiet mode
          load("filename");             run maxima and lisp code from file
    

    Command display and session log

    Disable 2D display, use 1-line output:
          display2d:false
    
    Convert expression to TeX format:
          tex(expr);
    
    Save command output and input to file:
          with_stdout("filename", commands);  writes output of commands to file
                file_output_append: true;     switch to append mode
    
          stringout("filename", expr1, ..);   write expressions in a form
                                                    suitable for maxima input
    
    Session transcript:
          writefile("filename");        session transcript in console output format
          appendfile("filename");       same, but append to file
          closefile();                  terminate session transcript
    

    Control Structures

          for var: first step incr thru limit do body
          for var: first step incr while cond do body
          for var: first step incr unless cond do body
    
          if cond then body
          if cond then body1 else body2
    
          return(expr);         /* abnormal termination of the "for" loop */
    
    step 1 can be omitted. 
    body is a single command or a comma separated list of commands. 
    for returns done upon normal termination. 
    if returns the last result of the executed commands or false
    The following example computes sqrt(10) to floating point precision:
          x: 1.;
          for n: 1 thru 10 do
                (x0: x, x: .5*(x + 10./x), if x = x0 then return(x));
    
    In this example, the control variable is obsolete and can be omitted:
          x: 1.;
          do (x0: x, x: .5*(x + 10./x), if x = x0 then return(x));
    

    Scripts

          batch("filename");            run Maxima script 
          /* .. */                      comments in script
    
          unix> maxima -b filename      run in terminal (from the command line)
    

    Startup scripts

          $HOME/.maxima/maximarc
    
          maxima_userdir                directory for startup file `maxima-init.mac'
                                        (Unix default: $HOME/.maxima)      
    

    Checking the installation

          build_info();
          run_testsuite();
          run_testsuite(true);          show bugs only
    

    wxMaxima

          ->Edit ->Configure
             ->Options
                Language: (select)
             ->Style
                [x] Use greek font
    
    displays variables starting with % as (small or capital) greek letters, e.g. %omega and %Omega
    Beware: %pi and %phi are predefined.

    Math display modes:

          set_display('xml);      nice format (default)
          set_display('ascii);    multi-line mode, like maxima with display2d:true
          set_display('none);     one-line mode, like maxima with display2d:false
    
    May be set via ->Maxima ->Change 2d display. 
    In xml mode, long numbers are displayed with a shortcut.

    wxMaxima-0.8.x notes:

    In 0.8.0/0.8.1

    • the input line was removed,
    • commands are terminated with <SHIFT>-<ENTER>, a la Mathematica.
    The latter is made configurable in 0.8.2:

      [x] Enter evaluates cells

    In wxMaxima-0.8.5, %alpha etc are represented as greek letters by default (no need to configure).

    Documentation

    Tutorials

    Antonio Cangiano, A 10 minute tutorial for solving Math problems with Maxima 
    Boris Gaertner, The Computer Algebra Program Maxima - a Tutorial 
    Moses Glasner, The Maxima Primer 
    Richard H. Rand, Introduction to MACSYMA 
    wxMaxima tutorials  [in *.wxm.zip format]

    Advanced

    Maxima Beginner's FAQ [with many tips for advanced usage, in fact] 
    Paulo Ney de Souza et al., The Maxima Book (19-Sept-2004) 
    Moses Glasner, A Maxima Guide for Calculus Students 
    Robert Dodier, Minimal Maxima 
    Edwin L. Woollett, Maxima by Example 
    P. Lutus, Symbolic Mathematics Using Maxima 
    Maxima, Maple, and Mathematica: the Summary 
    Gilberto E. Urroz, Maxima Book

    Plotting

    Examples of the Maxima Gnuplot interface 
    A Maxima-Gnuplot interface

    Manuals

    Maxima Manual  [5.28.0] 
    Michael Clarkson, DOE-Maxima Reference Manual  [Maxima manual v5.9 reformatted]

    Help

    Maxima mailing list and archives 
    Maxima user interface tips

    In German

    Johann Weilharter, Mathematik mit Computerunterstützung: CAS Maxima  [Sammlung von Unterrichtsmaterial] 
    Walter Wegscheider, Maxima 5.xx unter der Oberfl?che wxMaxima 
    Robert Gl?ckner, Einführung in Maxima 
    H.-G. Gr?be, Skript zu "Einführung in das symbolische Rechnen"  [not using Maxima]

    More links

    see maxima.sourceforge.net

    Appendices

    Experimental solver to_poly_solve()

    by Barton Willis, 2006ff

    provided e.g. with Maxima-5.15.0 + 5.17.1: 
    files: 
    topoly.lisp (engine) 
    topoly_solver.mac (wrapper).

    They also work with Maxima-5.10.

          load(topoly_solver);
                /home/b/maxima/5.15.0/topoly_solver.mac
          to_poly_solve(s + sqrt(1-s^2) = 1/2, s);
                        sqrt(7) - 1
                [[s = - -----------]]
                             4
          to_poly_solve([sqrt(x) + y = 0, sqrt(x) = 1], [x, y]);
                [[x = 1, y = - 1]]
          to_poly_solve(sin(x) + cos(x) = 1/2, x);
                Nonalgebraic argument given to 'topoly'
    
    In Maxima-5.18.1, there is a new version (which does not work with Maxima-5.10?) - it solves the last example as well:
          load(to_poly_solver);
          to_poly_solve(sin(x) + cos(x) = 1/2, x);
                %union{TO DO}
    
    In Maxima-5.21.1, the to_poly_solver package is auto-loaded as needed.

    More special functions

    There is work in progress to implement the Exponential Integral and the Incomplete Gamma Function, see mailing list.

    GCL

    GCL (GNU Common Lisp) prompt and commands:
          MAXIMA>>(help)          show GCL help
          MAXIMA>>(run)           restart Maxima session
          MAXIMA>>(bye)           exit
          MAXIMA>>(by)            exit
    

    TO DO

    %union(..) 
    wxMaxima cells



  • 相关阅读:
    wireshark无法捕获无线网卡数据解决办法(failed to set hardware filter to promiscuous mode)
    用PHP检测用户是用手机(Mobile)还是电脑(PC)访问网站
    一次.net Socket UDP编程的10万客户端测试记录
    对象复制
    c#中volatile关键字的作用
    C#操作XML
    ASP.NET AJAX
    C#操作XMl2
    SQLServer 存储过程中不拼接SQL字符串实现多条件查询
    ASP.NET刷新页面的六种方法20081111 22:04asp.net页面刷新重是有问题,收藏几种方法挺有用的.
  • 原文地址:https://www.cnblogs.com/enjoy233/p/3011150.html
Copyright © 2011-2022 走看看