- Maxima Constants (maxima)
- Exchange Values with Maxima (maxima)
- Newton Algorithms with Maxima (maxima)
- Differential Equations with Maxima (maxima)
- Exact Numerical Integration with Maxima (maxima)
- Interval Evaluation with Maxima (maxima)
- Utility Functions for Maxima (maxima)
- Tables of Values with Maxima (maxima)
- Gnu PLot (maxima)

Function for Maxima functions.

Euler extends Maxima with some useful functions. The details are explained in the documentation of the Euler core.

Usually, Maxima is used in Euler seamlessly via symbolic expressions. This file contains some other ways to exchange data with Maxima.

The file also contains some functions, which use Maxima in the background.

functionoverwrite mxmstart(directory:string="")

Start Maxima in the specified directory. The default directory is the Euler start directory. Euler can also start Maxima automatically at program start or if needed (see the Options menu). mxmstop: Stops Maxima. See:

maxima (Euler Core)

functionmxmeval(s:string)

Evaluate the Maxima expression with additional parameters. The expression will go through the Maxima interpreter in direct mode. Thus this function should only be used for simple term evaluations. In the case of a Maxima error, an Euler error will occur. After the string is interpreted by Maxima, it is evaluated in Euler. At this point any additional assigned parameters and all global variables are visible, and can be used. The function returns an Euler value. See:

maxima (Euler Core)

functionmxmget(s:string)

Gets a value from Maxima. This is the same as mxmeval. See:

mxmeval (Maxima Functions for Euler)

functionmxmset(var, value="none", large:integer=1)

Set a variable var to the value x in Maxima. Can be used with either a variable only, or a name and and a value. In the first case, the variable name in Maxima will be the same as the name of the Euler variable. Also, "variable::=value" sets a symbolic expression in Maxima and Euler. See:

::= (Euler Core),

::= (Maxima Documentation)

functionevalinmxm

Evaluate a Maxima expression in Maxima with values. In contrast to "mxmeval", this function evaluates the expression in Maxima, optionally using additional local values for parameters. To set such an additional parameter, add its name as a string, and its value as two parameter to the function. See:

mxmeval (Maxima Functions for Euler)

functionmxm2vector(s:string, large:integer=0)

Turn a Maxima vector into an Euler vector. For large vectors (>100 elements) set large to 1. For small vectors, mxmget("v") or v() will work faster.

functionmxm2str(s:string)

Turn a Maxima vector of maxima expressions into a string vector. This reads a vector of expressions in Maxima, and turns it to a vector of strings in Euler (e.g., for plotting).

functionmxm2matrix(s:string, large:integer=0)

Turn a Maxima matrix into an Euler matrix. For large matrixed (>100 columns) set large to 1. For small matrices, mxmget("A") or A() will work faster.

functionmxmnewton(expression:string, start:complex scalar, y:real scalar=0, eps=none)

Solve expression=y using Newton's method. The expression must be an expression in x. Maxima is called to compute the derivative of the expression. The accuracy of the method can be controlled with eps=... See:

mxminewton (Maxima Functions for Euler),

mxmnewtonfxy (Maxima Functions for Euler)

functionmxminewton(expression:string, start:interval, .. yi:real scalar="", y:real scalar=0)

Guaranteed inclusion of the solution of expression=y. The functions uses an interval version of Newton's method. The expression must be an expression in x. Maxima is used to find the derivative of the expression. See:

inewton (Numerical Algorithms)

functionnewtonfxy(f1:string, f2:string, f1x:string, .. f1y:string, f2x:string, f2y:string, start:real vector)

Newton's method to a solution of f1(x,y)=0, f2(x,y)=0. The derivatives must ge given as expressions or functions. All expressions must be expressions in x and y. This function is a special Newton method for two variables. For more variables, use "newton2". See:

mxmnewtonfxy (Maxima Functions for Euler),

newton2 (Numerical Algorithms)

functionmxmnewtonfxy(f1:string, f2:string, start:real vector)

Newton's method to a solution of f1(x,y)=0, f2(x,y)=0. The expressions f1, f2 are passed to Maxima to compute the derivatives of f1 and f2. Both expressions must be expressions in x and y.

functionmxmtaylorrest(expr:string, deg:integer=10)

Compute the Taylor development and rest for the expression expr. The function computes a Taylor series for y, assuming y'=expr(x,y). The series has the form y(x+h)=y+expr(x,y)*h+f2(x,y)*h^2+... Moreover, the function produces a term for the error. For the actual error, this term must be evaluated at any point between x and x+h. The result is useful for mxmidgl. Returns {taylor,rest} See mxmidgl

functionmxmidgl(expr:string, x:real vector, y0:interval scalar, .. deg:integer=10, taylor:string="", rest:string="")

Guaranteed inclusion of the differential equation y'=expr. The function uses Maxima to compute a Taylor series of y to the given degree, and uses the error term to find a guaranteed solution. The series can be computed in advance using mxmtaylorrest. expr : expression in x and y. Global variables are allowed as long as they are not defined in Maxima. deg : degree of the method. x : is a vector of places, where the solutions should be found. y0 : start value at x[1]. See:

mxmiint (Maxima Functions for Euler),

mxmtaylorrest (Maxima Functions for Euler)

functionmxmiint(expr:string, a:real scalar, b:real scalar, .. n:integer=20, deg:integer=10)

Guaranteed inclusion for the integral of expr from a to b. This functions uses a Taylor series of high degree, and an estimation of the error. expr : expression (must map to arguments and work for intervals) Global variables are allowed, if they are not defined in Maxima. a,b : interval bounds n : number of subinervals deg : degree of the Taylor expansion See:

integrate (Numerical Algorithms),

integrate (Maxima Documentation),

mxmintegrate (Maxima Functions for Euler),

mxmidgl (Maxima Functions for Euler)

functionmxmisimpson(expr:string, a:number, b:number, n:index=50)

Interval Simpson integral of f from a to b. This function uses the Simpson method and its error estimate to get guaranteed inclusions of integrals. The estimate involves the 4-th derivative, which is computed by Maxima. expr : expression (must map to arguments and work for intervals). Global variables are allowed, if they are not defined in Maxima. a,b : interval bounds n : number of subintervals See:

isimpson (Numerical Algorithms)

functionsplitinterval(xi:interval scalar, n:integer)

Split the interval into n subintervals

functionmxmieval(expression:string, xi:interval scalar, n:integer=1)

Better evaluation of the expression in x for the interval xi. The function is using the mean value theorem. Maxima is called to compute the derivative of the expression. The expression must be an expression in x. The interval can also be split into sub-intervals for more accuracy.

functionmxmievalfxy(expression:string, ix:interval scalar, iy:interval scalar)

Better evaluation of the expression in x and y on intervals. This function is using the mean value theorem in two variables. The derivatives are computed by Maxima.

functionmxmibisectfxy(ef:string, eg:string, .. ix:interval scalar, iy:interval scalar, eps=0.01)

Two dimensional bisection method Use the two dimensional bisection method to find intervals in a given interval, where the function could be zero. The derivatives are computed by Maxima. Returns a nx2 vector of intervals. The first column is the interval of x values, and the second the interval of y values. ef and eg are expressions in x and y.

functionmap mxmdiff(expr:string,x=none,n=1)

Differentiate the expression with Maxima Differentiate the expression and optionally evaluate at x. The expression must be an expression in x. See:

diff (Numerical Algorithms),

diff (Maxima Documentation)

functionmxmintegrate(expr:string,a=none,b=0)

Integrate the expression Integrate the expression (optionally with limits) using Maxima. Maxima is used to find an anti-derivative of the expression. Euler is used to evaluate the result in b and a. See:

integrate (Numerical Algorithms),

integrate (Maxima Documentation),

mxmiint (Maxima Functions for Euler)

functionmxmsolve(expr:string,n=0,y=0)

Solve expr=y im Maxima, optionally get the n-th solution. Call Maxima to solve expr=y, and evaluate all solutions in Euler. If n is not zero, extract the n-th solution as a string.

functionmxmdx(expr:string,x=none,y=0)

mxmdx(expr), mxmdx(expr,x,y) Partial derivative to x. Maxima is used to compute the partial derivative to x of an expression in two variables. Optionally, this derivative is evaluated in (x,y). Note that this function is inefficient, since it calls Maxima each time. It is better to compute the partial derivative once, and evaluate it for each x and y in Euler. See:

mxmgradient (Maxima Functions for Euler),

mxmdy (Maxima Functions for Euler),

mxmdiff (Maxima Functions for Euler)

functionmxmdy(expr:string,x=none,y=0)

mxmdy(expr), mxmdy(expr,x,y) Partial derivative to x. Maxima is used to compute the partial derivative to y of an expression in two variables. Optionally, this derivative is evaluated in (x,y). Note that this function is inefficient, since it calls Maxima each time. It is better to compute the partial derivative once, and evaluate it for each x and y in Euler. See:

mxmgradient (Maxima Functions for Euler),

mxmdx (Maxima Functions for Euler),

mxmdiff (Maxima Functions for Euler)

functionmxmgradient(expr:string,x=none,y=0)

Gradient of the expression in x and y. Maxima is used to compute the gradient. The gradient is evaluated in x and y. Note that this function is inefficient, since it calls Maxima each time. It is better to compute the gradient once, and evaluate it for each x and y in Euler. See:

mxmdx (Maxima Functions for Euler),

mxmdy (Maxima Functions for Euler),

mxmdiff (Maxima Functions for Euler),

mxmhessian (Maxima Functions for Euler)

functionmxmhessian(expr:string,x=none,y=0)

Hessian of the expression in x and y. Maxima is used to compute the Hessian. The gradient is evaluated in x and y. Note that this function is inefficient, since it calls Maxima each time. It is better to compute the Hessian once, and evaluate it for each x and y in Euler. See:

mxmdx (Maxima Functions for Euler),

mxmdy (Maxima Functions for Euler),

mxmdiff (Maxima Functions for Euler)

functionmxmeigenvalues(A,n=0)

Eigenvalues of the Matrix as computed by Maxima. Returns {lambdas,multiplicities} evaluated in Euler, or {lambda[n],multiplicity[n]} as strings, if n>0. See:

eigenvalues (Linear Algebra),

eigenvalues (Maxima Documentation),

mxmeigenvectors (Maxima Functions for Euler)

functionmxmeigenvectors(A,n=0)

Eigenvectors of the Matrix as computed by Maxima. Calls Maxima to compute the Eigenvectors of the Matrix, and evaluates the result in Euler. See:

eigenvectors (Maxima Documentation),

mxmeigenvalues (Maxima Functions for Euler)

functionmxmcharpoly(A)

Coefficients of the characteristic polynomials by Maxima. See:

charpoly (Linear Algebra),

charpoly (Maxima Documentation)

functionmxmgetcoeff(p)

Coefficients of the symbolic polynomial p(x)

functionmxmtable(expr,var,a,b,d=1,plot=1,points=1,print=1,frac=0)

Generate a table of values and a plot of these values. This function uses Maxima to create a table of values in a simple way. The "expression" of the variable "var" is incremented from a to b with increments d. If the expression is a vector of strings, a matrix of values will be created. expr : any Maxima expression (string or vector of strings) var : the variable name (string) a,b,d : range of variable and increment plot=1 : plot values and add plot to notebook points=1 : plot as point plot print=1 : print values to the notebook frac=0 : print as fractional values Returns the values

functionmxmsetpng(w=600,h=600)

Setup for Gnu Plot to PNG This sets the output of Gnu Plot to a PNG file in the home directory of Euler ("C:\Users\Name\Euler\gnuout.png"). When Maxima starts a similar routine is called automatically, so that this function is only necessary if you need another plot size than the default 600x600 pixels. The produced image can be inserted into the notebook with xmmins() or with a colon right at the end of the line after a symbolic plot command. >&plot2d(x^3-x,[x,-2,2]): >mxmsetpng(600,400); >&plot3d (log (x^2*y^2), [x, -2, 2], [y, -2, 2], ... > [grid, 29, 29], ... > [palette, get_plot_option(palette,5)]); >mxmins; >plot3d("log(x^2*y^2)",r=2,>spectral,grid=10,zoom=3): See:

mxmins (Maxima Functions for Euler)

functionmxmins(lines=35)

Load a Gnu Plot image into the notebook The function inserts the default output file of Gnu Plot into the notebook (/Users/Name/Euler/gnuout.png). The output file is set for &plot2d() during the start of Maxima. Instead of mxmins(), the output can be inserted with a colon after a symbolic command, but at the end of the command line. See:

mxmsetpng (Maxima Functions for Euler),

mxmsetdraw (Maxima Functions for Euler)

functionmxmsetdraw(w=600,h=600)

Sets the proper output for the draw package. The package draw has different options than plot2d(). If you load this package, you need to set the output in each draw(), or you can set it globally with this function. See:

mxmsetpng (Maxima Functions for Euler)