iconEuler Reference

Euler Core Functions

This file contains the documentation for functions, which are built into the C/C++ source code of Euler. It does also contain the documentation for Euler commands and operators. The content of this HTML page has been extracted from the file help.txt in the Euler directory.

There are many functions in other packages, which replace the built-in functions of this file, or add additional features. You can learn more about these extended functions following the provided links in this document.

If you want to start with Euler, have a look at the following introduction notebooks.

Get Help

The best way to get help is to use the HTML documentation in form of introduction notebooks and examples, or the HTML reference. Also observe the status line in the notebook window for information on the current command or option.

To open the context help for a function in Euler, mark the function name and press F1, or double click the function name.

help, mxmhelp, list

  help topic : Displays help for a user function, a built-in function and
  other Euler commands, programming keywords and brackets.
  
  mxmhelp topic: Display help for a Maxima command.
  
  list topic: List all topics containing this string. This looks through
  the Maxima documentation too.
  
  Additionally
  
  - F1 will open the reference at the position of the current command. 
  - Or you can mark any command and press F1 to get help for it.
  - Or simply double click on a command.

Operators and Functions

Euler uses the well known mathematical operators and functions. For operators, take care of precedence, or set brackets in case of doubt. Another point to keep in mind is that trigonometric functions work in radians, not in degrees.

+, -, *, ^, /

  The usual arithmetic operations. Note that these operators, as well as
  most functions in Euler, obey the Euler matrix language.
  
  These operators obey to the rules of the Euler matrix language.
  
  See: 
matrixlanguage (Euler Core) Division and powers generate runtime errors, if they are not defined for the arguments. Note that the dot . has to be used for matrix multpilication. See:
. (Euler Core),
. (Maxima Documentation) The underflows that ^ produces are caught to 0, if underflows is off (the default). Note that ^ in Euler uses left binding, so a^b^c is equal to (a^b)^c. >2*(3+4)^2 >2^2^3-2^8 >(2^2)^3-4^3 >(1e-200)^2 >errors off; 1/0; errors on; >A=[1,2;4,5]; A.A See:
underflows (Euler Core)
abs, exp, log, sign, sqrt

  The usual mathematical functions, for real, complex and intervals
  scalars, vectors and matrices. The functions work elementwise for
  matrices, and obey to the rules of the Euler matrix language.
  
  abs(x) : absolute value
  exp(x) : exponential function
  log(x) : natural logarithm, main branch for complex
  sign(x) : sign for reals
  sqrt(x) : square root, main branch for complex
  
  To compute the exponential etc. for a matrix, use "matrixfunction".
  
  The underflows that exp produces are caught to 0, if underflows is off
  (the default). 
  
  >log(E)
  >abs(1+I);
  >sqrt(complex(-1))^2
  >plot2d("sign",-1,1);
  
  See: 
log10 (Mathematical Functions),
logbase (Mathematical Functions)
sin, cos, tan, asin, acos, atan, arctan2, atan2, arcsin, arccos, arctan

  The usual trigonometric mathematical functions, for real, complex and
  intervals.
  
  sin(x) : sine function
  cos(x) : cosine function
  tan(x) : tangent function
  asin(x) : inverse sine, maps [-1,1] to [-pi/2,pi/2]
  acos(x) : inverse cosine, maps [-1,1] to [0,pi]
  atan(x) : inverse tangent, maps R to [-pi/2,pi/2]
  arcsin(x) : inverse sine, maps [-1,1] to [-pi/2,pi/2]
  arccos(x) : inverse cosine, maps [-1,1] to [0,pi]
  arctan(x) : inverse tangent, maps R to [-pi/2,pi/2]
  arctan2(x,y) : Angle of the polar coordinates of [x,y] in ]-pi,pi].
  atan2(x,y) : Angle of the polar coordinates of [x,y] in ]-pi,pi].
  
  The functions work for radians. To convert from degree to radians use
  x° or rad(x). Use shift-F7 to enter the degree symbol in an Euler
  notebook. To convert back, use rad(x).
  
  The degree symbol ° works in Maxima too.
  
  >sin(90°)
  >cos(pi)
  >deg(atan(1))
  >deg(atan2(1,1))
  >degprint(rad(10,30,20))
  
  See: 
polar (Mathematical Functions),
polar (Maxima Documentation),
rect (Mathematical Functions),
matrixlanguage (Euler Core),
deg (Output Formats),
rad (Output Formats),
degprint (Output Formats)
bin, fac, !, logbin, logfac

  bin(n,m) : Binomial coefficient "m chosen from n".
  
  logbin(n,m) : Logarithm of the bin(n,m).
  This is useful for large n, m.
  
  fac(n), n! : Factorial function of n.
  
  logfac(n) : Logarithm of the faculty function
  Useful for large n.
  
  >bin(10,0:10)
  >bin(49,6)-49!/(6!*43!)
  >logfac(100)-sum(log(2:100))
  
  See: 
binsum (Statistics with Euler),
invbinsum (Statistics with Euler),
gamma (Euler Core),
gamma (Mathematical Functions),
gamma (Maxima Documentation)
gamma, gammaln, betai

  gammaln(x) : Return the logarithm of the gamma function at x.
  gamma(x) : Return the gamma function at x.
  
  gamma(x,a) : The incomplete gamma function. This function is
  not scaled between 0 and 1 (divide by gamma(a) to scale it).
  
  betai1(x,a,b) : The incomplete beta function for non-matrix
  arguments.
  
  See: 
gamma (Euler Core),
gamma (Mathematical Functions),
gamma (Maxima Documentation),
fac (Euler Core),
beta (Mathematical Functions),
beta (Maxima Documentation)
besselj, bessely, besseli, besselk, besselallr, besselmodallr

  besselj(x,a) : BesselJ function of the first kind at x
  with order a.
  
  bessely(x,a) : Bessel function of the second kind.
  besseli(x,a) : modified Bessel function of the first kind.
  besselk(x,a) : modified Bessel function of the second kind.
  
  besselallr(x,a) : besselj(x,a), bessely(x,a) and their derivatives
  simultanously (works only for real arguments).
  
  besselmodallr(x,a) : besselallr for the modified Bessel functions.
  
ceil, floor, round, mod

  ceil(x) : The smallest interger above x.
  floor(x) : The largest integer below x.
  
  round(x,[n]) : x rounded to n digits.
  Default is n=0.
  
  mod(x,y) : x modulo y.
  This works for non-integer y too.
  
  >x-floor(x)
  >floor(1.9)
  >round(1.9)
  >round(-1.9)
  
  See: 
print (Output Formats),
print (Maxima Documentation),
frac (Output Formats)
complex, re, im, arg, conj, real

  re(x) : The real part of x.
  im(x) : The imaginary part of x.
  complex(x) : Makes the real argument x complex.
  conj(x) : Conjugate of the complex value x.
  arg(x) : The argument of the complex value x.
  
  real(x) : makes x real.
  If the imaginary part of x is too large, an error will be issued.
  
  >sqrt(-1) // Error!
  >sqrt(complex(-1))
  >A=random(10,10); sort(real(eigenvalues(A.A')))
  >deg(arg(I)) // 90
  
  See: 
carg (Maxima Documentation),
conjugate (Maxima Documentation)
I, E, Pi, pi, %e, %pi

  I : The imaginary unit (also %i and 1i)
  E : exp(1) (also %e)
  Pi : pi() (also pi, %pi)
  
  Do not use e for E. 
true, false

  true: The constant 1.
  false: the constant 0.
  
  All boolean functions and operators return 1 or 0.
<, >, <=, >=, <>, ~=

  Comparison operators, returning 0 or 1. 0 means false, and 1 means
  true. These operators obey to the rules of the Euler matrix language.
  To assert that the result is true for any or all elements of a matrix,
  use any or all.
  
  a~=b compares for equality taking into account the internal epsilon.
  This operator works for intervals too.
  
  >sum(0.1*ones(1,10))==1 // inevitably false
  >sum(0.1*ones(1,10))~=1 // true
  >(pi>3)&&(pi<4) // true
  
  See: 
matrixlanguage (Euler Core),
any (Euler Core),
all (Euler Core),
epsilon (Euler Core)
iformat, userformat, zerorounding, denseoutput

  iformat(n) : sets the total length for interval output.
  
  zerorounding(f) : Sets rounding to 0 of small numbers, if f=1. This is
  used automatically for the default longformat, but not for
  longestformat.
  
  userformat(function) : uses the function to format a string. 
  The function should determine if the values is real, complex, or
  interval. The width is determined by format or iformat.
  
  denseoutput(n) : Toggles dense output of scalars and row vectors.
  If n>0, it is the number of blanks between items. This is
  automatically set for the default longformat, but not for
  longestformat.
  
  Additional formats are available using the following links. The
  default format is longformat.
  
  >format(7,2);
  >denseoutput(false); (1:5)/3
     0.33   0.67   1.00   1.33   1.67 
  >denseoutput(true); (1:5)/3
   [ 0.33 0.67 1.00 1.33 1.67 ]
   
  >longformat;
  >zerorounding(false); sin(pi)
   1.22464679915e-016
  >zerorounding(true); sin(pi)
   0
  
  See: 
format (Output Formats),
longformat (Output Formats),
frac (Output Formats)
&&, ||, !

  a&&b : returns a and-connected with b in case of reals. 
  I.e., the result will be 1, if both a and b are non-zeros.
  
  I&&J : The interval intersection of I and J.
  
  a||b : returns a or-connected with b in case of reals. 
  I.e., the result will be 1, if both a and b are non-zeros.
  
  I||J : The interval union of I and J.
  
   !a : return 0 if a is non-zero, or 1, if a is zero.
  
  These operators work for matrix input like all operators in Euler.
  They produce a matrix of 1 or 0 in this case.
  
  See: 
and (Euler Core),
and (Maxima Documentation),
or (Euler Core),
or (Maxima Documentation),
not (Euler Core),
not (Maxima Documentation),
if (Euler Core),
if (Maxima Documentation)
and, or, not

  and,or : Shortcut logical operators. 
  Only the necessary parts of the conditions are evaluated. "and" binds
  stronger than "or". But it might be more clear to use brackets.
  
  not : Binds stronger than "and" or "or".
  
  These operators accept only reals. They are good for if-conditions or
  while- and until-statements. For logical operations, use "&&", "||",
  "!".
  
  >v=random(1,10);
  >i=12; if i<=cols(v) && v[i]>0.5 then "yes", else "no" endif;
   Index 12 out of bounds! 
   ...
  >i=12; if i<=cols(v) and v[i]>0.5 then "yes", else "no" endif;
   no
  
  See: 
|| (Euler Core),
! (Euler Core),
! (Maxima Documentation)
iscomplex, isfunction, isinterval, isreal, typeof, printtype, issymbolic

  isreal(x) : tests, if x is real.
  iscomplex(x) : tests, if x is complex.
  isinterval(x) : tests, if x is an interval scalar or matrix.
  isfunction(x) : tests, if x is a function.
  isstring(x) : tests, if x is a string.
  issymbolic(x) : tests, if x is a symbolic expression.
  
  typeof(var) : The type of the expression.
  
  The types are: 0=real, 1=complex, 2=matrix, 3=comples matrix,
  4=reference, 5=command, 6=submatrix, 7=complex submatrix, 8=string,
  9=function, 10=interval, 11=interval matrix, 12=interval submatrix,
  13=string matrix, 4=compresses sparse matrix
  
  printtype(x) : String containing the type of x.
bitand, botor, bitxor, bitnot

  Connect two integer values bit by bit. The double values are converted
  to 32 bit integers first.
  
  bitand(x,y) : bitwise and
  bitor(x,y) : bitwise or
  bitxor(x,y) : bitwise exclusive or
  bitnot(x,y) : bitwise not
  
  See: 
|| (Euler Core),
! (Euler Core),
! (Maxima Documentation)
=, :=, ::=, assignment

  variable = value : Assigns the value to the variable.
  The variable may be a variable name or a submatrix of a matrix.
  
  variable := value : More strikt form of the asignment. Recommended.
  
  variable ::= value : Sets a variable in Euler and in Maxima.
  
  See: 
submatrix (Euler Core),
submatrix (Maxima Documentation),
multiple (Euler Core)
submatrix, [, ]

  [...] : Defines a matrix row by row. The columns must be separated by
  commas, the rows by semicolons. In compatibility, this works for
  symbolic matrices too. [] is an empty 0x0 matrix. It can be used to
  attach rows or columns to it.
  
  ["string",...] : Defines a string vector. [none] is the empty string
  vector. It can be used to append strings or string vectors to it.
  
  A[i,j] : Defines a single element of a matrix or a submatrix
  If an index in i or j is out of range, it is neglected, or there will
  be an error message (the default). Negative indices count from the
  end. If i and j are vectors of indices, the submatrix with rows in i,
  and columns in j is used.
  
  Note that matrix indices start with 1 in Euler. -1 is the last element
  of the matrix.
  
  A[i] : The i-th element of a vector, or the i-th row of a matrix 
  with more than one row. A[-1] is the last element (resp. row). Note
  that A[i] returns different things if, A is a 1xm or a nxm (n>1)
  matrix. To make sure to get the i-th row, use A[i,].
  
  s[i] : Zhe i-th element of the string vector s, or a string vector
  with the indices from the row vector i.
  
  A[:,j] : The : denotes all rows here. This is the j-th column of A, or
  the columns with incides in the row vector j.
  
  A[,j] : Short form for A[:,j].
  
  A[i,:] : The i-th row of A, or the rows with indices in the row vector
  i.
  
  A[i,] : Short form of A.
  
  See: 
= (Euler Core),
= (Maxima Documentation),
{ (Euler Core)
(, )

  Round brackets are used to group operations as in (3+4)*5, to call
  functions as in sin(pi), or to evaluate expression.
  
  When expr is a string expression, expr(...) evaluates it in Euler. 
  The paramaters are automatically assigned to x, y, z. Other
  parameters may be added as assigned parameters as in expr(2,a=1).
  The evaluation sees global variables too, and local veriables in the
  function, which contains the expression evaluation.
  
  Round brackets may be used instead of v[5], if there is no function
  with the name v (else v(5) is a function call with parameter 5).
  However, this is not recommended, and is disabled in strict mode.

Strings and Characters

Strings in Euler are mainly used to hold expressions. An expression can be evaluated by the Euler interpreter using parameters. For many examples and a full reference refer to the documentation of Euler.

Strings are also used for file names, error texts and other text information.

ascii, char, substring, strfind, strlen, tolower, toupper, strtochar, chartostr

  ascii(string) : The ascii code of the first letter in the string.
  char(n) : String containing only the character with ascii code n.
  
  substring(string,n,m) : The substring from n to m (including).
  Negative indices count from the back.
  
  strfind(string,sub,n) : The position of sub in string. 
  The search starts after the n-th position.
  
  strlen(string) : The lengths of the string.
  tolower(string) : The string in lower case.
  toupper(string) : The string in upper case.
  
  strtochar(string) : Vector of letters in the string.
  chartostr(vector) : String with characters in the vector.
  
  >s="me and you", substring(s,strfind(s,"and",0),-1)
   me and you
   and you
  >strtokens(s)
   me
   and
   you
  >chartostr(flipx(strtochar("the brand new car")))
   rac wen dnarb eht
  
  See: 
key (Euler Core),
key (Maxima Documentation)
key

  key() or key(text): Waits for a key.
  The optional text is displayed in the status line. The function
  returns the ascii key code, or the internal key code, mapped to codes
  from 0 to 15.
  
  See: 
ascii (Euler Core),
ascii (Maxima Documentation),
wait (Euler Core)
input, lineinput

  input(prompt) : Prompts the user for an expression. 
  Returns the value of this expression. In case of an error, the prompt
  will be repeated. The user can break out with escape.
  
  lineinput(prompt) : Prompts for a string, which is not interpreted.
  
  See: 

Vectors and Matrices

The matrix language of Euler is the core of the functionality in Euler, which helps to avoid loops in many cases. Using the matrix languages allows for easy interactive computations.

Most operators and functions in Euler work for real, complex and interval scalar, vector and matrix input, whenever that makes sense. The operators and functions obey to the rules of the Euler matrix language.

matrixlanguage

  Basic Rule 
  
  Operators and functions are applied elementwise to their operands, and
  the result is a matrix of the same size. 
  
  In case, the operands or parameters do not fit in size, Euler tries to
  expand the smaller one to the size of the larger one by duplication.
  
  >sqrt(1:5)
   [ 1  1.41421356237  1.73205080757  2  2.2360679775 ]
  >(1:5)*4
   [ 4  8  12  16  20 ]
  >(1:5)^2
   [ 1  4  9  16  25 ]
  >shortformat; (1:5)*(2:6)'
             2           4           6           8          10 
             3           6           9          12          15 
             4           8          12          16          20 
             5          10          15          20          25 
             6          12          18          24          30 

If one of the operands is only a vector, the other a matrix, the operators work, as if the vector was duplicated to the size of the matrix. E.g., if a column vector v and a matrix A are combined, the result is a matrix R[i,j], applying the operator to v[i] and A[i,j]. If a row vector v and acolumn vector w are combined the result combines v[i] with v[j].

All matrices must have the same size. Row vectors must have the same number of rows as any parameter matrix, and column vectors the same number of columns. If the operands do not fit together, there will be an error message.

Scalar values can be combined with any matrix or vector. In this case, the scalar is combined with all elements of the matrix or vector.

The following are functions that create or modify matrices and vectors.

More functions are contained in Basic Utilities or in Linear Algebra. For an introduction to matrices in Euler, read

zeros, ones

  zeros([n,m]) or zeros(n,m) : Matrix filled with with x=0.
  ones([n,m]) or ones(n,m) : Matrix filled with with x=1. 
  
  >shortformat; A=random(2,3)
       0.44462     0.29947     0.28269 
       0.88323     0.27091     0.70442 
  >B=ones(size(A))
             1           1           1 
             1           1           1 
  
  See: 
size (Euler Core)
:, linspace

  i:n : The vector [i,(i+1),...,n] for integers i,n.
  
  x1:d:x2 : The vector [x1,x1+d,...,x1+k*d], 
  If d is negative, we get the vector [x1,x1+d,...,x1+k*d], where k is
  maximal such that x1+kd>=x1. For the comparison with the bound, the
  internal epsilon is used.
  
  linspace(a,b,n) : n+1 linear spaces values in [a,b], including a and b.
  
  See: 
epsilon (Euler Core),
equispace (Basic Utilities),
chebzeros (Basic Utilities)
cols, rows, size, redim

  cols(A) : The number of columns of the matrix A.
  rows(A) : The number of rows of the matrix A.
  
  size(A,B,C,...) : The maximal size of A,B,C,... 
  This is used to define a matrix, which can hold the result of any
  operation between the compatible matrices A,B,C,... This is necessary,
  if map or the matrix language cannot be used, and a loop must be used
  instead. To access the k-th element of a matrix A flattened to a row
  matrix, use A{k}.
  
  redim(A,[n,m]), redim(A,n,m) : returns a matrix with the same content
  but different dimensions n times m. Fills with 0, if necessary.
  
  >shortformat; 
  >A=zeros(3,4); size(A),
   [ 3  4 ]
  >rows(A), cols(A),
   3
   4
  >for k=1 to prod(size(A)); A{k}=k; end; A,
             1           2           3           4 
             5           6           7           8 
             9          10          11          12 
  >s=size(1:3,(1:3)')
   [ 3  3 ]
  
  See: 
matrixlanguage (Euler Core),
{ (Euler Core)
., bandmult

  A.B: Matrix multiplication.
  
  bandmult(A,B) computes A.B and is a bit faster for sparse matrices.
  
  This is just the ordinary multiplication of matrices. For sparse
  matrices use cpxmult.
  
  For large, sparse matrices, compress the matrices, and use cpxmult.
  
  See: 
. (Euler Core),
. (Maxima Documentation),
cpxmult (Euler Core)
totalmax, totalmin

  totalmax(A) : Maximal value of all elements of the matrix A.
  totalmin(A) : Minimal value of all elements of the matrix A.
  
  >function spread(A) := totalmax(A)-totalmin(A)
  >spread(normal(100,100))
   7.6503
  
  See: 
max (Euler Core),
max (Basic Utilities),
max (Maxima Documentation),
min (Euler Core),
min (Basic Utilities),
min (Maxima Documentation)
diag, setdiag, band

  diag(A,k) : k-th diagonal of A
  
  diag([n,m],k,v),diag(n,m,k,v) : nxm matrix with v on its k-th diagonal. 
  Alternative forms are diag(A,k), diag(n,m,k,v).
  
  setdiag(A,k,x) : A with the k-th diagonal set to x.
  
  In these functions, k=0 is the main diagonal, k=-1 the diagonal below,
  and k=1 the diagonal above. Note that setdiag does not change the
  matrix A, but returns a new matrix.
  
  band(A,n1,n2) : A, with A(i,j) set to 0, if i+j<n1 or i+j>n2.
prod, sum, cumprod, cumsum

  These functions work for row vectors. In the case of matrices, they
  work for each row of the matrix seperately. E.g., sum(A) returns a
  column matrix, with entries equal to the sums of the rows of A.
  
  prod(A) : A vector containing the products of the rows of A.
  
  sum(A) : A vector containing the sums of each row of A.
  
  cumprod(A) : Matrix with the cumulative products in the rows of A.
  The result R has the same size as A. R[i,k] is the product of A[i,1]
  to A[i,k-1].
  
  cumsum(A) : Matrix with the cumulative sums in the rows of A.
  
  >function colsum (A) := sum(A')'
  >colsum([1,2;3,4])
   [ 4  6 ]
  >plot2d(cumsum(normal(1,1000)));
  >cumprod(1:5), (1:5)!
   [ 1  2  6  24  120 ]
   [ 1  2  6  24  120 ]
dup, _, |

  dup(v,n) : duplicates the vector v n times 
  The duplication takes place vertically or horizontally depending on v.
  Row vectors are duplicated vertically, column vectors are duplicated
  horizontally.
  
  v_w : sets v atop of w.
  If one matrix has less columns than the other, it is filled with
  zeros. However, if v or w is a scalar value, this value is used for
  the fill. So v_5 adds one row filled with 5 to v. In any case, the
  number of rows is the sum of the rows of v and w, the number of
  columns is the maximum of the number of columns of v and w. This
  applies also, if v or w has zero rows.
  
  v|w : sets v aside of w.
  Works analogously to v_w. So, v_5 will enter a column filled with 5 to
  v. The number of columns is the sum of the numbers of columns, and the
  number of rows is the maximum of the number of rows of v and w.
  
  | : is also uses to append flags in Maxima compatibility mode and
  symbolic expressions.
  
  s|t : does append strings, or strings and numbers. The numbers will be
  formatted according to the current format. Note, that s+t will also
  append strings, or strings and numbers. Then s must be a string.
  
  >shortformat;
  >(1:3)_2
             1           2           3 
             2           2           2 
  >(1:3)'|2
             1           2 
             2           2 
             3           2 
  >random(3,3)_random(2,2)
       0.02744     0.70953     0.72939 
       0.58709     0.47649     0.58604 
       0.76816     0.54169     0.47627 
       0.57003     0.40318           0 
       0.13538     0.43876           0 
  >"me"|" and "|"you"
   me and you
  >"Result : "+1.5^2*pi
   Result : 7.06858347058
flipx, flipy, shiftleft, shiftright, rotleft, rotright

  flipx(A) : reflects the matrix A vertically.
  flipy(A) : reflects the matrix A horizontally.
  
  rotleft(A) : rotates the rows of A to the left.
  The last column is copied to the first column.
  
  rotright(A) : rotates the rows of A to the right.
  
  shiftleft(A) : Shifts the matrix to the left, last column to 0.
  shiftright(A) : Shifts the matrix to the right, first column to 0.
  
  >flipx(1:10)
   [ 10  9  8  7  6  5  4  3  2  1 ]
extrema, max, min

  extrema(A) : Computes min and max and their positions in each row.
  Returns a matrix with four columns containing the miminal value, its
  position, the maximal value and its position of each row of A.
  
  max(A) : Maxima of the columns of A.
  min(A) : Minima of the columns of A.
  max(x,y) : Returns the bigger of x and y.
  min(x,y) : Returns the lesser of x and y.
  
  See: 
totalmax (Euler Core)
any, all, nonzeros

  any(A) : 1, if any entry in A is different from 0.
  all(A) : 1, if all entries in A are different from 0.
  
  all(A) is equivalent to !any(A==0). For numerical comparison
  respecting the internal epsilon, use A~=0.
  
  nonzeros(v) : The indices of the non-zero elements of v.
  v must be a vector. The result is a row vector w, of at most the size
  of v.
  
  In "if" clauses you must use any(v>2) to check, if any element of v is
  greater than 2.
  
  See: 
~= (Euler Core)
charpoly

  charpoly(A) : The characteristic polynomial of A.
  
  Euler uses an orthogonal transformation to a simpler matrix, and a
  recursion to compute the characteristic polynomial. Note that
  polynomials in Euler start with the constant coefficient.
  
  See: 
det (Linear Algebra),
eigenvalues (Linear Algebra),
eigenvalues (Maxima Documentation)
\, lu, lusolve

  \ : A\b solves the linear system A.x=b, using the Gauss algorithm.
  
  lu(A) : LU-decomposition of A as {B,r,c,det}. 
  
  B is the result of the Gauss algorithm with the factors written below
  the diagonal, r is the index rearrangement of the rows of A, c is 1
  for each linear independet column and det is the determinant of A. 
  
  There is a utility function LU, which computes the LU-decomposiotn of
  a matrix (L,R,P such that LR=PA).
  
  To get a true LU-decomposition using lu for a non-singular square A,
  take the lower part of B (plus the identity-matrix) as L and the upper
  part as U. Then A[r] is L.U, i.e. for quadratic A, A[r] is
  
  (band(B[r],-n,-1)+id(n)).band(B[r],0,n) 
  
  To solve A.x=b for quadratic A and an x quickly, use
  lusolve(B[r],b[r]).
  
  lusolve(R,b) : Solves R.x=b for an upper triangle matrix R.
  
  See: 
LU (Linear Algebra),
echelon (Linear Algebra),
echelon (Maxima Documentation),
pivotize (Linear Algebra),
cholesky (Linear Algebra),
cholesky (Maxima Documentation)
orthogonal

  orthogonal(A) : returns {B,c}, where B is an orthogonal basis for A
  
  This functions uses the Gram-Schmid method to compute an orthogonal
  basis of the columns of A. c is a row vector with 1 for the indices
  of the basis columns of A.
  
  >shortformat; A=random(3,3); A=A|sum(A)
       0.70573      0.4307     0.49152      1.6279 
       0.43069     0.80786     0.10856      1.3471 
       0.16496    0.018247     0.54693     0.73014 
  >{B,c}=orthogonal(A); c
   [ 1  1  1  0 ]
  >O=B[,nonzeros(c)]
        0.8371     -0.4529    -0.30683 
       0.51086      0.8478     0.14233 
       0.19567    -0.27589     0.94106 
  >O.O'
             1           0           0 
             0           1           0 
             0           0           1
jacobi

  jacobi(A) : computes the eigenvalues of a symmetric real matrix A
  using the Jacobi procedure.
  
  >A=random(3,3); sort(real(eigenvalues(A.A')))
   [ 0.0172719273661  0.340638776106  2.47915810899 ]
  >sort(jacobi(A.A'))
   [ 0.0172719273661  0.340638776106  2.47915810899 ]
  
  See: 
charpoly (Euler Core),
charpoly (Maxima Documentation),
eigenvalues (Linear Algebra),
eigenvalues (Maxima Documentation)
fold

  fold(A,B) : Folds a matrix or vector A by the matrix or vector B.
  
  In the result R, R[i,j] is the total sum of the pointwise
  multiplication of the submatrix of A with A[i,j] in the upper left
  corner and B. I.e.
  
  R[i,j] = \sum_{n,m} A[i+n-1,j+m-1]*B[n,m]
  
  whre n,m runs over all elements of B. The result R is of size
  (cols(A)-cols(B)+1,rows(A)-rows(B)+1). Consequently B must be smaller
  in size than A.
  
  In the example, folding with [1/2,1/2] takes the average of two
  neighboring elements of 1:10.
  
  >fold(1:10,[0.5,0.5])
   [ 1.5  2.5  3.5  4.5  5.5  6.5  7.5  8.5  9.5 ]
  
  For a matrix, folding with [1/4,1/4;1/4,1/4] takes the average of
  2x2-sub-matrices.
   
  Folding with [1,-1] takes the difference of two elements, and is
  equivalent to differences.
  
  See: 
fftfold (Numerical Algorithms),
differences (Basic Utilities)
scalp

  scalp(v,w) : Scalar product of two row or column vectors.
givensrot, givensqr

  givensrot(j,i1,i2,A,B): One Givens rotation of A and B.
  Returns (X=GA,Y=GB), such that X[l2,j]=0, and G is an orthogonal
  Matrix, changing only the rows i1 and i2 of A and B.
  
  givensqr(A,B): OR decomposition of A and B.
  Returns {R=GA,Y=GB,c), such that R is upper triangle, and c shows the
  linear independent columns of A.
  
  These functions provide stable transformations to solve a linear
  system. They are used by the function fit(A,B).
  
  >shortformat; A=random(3,3),
       0.77473     0.89357      0.5985 
       0.70968     0.36746     0.80751 
       0.59486     0.67635     0.26406 
  >B=id(3)
             1           0           0 
             0           1           0 
             0           0           1 
  >{X,Y}=givensrot(1,1,2,A,B); X
       -1.0506    -0.90712    -0.98678 
             0     0.33263    -0.19118 
       0.59486     0.67635     0.26406 
  >Y.Y'
             1           0           0 
             0           1           0 
             0           0           1 
  
  See: 
fit (Linear Algebra),
qrdecomp (Linear Algebra)

Simplex Algorithm

Euler has a built-in Simplex algorithm. There is also a higher level function with the same name. Moreover, there is the package lpsolve. See LPSOLVE package. For many examples, see the following introductory notebook.

simplex

  simplex(A,b,{eq,re,opt}) : The Simplex algorithm.
  
  The return value is {x,r,i}, where x minimizes c.x under all x>=0 with
  A.x<=b. If r is 0, the minimum is found. If r is 1 the problem is
  unbounded, and if r is -1 it is infeasable. i contains 1 for each
  active condition.
  
  eq (optional) : column vector with -1,0,1 for <=,=,>= conditions. eq
  can also be a real, which is used for all conditions.
  
  re (optional) : row vector with 0,1,-1 for unrestricted, or restricted
  non-negative variables or non-positive variables. re can also be a
  real, which is used for all conditions.
  
  opt (optional) : real with -1,0,1 for minimization, feasible point,
  maximization. In the case opt=0 the algorithm simply stops after a
  feasible point.
  
  There is a more versatile utility function with the same name. Follow
  the link below.
  
  >A=[1,1;4,5]; b=[1000;4500]; // x+y<=1000, 4x+5y<=4500
  >eq=[-1;-1]; // both equations <= (the default)
  >c=[5,6]; // 4x+5y -> Max.
  >restr=[1,1]; // x,y>=0 (the default)
  >{x,r}=_simplex(A,b,c,eq,restr,1); // check for errors
  >r // 0 is OK
   0
  >x // result
                   500 
                   500 
  
  See: 
simplex (Euler Core),
simplex (Linear Programming),
intsimplex (Linear Programming),
ilpsolve (Linear Programming)

Statistics

Euler can be used to compute advanced statistics. However, a specialized package like R might be preferred for a purely statistical application.

A nice application of Euler are Monte-Carlo simulations of statistical processes or data.

Also, see the functions in Statistics with Euler. Some distributions are available in more accurate versions in @"xdis".

For many examples and more functions read the following introduction notebook.

normaldis, invnormaldis, chidis, fdis, tdis, invtdis

  chidis(x,n) : chi-distribution with n degrees of freedom.
  tdis(x,n) : Student's t-distribution with n degrees of freedom.
  invtdis(p,n) : The inverse.
  fdis(x,n,m) : f-distribution with n and m degrees of freedom.
  
  Therre are more distributions in the statist package. For
  normaldis and invnormaldis, there are utility functions. Some of these
  functions have a reduced accuracy. For more accuracy, use the
  functions in xdis.e.
  
  >normaldis(2), invnormaldis(%)
   0.977249868052
   2
  >invtdis(0.95,15)
   1.75305008015
  >invnormaldis(0.95)
   1.64485362695
  
  See: 
erf (Statistics with Euler),
erf (Maxima Documentation),
normaldis (Euler Core),
normaldis (Statistics with Euler),
qnormal (Statistics with Euler)
random, normal, fastrandom, fastnormal, seed, intrandom

  random([n,m]),random() : equally distributed random numbers in [0,1].
  normal([n,m]),normal() : 0,1-normal distributed random numbers.
  intrandom([n,m],k),intrandom(k) : integer random numbers from 1 to k.
  fastrandom([n,m]) : faster, but less reliable random numbers.
  fastnormal([n,m]) : faster, but less reliable random numbers. 
  seed(x) : set the starting random number
  
  There are more functions in the statist file.
  
  >shortformat;
  >random(1,8)
   [ 0.55189  0.43992  0.1547  0.32917  0.89215  0.053643  0.13502  0.93035 ]
  >v=normal(1,1000); mean(v), dev(v)
   -0.028872
   1.017
  
  See: 
randt (Statistics with Euler)
shuffle

  shuffle(v) shuffles the 1xn vector v randomly.
  
  See: 
random (Euler Core),
random (Maxima Documentation)
sort, unique, lexsort, find, indexof, indexofsorted, multofsorted

  sort(v) : Sorts a vector, returning {w,i}.
  Returns the sorted vector and the new indices of the elements
  {w,i}=sort(v), so that w=v[i]. Works for row or column vectors. Works
  for string vectors too.
  
  unique(v) : Returns a vector with unique elements (sorted).
  Returns the sorted vector and the new indices of the elements {w,i}.
  
  lexsort(A) : Sorts the rows of a matrix lexicographicly.
  Returns the sorted matrix and the new indices of the rows {B,i}.
  
  find(v,x) : finds x in the sorted vector v. 
  Returns the index i such that v(i) <= x < v(i+1). It returns 0 for
  elements smaller than v[0], and length(v) for elements larger or equal
  the last element of v. The function maps to n. The function works for
  sorted vectors of strings v, and strings or string vectors x using
  alphabetic (ASCII) string comparison.
  
  indexof(v,x) : finds x in the vector v.
  Returns the indices of the elements of x in v or 0. Returns the
  first index where x[i] is found. Works for string vectors v and strings
  or string vectors x.
  
  indexofsorted(v,x) : finds x in the sorted vector v.
  A more efficient form of index(v,x) for sorted v. This function always
  returns the highest possible index. Works for string vectors too.
  
  multofsorted(v,x) : counts x in the sorted vector v.
  Returns the number of times each element x[i] appears in v. Works for
  vector strings too.
  
  See: 
count (Euler Core),
getfrequencies (Statistics with Euler),
getmultiplicities (Statistics with Euler)
count

  count(v,n) : counts the numbers of v(i) in the intervals (0,1) to
  (n-1,n). Returns a 1xn vector.
  
  See: 
histogram (Maxima Documentation),
histo (Statistics with Euler)

Polynomials

A Polynomial is stored in Euler in a vector of coefficients, starting with the lowest coefficient. Euler can solve complex polynomials, find polynomial fits and interpolations, and do some basic calculations of polynomials.

There are some utility functions to create and handle special orthogonal polynomials, like Chebyshev or Legendre polynomials. See Gauss Qudrature, Mathematical Functions.

interp, divdif, interpval, divdifeval, polytrans, interpolation

  Interpolation with polynomials. Euler uses the divided difference form
  of the interpolation polynomial. This form requires that the
  interpolation points are passed to the evaluation function of the
  interpolating polynomial.
  
  interp(x,y) : divided differences of the polynomial interpolation.
  Interpolates (x(i),y(i)). Hermite interpolation is available with the
  function hermitinterp. For polynomial fit, use polyfit.
  divdif(x,y) : Alias to interp.
  
  interpval(x,d,t) : evaluates the interpolation in x(i)  in t
  divdifeval(x,d,t) : Alias to interpval.
  
  Both functions work with divided differences d in a vector [x0],
  [x0,x1] etc.
  
  polytrans(x,d) : transfer the divided differences into a polynomial.
  
  >x=[0,1]; d=interp(x,[1,1/2])
   [ 1  -0.5 ]
  >frac(interpval(x,d,[0,1])) // evalute in 0,1
   [1,1/2]
  >polytrans(x,d) // this is 1-0.5x
   [ 1  -0.5 ]
  >d=interp(1:5,[-1,1,-1,1,-1])
   [ -1  2  -2  1.33333333333  -0.666666666667 ]
  >plot2d("interpval(1:5,d,x)",1,5);
  
  See: 
interpolate (Basic Utilities),
hermiteinterp (Numerical Algorithms),
polycons (Euler Core),
polyfit (Linear Algebra),
remez (Numerical Algorithms)
polyadd, polycons, polydiv, polymult, polytrunc, polyval

  Polynomials in Euler are stored in vectors starting with the constant
  coefficient.
  
  polyval(p,x) : Evaluates p at x.
  polycons(v) : A polynomial with zeros v(i).
  polydiv(p,q) : {h,r}, where h is the result p/q and r the remainder.
  polymult(p,q) : Computes p*q.
  polyadd(p,q) : Computes p+q.
  polytrunc(p) : Truncates zero coefficients.
  
  >p=polycons(1:5), real(polysolve(p))
   [ -120  274  -225  85  -15  1 ]
   [ 1  3  4  2  5 ]
  >polyval(p,1:5)
   [ 0  0  0  0  0 ]
  
  See: 
polysolve (Euler Core),
polyroot (Euler Core),
cheb (Mathematical Functions)
polysolve, polyroot

  polysolve(p) : Computes all roots of p.
  polyroot(p,x) : Computes the root near x.
  
  These functions use a Newton method close to the 0, and a descent
  method away from a zero.
  
  See: 
polyval (Euler Core),
polycons (Euler Core)

File Access

With the following routines, and some utility functions described in other files, it is possible to write to files, and read from files.

For more advanced functions to read and write matrices or other values, see Elementary File Input and Output.

changedir, cd, path, load, home, homedir, userdir, start, eulerhome

  changedir(string) : Changies the current direcory.
  Returns the new directory. If the string is empty, it only returns the
  current directory. Note that the directory is changed automatically,
  if a new notebook is loaded or saved.
  
  cd string : is a command doing the same.
  cd : A quick way to see the current directory.
  
  home() : The home directory of the current notebook
  userhome() : The home directory of the user
  
  eulerhome() : The subdirectory Euler uf userhome().
  If the directory does not yet exist, it will be created. You should
  use this for temporary files.
  
  userdir() : The "Euler Files" directory.
  start() : The directory, where Euler started.
  
  path(string) : Sets a path to look for Euler files. 
  The load command will look through this path and choose the first
  available file. The path items must be separated by a semicolon. An
  example is ".;myspecial". This should not be changed by the user.
  
  load filename : loads an Euler file. 
  The name may be included in double quotes, or in round brackets (if it
  is a string expression. The command can also be used in a file to load
  another file.
  
  >filename=eulerhome()+"test.txt"
   C:\Users\Rene\Euler\test.txt
  >open(filename,"w"); writeln("First Line"); writeln("Second Line"); close();
  >printfile(filename)
   First Line
   Second Line
  >remove(filename)
  
  See: 
comment (Euler Core),
endcomment (Euler Core)
searchfile, dir, remove

  searchfile(pattern) : Searches for the file pattern.
  searchfile() : Searches the next file with this pattern.
  remove(file) : Removes a file
  
  See: 
cd (Euler Core),
dir (Euler Core),
dir (Elementary File Input and Output)
open, close, eof

  open(filename[,type]) : opens a file with the specified name for
  reading (type is "r") or writing (type is "w"). Binary mode can be
  achieved with "rb" or "wb". Default type is "r".
  
  close() : closes the opened file.
  eof() : returns 1, if the file is read completely.
  
  See: 
putchar (Euler Core),
putword (Euler Core)
putchar, putword, putlongword, putuchar, putuword, putulong

  putchar(c) : puts a character to a previous opened file.
  c is the ascii code of the character.
  
  putuchar(c) put c as unsigned character.
  putword(x) : puts x a s two bytes to the file.
  putuword(x) : put x as unsigned word.
  putlongword(x) : puts x as four bytes to the file. 
  putulongword(x) : The unsigned thing.
  
  These functions use the internal format. They are useful for binary
  output. For writing text, use write and writeln.
  
  See: 
write (Euler Core),
getstring (Euler Core),
open (Euler Core),
close (Euler Core),
close (Maxima Documentation)
getword, getlongword, getuchar, getuword, getulongword, getline

  getchar() : reads one character from the file.
  getuchar() : for unsigned characters.
  getchar(n) : reads n characters, and returns in a 1xn vector.
  getword() : reads a word.
  getuword() : reads an unsigned word.
  getword(n) : reads n words.
  getlongword() : reads a long word.
  getulongword() : reads an unsigned long word.
  getlongword(n) : reads n long words.
  getline() : returns a line from the file.
  
  See: 
write (Euler Core),
getstring (Euler Core),
open (Euler Core),
close (Euler Core),
close (Maxima Documentation)
getstring, write, writeln

  getstring(n) : reads a string of length from an opened file.
  write(string) : writes a string to the open file.
  writeln(string) : writes a string to a line in the open file.
  
  See: 
open (Euler Core),
close (Euler Core),
close (Maxima Documentation)
getvector, getvectorline

  getvector(n) : reads n numbers in readable form an opened file.
  The function returns a vector and the actual number of read numbers
  {v,m}. The numbers may be separated by any non-digit characters.
  
  getvectorline(n) : reads n numbers in readable form an opened file.
  This will stop at the end of the line. The function returns {v,m,s},
  where s is the line.
  
  These functions assume numbers with a decimal dot. They will read over
  any characters that do not form a number, like commas, blanks etc. For
  matrix input use getmatrix.
  
  >filename=eulerhome()+"test.txt";
  >open(filename,"w");
  >for i=1 to 5; write(""+i+", "); end; writeln;
  >for i=1 to 5; write(""+i+", "); end;
  >close();
  >printfile(filename)
   1, 2, 3, 4, 5, 
   1, 2, 3, 4, 5, 
  >open(filename,"r"); {v,n}=getvector(1000); close();
  >n
   10
  >v
   [ 1  2  3  4  5  1  2  3  4  5 ]
  
  See: 
open (Euler Core),
close (Euler Core),
close (Maxima Documentation),
getmatrix (Elementary File Input and Output)

Expressions

As mentioned in the section about strings, strings can hold expressions. Expressions can be evaluated using the evaluate function or its short form string(), resp. string(parameters). For examples, read the following introduction.

eval, @(, evaluate, error, errorlevel

  eval("f",v,...) : calls the function f with parameters v,...
  
  This is obsolete, because f(v,...) will work for strings containing
  function names and also for strings containing expressions. 
  
  "expression"(...) : Euler evaluates strings containing expressions.
  Note that expressions in Euler are by default expected to be
  expressions in x, y, and z. Functions, of course, can use any variable
  name. The parameters of an expression in expr(...) are assigned to x,
  y, and z in this order. Addtional parameters can be assigned using the
  form var=...
  
  A string of the form "@(a,b,c,...) expression" is evaluated as the
  expression with parameters a,b,c etc. This works like an anonymous
  function. It should be preferred to store functions in functions, not
  in strings, however.
  
  evaluate(expression) : evaluates the expression string.
  This is obsolete, since expression() will do the same, and variables
  expression(x,y,z) will assign local variables x, y and z. Additional
  parameters can be assigned as var=... Global variables can be used.
  
  error(string) : issues an error and prints the message string.
  
  errorlevel(string) : evaluate the string and return 0 and the result,
  if no error, else the error number.
  
  >function f(x) := x^3+x
  >f(0.5)
   0.625
  >eval("f",0.5)
   0.625
  >"f"(0.5)
   0.625
  
  >expr="x^3+x";
  >expr(0.5)
   0.625
  >expr:="a*x^3+x";
  >expr(0.5,a=1)
   0.625
  
  >expr="@(a) a^3+a";
  >expr(0.5)
   0.625
  
  >errorlevel("1/0")
   1
  
  See: 
evaluate (Euler Core),
expreval (Basic Utilities)

Intervals

Euler contains an interval arithmetic. Most built-in mathematical functions and operators can handle intervals.

The basic rule of interval arithmetic is that the result is an interval containing all possible results that can occur, if an input parameter is chosen for each parameter interval. Note, that if the same interval occurs twice in the parameter list, the intervals are independend. See the documentation for more details.

For interval algorithms see Interval Solvers and Guaranteed Solutions. For an introduction, visit the following notebooks.

diameter, middle, left, right

  right(w) : right end of the interval w.
  left(w) : left end of the interval w.
  diameter(w) : right(w)-left(w)
  
  These functions are functions for intervals, but they works for real
  numbers too.
  
  See: 
~ (Euler Core),
~ (Maxima Documentation)
interval, ~, ±

  interval(a,b) : the interval [a,b].
  ~a,b~ : the interval [a,b].
  a±d : is like ~a-d,a+d~ (use shift-F8 for ?)
  ~a~ : returns an interval [a-eps,a+eps].
  
  >1±0.05
   ~0.95,1.1~
  >~-1,1~
   ~-1,1~
  >~4~
   ~3.999999999999999,4.000000000000002~
  
  See: 
middle (Euler Core),
left (Euler Core),
right (Euler Core),
expand (Euler Core),
expand (Maxima Documentation),
intersects (Euler Core),
|| (Euler Core)
intersects, <<, <<=, expand

  intersects(a,b) : tests two intervals on non-empty intersection.
  a<<b : true if a is contained in b.
  a<<=b : true if a is contained in or equal to b.
  
  expand(x,d) : The interval [x-d,x+d], if x is real, 
  and an interval of d times the diameter of x, if x is an interval.
  
  >~2~ << expand(2,epsilon)
   1
  >expand(2,epsilon) << ~2~
   0
  
  See: 
interval (Euler Core),
|| (Euler Core)

FFT

The Fast Fourier Transform and its inverse, are implemented for matrix and vector input. The result is always complex. For an introduction, read the following notebook.

fft, ifft

  fft(v) : The fast Fourier transform of v. 
  v must have one row and should have a number of columns with many low
  prime factors, like 2^n. This is the same as evaluating a polynomial
  with coeffcients v in all roots of unity simultanously. However, it is
  much faster
  
  ifft(v) : is the inverse operation.
  
  fft(V) : If V is a matrix, this will return the two dimentional FFT of V. 
  In this case, the number columns and rows must be a power of 2.
  
  ifft(V) : is the inverse operation.
  

Plots

Euler has the primary plot routines plot2d and plot3d. The following functions should only be used for special purposes. For more information, read the following notebooks.

plots

  Euler uses an external window for plots, but it can also copy plots to
  the text window. The preferred way to plot is via the utility
  functions plot2d and plot3d. These functions can plot
  
  - 2D and 3D functions and parametric curves or surfaces
  - implicit function of two or three variables
  - anaglyphic, contour, or level line plots
  - user animated 2D and 3D plots
  - complex nets
  
  See: 
plot2d (Plot Functions plot2d and plot3d),
plot2d (Maxima Documentation),
plot3d (Plot Functions plot2d and plot3d),
plot3d (Maxima Documentation)
frame

  frame() : Draws the frame around the plot.
  This is usually automatic. The frame size is the graphics window minus
  the boundary for labels.
  
  See: 
shrinkwindow (Basic Plot Functions),
fullwindow (Basic Plot Functions),
window (Basic Plot Functions)
coordinates

  Euler uses plot coordinates or screen coordinates. 
  
  The screen coordinates always range from 0 to 1024, no matter if the
  actual screen format is square or rectangle. These coordiates are only
  used by elementary plot functions, and should not be used by the
  normal user.
  
  Plot coordinates are set by the recent plot. They refer to an area in
  the plane.
  
  See: 
plot2d (Plot Functions plot2d and plot3d),
plot2d (Maxima Documentation),
setplot (Euler Core),
setplot (Basic Plot Functions)
hold, holding, clg

  Note that these functions should not be used with plot2d and plot3d.
  To add another plot use add=1 for plot2d.
  
  hold : toggles holding of the graphics on or off. This applies to the
  fact that plot clears the graphics normally.
  
  hold on : toggles holding on.
  
  hold off : toggles holding off.
  
  holding() : The holding state.
  
  holding(f) : sets the holding state. f should be 1 or 0. 
  Returns the old state.
  
  clg : clears the graphics screen.
  
  See: 
plot2d (Plot Functions plot2d and plot3d),
plot2d (Maxima Documentation),
plot (Euler Core),
plot (Basic Plot Functions)
huecolor, huegrid, solidhue, solidhuecontour, contourcolor

  solidhue(x,y,z,h) : Colors the plot with a shading 0<=h<1.
  Otherwise, this works like solid.
  
  solidhuecontour(x,y,z,h,v,w) : Shading and contour lines for a 3D plot.
  v are the values of the contour lines, and w are the values on the grid.
  w=z would make a plot with contour lines indicating where z is equal to
  v[1],...,v[n].
  
  huegrid(f) : Turns the grid on or off. It returns the previous state.
  
  huecolor([n]) : Sets the color index (See: 
  If the color=-1, then the hue determines the color, and if color=-2
  the hue is translated into a spectral shading.
  
  contourcolor([n]) : Set the color for contours.
  
  See: 
plot3d (Plot Functions plot2d and plot3d),
plot3d (Maxima Documentation),
solid (Euler Core)
keepsquare

  keepsquare(f) : sets a flag to determine the autoscaling. 
  If the flag is on, autoscaling will keep the y coordinates the same
  range as the x coordinates.
  
  See: 
plot2d (Plot Functions plot2d and plot3d),
plot2d (Maxima Documentation),
plot (Euler Core),
plot (Basic Plot Functions)
plot, linestyle, setplot, linewidth, color, style

  These functions should be replaced by the various options of plot2d.
  
  plot(x,y) : connects the points x(i),y(i) with lines. 
  The coordinates are plot coordinates, which are set before the plot
  from the range of x and y, unless setplot has not been called before,
  or scaling is turned off. y can contain more rows as x. This will plot
  x,y[r] for all rows of y simultanuously.
  
  plot() : The x and y plot range (1x4 vector [x1,x2,y1,y2]).
  
  setplot([x1,x2,y1,y2]) : sets the plot coordinates.
  
  scaling(f) : Sets the scaling flag. 
  Returns the previous value. 
  
  linewidth(n) : Sets the width of the line. 
  Returns the old width.
  
  color([n]) : Sets the color for the plot, or returns the current
  color. This can either be an index (0..15), or a RGB color, defined by
  the "rgb" function. Returns the old value. 
  
  style(string) : sets line styles and marker styles.
  
  These functions should no longer be used and are replaced by plot2d.
  
  See: 
plot2d (Plot Functions plot2d and plot3d),
plot2d (Maxima Documentation)
mark, markwithcolor, markersize, markerstyle

  mark(x,y) : Works like plot, but does not connect the points.
  Use plot2d with points=1 instead of this function.
  
  markwithcolor(x,y,c) : Uses the color c to mark x and y.
  This is used plot3d to mark points in 3D with different colors.
  
  markersize(n) : Sets the markersize in screen coordinates.
  
  See: 
plot2d (Plot Functions plot2d and plot3d),
plot2d (Maxima Documentation),
coordinates (Euler Core),
markerstyle (Euler Core)
bar, barcolor, barRGB, polygon

  These functions should be replaced by the various options of plot2d.
  
  bar([xl,yu,w,h]) : Draws a rectangle 
  Use upper left coordinates (xl,yu), and lower right coordinates
  (xl+w,yu+h) in screen coordinates. The fill style is set with
  barstyle, and the color with barcolor. 
  
  barcolor([n]) : Sets the color index for the bar. Retunrs the old
  color.
  
  barRGB(r,g,b) : Plots a matrix of red-green-blue values.
  The values r,g,b must of same size with values between 0 and 1.
  
  polygon(x,y,f) : Filled curve with optional outline.
  The fill style is set with barstyle, and the fill color with barcolor.
  
  See: 
color (Euler Core),
color (Maxima Documentation),
plotbar (Basic Plot Functions),
polygon (Euler Core),
polygon (Maxima Documentation),
barstyle (Euler Core)
style, barstyle, markerstyle, linestyle

  barstyle(string) : Sets the fill style for bars and polygons.
  Available are "#" for solid colors, "#O" or "O#" for solid colors with
  black boundary, "O" for boundaries only, "\", "/" "\/", "+", "-",
  "|" for hatched styles.
  
  linestyle(string) : Sets the linestyle.
  Available line styles are "-" solid, "--" dashed, "." dotted, "-." for
  dash-dotted, ".-." and "-.-" for dash-dotted, or "->" for arrows.
  There is also an invisible style "i". Returns the previous value.
  
  markerstyle(string) : Sets the style for the markers. 
  Available styles are "<>", "[]", "o", ".", "..", "...", "..#", "+",
  "|", "-" or "*", and "<>#", "[]#", "o#" for filled markers, and "<>w"
  "[]w", "ow" for markers filled with the background color.
  
  These style functions return the old style, so that the plot function
  can reset the previous style. This is necessary, since some plot
  functions do not set the style, but use the global style.
  
  style(string) : Outdated function.
  Combines line styles like ".", markerstyles like "m.", and barstyles
  like "b/". Does not return the old style.
  
  See: 
plot2d (Plot Functions plot2d and plot3d),
plot2d (Maxima Documentation),
plot (Euler Core),
plot (Basic Plot Functions),
mark (Euler Core),
mark (Basic Plot Functions),
bar (Euler Core)
plotcubes

  plotcubes(M,[color]) plots lines of M as cubes in 3D. The lines
  contain [x1,y1,z1,x2,y2,z2] with lower and upper limits for the sides
  of the cubes. The cubes are drawn in the order of the lines. The
  utility function plotcubes sorts the cubes properly. 
  
  Each cube can have a different color in the optional color vector.
  
  See: 
plot3d (Plot Functions plot2d and plot3d),
plot3d (Maxima Documentation),
plot3dbars (Basic Plot Functions),
plotcubes (Euler Core),
plotcubes (Basic Plot Functions),
rgb (Basic Plot Functions)
addpage, deletepages, showpage, pages, copytopage, copyfrompage

  Functions for animation of plots in Euler. Pages are hidden graphics.
  The user can add as many pages as the memory permits. The idea is to
  create these pages once, and then play them in an animated sequence.
  It is possible to hide the current page during the creation of the
  sequence by showing some other fixed page.
  
  Pages 1 and 2 can be combined for an anaglyph view. The graphics
  function (usually plot3d) will plot on both pages with a slightly
  different view. The combination merges both graphics in such a way,
  that the use of red/cyan glasses is possible.
  
  addpage() : Copies the graphics to a new page.
  deletepages() : Deletes all pages.
  
  showpage(n) : Shows the page number n (1 to number of pages). 
  If n is 0, it shows the normal graphics. You can show page 1, and draw
  on page 0.
  
  showpage(-1) : combines page 1 and 2 to an anaglyph image, 
  and sets the graphics to anaglyph mode. This is cancelled with a new
  plot or clg.
  
  pages() : The number of pages.
  
  copytopage(n), copyfrompage(n) : Copies to or from the page number n
  to the current graphics
  
  See: 
animate (Basic Plot Functions),
anaglyph (Euler Core),
plot3d (Plot Functions plot2d and plot3d),
plot3d (Maxima Documentation)
anaglyph, setanaglyph

  Anaglyph plot in Euler are realized by combining the pages 1 and 2 to
  a single rec/cyan image with the command "showpage(-1)". Both pages
  should contain two views of the same 3D scene with a slight different
  view.
  
  setanaglyph(a) : Tilts the current view with the angle a to the right.
  
  See: 
pages (Euler Core)
mesh, meshbar, meshfactor

  Obsolete. Use plot3d instead.
  
  mesh(A) : Plots a simple 3D plot of a(i,j) over a grid of points
  (i,j).
  
  meshbar(A) : Works like mesh(A) with bars.
  The plot consists of columns of height a(i,j). Works for 1xn vectors
  too.
  
  meshfactor(f) : Dumpens the mesh with the factor (0 to 1) in height.
  
  See: 
plot3d (Plot Functions plot2d and plot3d),
plot3d (Maxima Documentation)
solid, wire, fillcolor, project, view, twosides

  These are elementary functions for plotting. In most cases, they
  should be regarded as obsolete. Use plot3d instead.
  
  solid(x,y,z) : Plots a solid 3D plots of points x(i,j), y(i,j), z(i,j). 
  I.e., a retangular grid (x,y) is mapped to these points. The
  two sided may have different colors, unless the twosides flag is off.
  Take care that the mapping is one-to-one and the plot does not
  self-intersect.
  
  wire(x,y,z) : Like solid, but does not fill the plot.
  fillcolor([n,m]) : sets the fill colors for both sides. n,m are color
  indices (0..15).
  
  wirecolor(n) : Sets the color of the wires.
  
  project(x,y,z) : Projects the coordinates to the screen, 
  just as in a solid or wired plot. Returns {vx,vy,vd}, where vx and vy
  are the screen coordinates, and vd is the distance to the eye. To mark
  a point in 3D, use this function, then fromscreen and finally mark,
  since mark works with plot coordinates.
  
  solid(x,y,z,i) : Does not connect the i-th row to the i+1-th row. 
  This produces disconnected solid plots.
  
  view([d,f,a,b]) : Sets the viewpoint of the camera. 
  d the camera distance to 0, f is the zoom factor, a the angle from the
  negative x axis and b the angle in height (measured in radial
  coordinates).
  
  twosides(f) : Turns the different colors for solid plots on or off.
  
  See: 
plot3d (Plot Functions plot2d and plot3d),
plot3d (Maxima Documentation),
contourcolor (Euler Core),
color (Euler Core),
color (Maxima Documentation),
fromscreen (Basic Plot Functions),
mark (Euler Core),
mark (Basic Plot Functions)
setcolor, resetcolors

  setcolor(i,red,green,blue) : Sets the color number i to these red,
  green, blue values for all future plots. The values must be in in
  [0,1]. The colors can also be set in the Euler menu. The colors are
  reset at each start of Euler.
  
  This function is not necessary for single plots, since colors can be
  set individually, using e.g. color=rgb(r,g,b).
  
  resetcolors() : resets all colors to the default values.
  
  See: 
rgb (Basic Plot Functions)
pixel

  pixel() : The width and height of a screen pixel in plot coordinates. 
  This helps avoiding unnecessary computations in the plot routines,
  especially for adaptive plots.
  
  See: 
toscreen (Basic Plot Functions),
fromscreen (Basic Plot Functions)
mouse, mousedrag, mousepos, mousestate

  mouse() : mouse() or mouse(string). Waits for mouse click or key.
  Waits until the user has clicked into the plot window.
  Returns the x,y-coordinates in plot coordinates. If the user
  pressed a key, the function will return the key, not an 1x2 vector.
  
  mousedrag() : Waits for mouse or keyboard events.
  The function returns {flag,m,time}, where flag is 0 for keyboard
  events, 1 for mouse down, 2 for dragging, 3 for mouse up. The result m
  contains the mouse position or the keyboard code. The time is the time
  of the event in milliseconds.
  
  mousestate() : 0 for mouse down and 1 for mouse up.
  mousepos() : The current mouse position in plot coordinates.
  
  See: 
plot2d (Plot Functions plot2d and plot3d),
plot2d (Maxima Documentation),
setplotm (Basic Plot Functions),
fromscreen (Basic Plot Functions),
toscreen (Basic Plot Functions),
dragvalues (Basic Plot Functions)
ctext, rtext, text, vtext, vctext, vutext, vcutext, textheight, textwidth, 
textcolor

  The text functions draw text to the graphics window. The font is
  fixed, and can be changed globally. These functions use screen
  coordinates. To label anything in a 2D plot, use "label".
  
  text(string,[n,m]) : Draws the string to screen coordinates n,m
  The screen is aligned at the upper left edge. All text functions work
  in the form text(string,n,m) too.
  
  ctext(string,[n,m]) : Draws the string horizontally centered.
  vtext(string,[n,m]) : Draws a string downwards.
  vctext(string,[n,m]) : Draws a string downwards centered.
  vutext(string,[n,m]) : Draws a string upwards.
  vcutext(string,[n,m]) : Draws a string upwards centered.
  rtext(string,[n,m]) : Draws it right aligned.
  textheight() : The maximal text height.
  textwidth() : The average text character width.
  
  textcolor([n]) : sets the color index for text (0..15), or returns the
  currenct color only.
  
  See: 
label (Basic Plot Functions),
label (Maxima Documentation),
coordinates (Euler Core)
density

  density(A) : Represents the elements a(i,j) by darker and lighter
  values in a square grid seen from above. You should scale the matrix
  to [0,1) since only the fractional part is used.
  
  The user should use plot2d instead.
  
  See: 
contour (Euler Core),
contour (Maxima Documentation)
getred, getgreen, getblue, putred, putgreen, putblue

  These functions transfer one RGB encrypted pixel color to red, green,
  blue values in the interval [0,1], and reverse. Used by loadpixels,
  savepixels, and by rgb(r,g,b), getrgb(x).
  
  getred(x) : Gets the red part of an RGB color
  getgreen(x) : Gets the green part of an RGB color
  getblue(x) : Gets the blue part of an RGB color
  
  putred(x) : RGB color with this red part
  putgreen(x) : RGB color with this green part
  putblue(x) : RGB color with this blue part
  
  See: 
rgb (Basic Plot Functions),
getrgb (Basic Plot Functions),
savergb (Euler Core)
loadrgb, savergb

  Load and save an array of pixels into an image file of PNG format.
  
  loadrgb(filename) : loads a PNG into an RGB array
  savergb(x,filename) : saves an RGB array into a PNG file
  
  To convert the RGB format to its channels, use getred, getgreen, getblue,
  or getrgb. To convert the channels into an RGB format use rgb.
  
  See: 
rgb (Basic Plot Functions),
getred (Euler Core),
getgreen (Euler Core),
getblue (Euler Core),
putred (Euler Core),
putgreen (Euler Core),
putblue (Euler Core),
getrgb (Basic Plot Functions)
contour

  Use plot2d or plot3d instead.
  
  contour(A,v) : Draws contour lines of a(i,j) at heights v(k). 
  a(i,j) is interpreted as the values of a function f at (i,j). Note,
  that i and j are always scaled to a square grid, unless you specify a
  non-square plot window. The function does not draw the plot
  coordinates, so they must be set manually using e.g. xplot.
  
  The advanced utility function plot2d should be used instead of this
  elementary function.
  
  See: 
density (Euler Core),
density (Basic Plot Functions),
fcontour (Basic Plot Functions),
fniveau (Basic Plot Functions),
contourcolor (Euler Core)
plotarea, fullplotarea, margin

  plotarea(x,y) : Determines the necessary plot range
  
  fullplotarea() : Returns the full plot area including margin.
  This works like plot(), but takes care of margins.
  
  margin(x) : Sets a margin between 0 and 1 around the plot.
  
  See: 
plot (Euler Core),
plot (Basic Plot Functions),
plot2d (Plot Functions plot2d and plot3d),
plot2d (Maxima Documentation)
insimg, loadimg, loadanaglyph

  insimg(n,"name",flag,crop) Inserts the graphics into the notebook.
  Inserts the graphics into the notebook scaled to n lines. "name" is
  optional and appended to the file name on export. flag is for
  anti-aliasing, and crop for the crop (1x4 vector). This function is
  overloaded with a more comfortable function.
  
  loadimg(n,"filename") Loads an image into the notebook.
  Loads a graphics from a file with maximal height n. If larger, the
  graphics scales down.
  
  loadanaglyph(n,"left,"right") Generates an anaglyph.
  Loads two graphic files and combines them to one anaglyph image. The
  files must have the same size, and be at least 16x16. The image is
  inserted into the notebook with height at most n.
  
  For these three functions there are service functions with more
  flexible parameters.
  
  See: 
insimg (Euler Core),
insimg (Basic Plot Functions),
loadimg (Euler Core),
loadimg (Basic Plot Functions),
loadanaglyph (Euler Core),
loadanaglyph (Basic Plot Functions)
postscript, pswindow

  postscript "file.ps" dumps the graphics to the file in postscript
  format. To set the size of the output in cm, use pswindow([w,h]).
  w=h=15 is the default.
  

Euler Programs

The most part of Euler is programmed in the Euler language itself. These programs are interpreted, which makes them slower than the built-in functions. For practical purposes, the speed difference is very often neglectible, especially, if the programs use the matrix language of Euler.

For an introduction to the programming see the following notebook.

function, endfunction, return, parameter, none

  A function in Euler has the following form.
  
    function name (parameter names)
    ...
    return ...
    ...
    endfunction
  
  A function can contain more than one return statement. If the function
  does not contain a return statement, it returns "none", a string with
  one character equal to 1. This result will yield no output.
  
  If the function line in the notebook ends with three dots ..., the
  function can be interpreted with one stroke of the return key. To edit
  such a function use the internal editor with F9.
  
  >function f(x) ...
  $  if x>0 then return x^3
  $  else return x^3
  $  endif;
  $endfunction
  
  One-line functions return only the result of a simple expression.
  They are defined in the following simplified form.
  
  >function f(x) := x^x
  >f(1:5)
   [ 1  4  27  256  3125 ]
  
  A function can return mutiple values. The syntax uses {...}. The
  return values can be assigned to variables.
  
  >function sort2 (a,b) ...
  $  if a<b then return {a,b}
  $  else return {b,a}
  $endfunction
  >{c,d}=sort2(5,4); [c,d]
   [ 4  5 ]
  
  If the return values are used as arguments to other functions, only
  the first one is used by default. This can be changed with the args
  parameter.
  
  There are functions, which cannot be called. The purpose of these
  functions is to provide help in the usual form for DLL functions, or
  for Maxima functions. Use the keyword comment to define such
  functions.
  
    function comment name (parameters)
    ## Comment ...
    endfunction
  
  See: 
{ (Euler Core),
} (Euler Core),
parameters (Euler Core),
## (Euler Core),
protect (Euler Core),
overwrite (Euler Core),
maxima (Euler Core),
symbolic (Euler Core),
dll (Euler Core)
repeat, break, continue, while, until, end, for, loop, #, index

  repeat; ...; end;
  
  This is an eternal loop. 
  
  until condition;
  while condition;
  
  These statements must be inside a repeat loop. The until statement
  finishes the loop, if the condition is true. It jumps after the
  end of the loop. The while statement finishes the loop, if the
  condition is false.
  
  for i=n to m; ...; end;
  for i=n to m step i; ...; end;
  v=...; for x=v; ...; end;
  
  This is the for loop. It can also be used to iterate through a row or
  column vector v as above. Changing v, or the loop step, or the end
  values inside the for loop has no effect on the loop. The vector v is
  copied to a allocated memory area. Again, return or break end the
  loop. 
  
  loop 1 to n; ...; end;
  
  This is a faster loop. The loop index can be called with index() or
  with the special symbol #. Again, return or break end the loop.
  
  break;
  continue;
  
  Each loop can be finished with return or break (usually in an if statement),
  where break jumps to the end of the loop. The continue command jumps
  to the start of the loop. 
  
  >function test ...
  $  s=0;
  $  n=1;
  $  repeat
  $    s=s+1/n;
  $    while s<10;
  $    n=n+1;
  $  end;
  $  return n;
  $endfunction
  >test
   12367
  
  Loops can also be used in the command line, as long as they fit into
  one line.
  
  >s=0; loop 1 to 10; s=s+#; end; s,
   55
  >s=0; for i=1:10; s=s+i; end; s,
   55
  >s=0; for i=1 to 10; s=s+i; end; s,
   55
  >s=0; i=1; repeat; s=s+i; i=i+1; until i>10; end; s,
   55
  >s=0; i=1; repeat; s=s+i; i=i+1; while i<=10; end; s,
   55
  
  See: 
not (Euler Core),
not (Maxima Documentation),
and (Euler Core),
and (Maxima Documentation),
or (Euler Core),
or (Maxima Documentation)
if, elseif, endif, else, then

  if condition then ...; endif;
  if condition then ...; else; ...; endif;
  if condition then ...; elseif condition; ...; endif;
  if condition then ...; elseif condition; ...; else; ...; endif;
  
  The command "then" can be omitted, though this is not encouraged. The
  commands can be used in the command line, as long as they fit into a
  single line.
  
  Note that loops and ifs cannot be used in one-line functions.
  
  >function signumstr (x)
  $  if x<0 then return "negative"
  $  elseif x==0 then return "zero"
  $  else return "positive"
  $endfunction
  >signumstr(-1), signumstr(0), signumstr(1)
   negative
   zero
   positive
  
  See: 
not (Euler Core),
not (Maxima Documentation),
and (Euler Core),
and (Maxima Documentation),
or (Euler Core),
or (Maxima Documentation)
argn, totalargn, args, getarg, arg1, arg2, arg3

  The arg... group of functions gives you access to unnamed arguments of
  functions. Unnamed arguments get the default names arg1, arg2, arg3,
  ... and can be accessed by this name or by the argument number.
  
  argn() : The number of arguments, given to the function.
  
  args(n) : returns all arguments from the n-th argument on, which may
  be past to another function as arguments.
  
  getarg(n) : get the n-th argument to a function call.
  
  args() : ll parameters from the first unnamed argument or the first argument
  after the semicolon ";" (semicolon parameters).
  
  Note that args() can deliver multiple returns which have the args
  flag (see the documentation for "return"). They can all be used as
  arguments to another function. In the following example, we pass a
  function as a parameter to another function, which calls it with
  args.
  
  >function f(a,b,c) := a*b*c
  >function g(h) := h(args())
  >g("f";5,6,7)
   210
  
  See: 
function (Euler Core),
return (Euler Core),
return (Maxima Documentation)
comment, endcomment, skipcomment, //, /*, */, ##, .., ...

  comment
  ....
  endcomment
  
  Brackets for a comment in a file. The load command will show the
  comment, unless this is turned off. comment and endcomment must be on
  a line of their own.
  
  comments on : turns comments on.
  comments off : turns comments off.
  
  skipcomment
  ....
  endcomment
  
  Like comment, but will never print.
  
  /*
  ....
  */
  
  Shortcut for skipcomment. In functions /* ... */ can also be used.
  

is a one line comment, which is removed from a function definition.

In functions, lines starting with ## are the help text for the function, if they follow the function header immediately. Otherwise, they are ordinary comment, but will not be removed from the function body. So they are visible with "type function". .. skips rest of this line and continues with next line. ... works like .., but sends all lines as a multi-line command. See:
load (Euler Core),
load (Maxima Documentation),
function (Euler Core)
parameters

  If the parameter has a default value in the function definition as in
  f(x,n=3), this value is used, unless two arguments are passed to f. If
  a paramter is missing as in h(x,,4), the default value for the second
  parameter is used.
  
  >function f(x,a=5) := a*x
  >f(2)
   10
  >f(2,3)
   6
  
  Parameters of functions are passed by value, unless the parameter
  name starts with %... (See the "global" command for global variables).
  Even, if the parameter is passed by reference, it can only change its
  value, not its type. If it is a matrix, it cannot change its size.
  
  >a=4;
  >function change$x (x) ...
  $  x=5;
  $endfunction
  >change$x(a); a,
   4
  >function change$x (%x) ...
  $  %x=5;
  $endfunction
  >change$x(a); a,
   5
  
  Vectors and matrices are passed by reference. So if you change elements
  those elements will be changed in the original matrix. The matrix
  cannot be replaced completely, however. Even "v=v" in the function
  already copies the matrix argument "v" to a local copy.
  
  >v=1:5
   [ 1  2  3  4  5 ]
  >function change$w (w) ...
  $  w[1]=2;
  $endfunction
  >change$w(v);
  >v
   [ 2  2  3  4  5 ]
  
  If the call contains a semicolon instead of the colon to separate
  the parameters as in f(x,y;4,5), the parameters 4,5 are extra
  parameters, which can be passed from f to other functions using the
  args() function. These parameters are called semicolon parameters. For
  an example, see the "args" function.
  
  Semicolon parameters can not be used inside a function, and can only
  be uses via the args() function as parameters for other functions.
  References to variables, which are given as a semicolon parameter, are
  visible however. This does even work in evaluations of expressions,
  when args() is used in the parameter list of the evalation.
  
  >expr="a*x";
  >function f(expr) := expr(2,args());
  >function g(expr,a) := f(expr;a)
  >g(expr,4)
   8
  
  Parameters can be restricted in the types of the values they can be
  assigned to, when the function is called. Possible restrictions are
  
  real, complex, interval, integer: include scalars, vectors or matrices
  scalar: no vector, no matrix
  vector: row vector, includes scalar
  column: column vector, includes scalar
  numerical: not a string or compressed matrix
  string: excludes vector of strings
  cpx: compressed matrix
  positive, nonnegative: additional hint
  
  These types can be combined. E.g., "complex vector" will accept all
  row vectors of type complex or real. 
  
  There are the shortcuts 
  
  number = real scalar
  natural = nonnegative integer
  index = positive integer scalar
  indices = positive integer vector
  
  These parameter types are restrictions. There is one parameter type,
  which is not a restriction.
  
  none: Allows the special string none for this parameter.
  This is automatically assigned to a parameter wiht default value none.
  
  >function f(x:number) := x^2
  >f(1:5)
   Function f needs a scalar for x
   
   Error in :
   f(1:5)
         ^
  >f(5)
   25
  
  The scalar type is often necessary. To allow for a vector, use "map".
  
  Assigned parameters are parameters with a value as in f(x,y,c=5).
  These parameters must be the last parameters in the parameter list,
  even after semicolon parameters. As a special convenience >c is
  equivalent to c=true, and <c is equivalent to c=false. Boolean
  parameters are often used in plot2d and plot3d.
  
  If more parameters are passed than in the definition of the function,
  the function names these parameters as "argX", where X is the position
  number of the parameter.
  
  See: 
args (Euler Core),
args (Maxima Documentation),
argn (Euler Core),
useglobal (Euler Core),
global (Euler Core)
useglobal, global, setglobal

  useglobal : Allows reference to global variables in functions.
  global variable: Allows reference to a global variable in functions.
  setglobal variable: Sets the variable global in all functions.
  
  See: 
function (Euler Core)
map

  Mathematical functions implemented in Euler functions should be ready
  to handle vector input. Often, this is automatic. But if the function
  contains conditional branches, or other more complicated routines,
  that might not be the case. To make sure, you can plot the functions
  and use them in numerical routines, you can define the function as a
  map function at compile time.
  
  function map f (x:scalar; p:vector)
  ...
  
  In this case, f will map to the elements of a vector x. I.e., it will
  compute the value for each element of x one by one. All parameters
  after a semicolon are excluded from the mapping.
  
  It is also possible to map a function at run time. Use either of the
  following commands.
  
  map("f",X,Y,...) maps the function f to the elements of X,Y. 
  
  fmap(X,Y,...) : does the same.
  
  The mapping obeys the rules of the Euler matrix language. The result
  of f must be a scalar numerical value. Parameters after a semicolon
  instead of a comma are protected from the mapping, and are used as
  they are.
  
  You can map to a function with no result (return missing). The map
  function will return no result too. No result is simulated in Euler
  with the value none.
  
  The following function restricts to a number, but since "map" is used,
  it can map itself to vectors or matrices. It will still not work for
  complex scalars or matrices.
  
  >function map test (x:number) ...
  $  if x<0 then return 0
  $  else return x^2
  $endfunction
  >test(-1:1)
   [ 0  0  1 ]
  
  See: 
function (Euler Core),
none (Euler Core)
protect, overwrite

  protect: protect all current function definitions and variables 
  from overwriting.
  
  Variabels starting with default... are not protected. The protection
  can be ingnored with a global flag in the Euler menu.
  
  overwrite: keyword to enable the redefinition of a protected function.
  
  Functions can be protected just as built-in functions. By default,
  protected functions can not be redefined. But the overwrite keyword
  unlocks the protection.
  
  function overwrite f (...)
  ...
  
  See: 
function (Euler Core)
trace

  Traces Euler functions.
  
  trace : toggle trace mode
  trace on,off : set trace mode
  trace function : toggles tracing the function
  
  While tracing is on, the following keys are available.
  
  cursor down : single step
  cursor up : step over subroutines
  cursor right : go until return
  cursor left : end trace
  insert : evaluate expression
  escape : abort execution
  
{, }, multiple

  return {a,b,c} : Returns multiple values from a function.
  
  {a,b,c}=f(...) : Assigns these values to variables.
  
  A{k} : The k-th element of the matrix A, as if A was flattened to a
  row matrix. Equivalent to redim(A,1,prod(size(A)))[k], but faster.
  Indices out of bounds produce an error. This works for string matrices
  too.
  
  A{i,j} : The i,j-th element of the matrix A, often like A[i,j].
  But for vectors, the index exceeding 1 will be set to 1. This
  allows functions obeying the matrix language of Euler, since
  f(A,B) will work for a row vector A and B, combining the proper
  elements, if A{i,j} and B{i,j} are combined. A{i,j} cannot be used for
  assignments. Indices out of bounds produce an error.
  
  See: 
= (Euler Core),
= (Maxima Documentation)
operator, postfix, prefix, strong

  function operator op (x,y) := ...
  function postfix f (x) := ...
  fucntion prefix g (x) := ...
  
  Define operators and postfix functions. Usage:
  
  4 op 5
  5 f
  g "test"
  
  The operators bind weakly. 
  
  1 + 5 op 6 + 1 -> (1+5) op (6+1)
  
  The modifier "strong" makes them bind strongly.
  
  >function strong operator op (x,y) := ...
  >1 + 5 op 6 + 1 // is like: 1 + (5 op 6) + 1
  
  There is no strong version of prefix functions.

Numerical Algorithms

There are more numerical algorithms in Euler than these core functions. You find an overview on the following pages.

and in some other introduction notebooks.
nelder, brent

  brent("f",a,d,eps) returns a minimum close to a. 
  The function goes away from a with step size d until it finds a good
  interval to start a fast iteration. Additional parameters are passed
  to f.
  
  The function fmin is recommended instead of this function.
  
  nelder("f",v,d,eps) return a minimum close to v.
  For multidimenional functions f(v), accepting 1xn vectors. d is the
  initial simplex size. eps is the final accuracy.
  
  See: 
nelder (Euler Core),
nelder (Numerical Algorithms),
neldermin (Numerical Algorithms),
brentmin (Numerical Algorithms),
fmin (Numerical Algorithms),
fmax (Numerical Algorithms)
runge1, runge2

  runge1("f",a,b,n,y) does n steps of the Runge-Kutta method to solve
  y'=f(x,y). y may be a 1xn vector or a real (the initial value), (a,b)
  is the x-interval.
  
  runge2("f",a,b,y,eps,step) does the same with adaptive step sizes. The
  initial size is step, and the accuracy is eps.
  
  The user should use runge, and adaptiverunge instead.
  
  See; runge,adaptiverunge
toeplitz, toeplitzsolve

  toeplitz(v) returns the Toeplitz matrix T to the vector v. 
  v must be a 1xn vector with odd n=2m+1. T has the property that
  T[i,j]=v[m+i-1-j]
  
  toeplitzsolve(v,b) : Solves T\b fast, where T is the Toeplitz matrix
  to v.
  
svd

  svd(A) : computes {U,v,W}, the singular value decomposition of A.
  A must be a real matrix. U,V are orthogonal, and we get
  
  A=U.diag([cols(A),cols(A)],0,v).W'
  
  A must have more rows than columns.
  
  See: 
svdsolve (Linear Algebra),
fit (Linear Algebra)
accu, accure, accuim, accua, accub

  The long accumulator in Euler is mainly used to compute an exact scalar
  product, necessary for residuum iteration. However, it can be used for
  other purposes as well. Euler cannot add or multiply two accumulators,
  but can add any value, or a product to the accumulator.
  
  The accu... functions gets the content of the long accumulator (or its
  real, imaginary (for complex accus), upper or lower (for interval
  accus) part.
  
  See: 
accuload (Euler Core),
accuadd (Euler Core),
residuum (Euler Core)
accuload, accuadd

  accuload(v) : Loads the sum of the vector v to the accumlutor.
  accuload(v,w) : Loads the scalar product of v and w.
  accuadd(v) : Adds the sum of the vector v to the accumulator.
  
  accuadd(v,w) : Adds the scalar product of v and w. 
  Both must be 1xn vectors.
  
  See: 
accu (Euler Core),
accure (Euler Core),
accua (Euler Core),
accub (Euler Core),
residuum (Euler Core)
residuum

  residuum(A,x,b) : Computes A.x-b exactly to the last digit. 
  A, x and b must be compatible matrices.
  
  See: 
xlgs (Exact Computation)

Units

Units can be converted in Euler. However, Euler does not check for correct application of units. It simply converts numbers. The final results should be stored in the international system (IS).

units, easyunits, ->

  Units are simple conversion constants in Euler. All units end with $,
  but it is possible to use them without $, if easyunits is set.
  
  easyunits on/off: sets or releases use of units without $.
  easyunits: toggles use of units without $.
  
  The -> operator convers units. If the conversion goes to a string, the
  units in this string will be used, and the units will be printed after
  the result.
  
  >2km/h->miles/min
   0.0207123730746
  >2km/h->" m/s"
   0.555555555556 m/s

Sparse Matrices

For large matrices containing lots of zeros, Euler has a special data type, which stores these matrices effectively. There are fast functions to operate on sparse matrices, including the Gauß-Seidel algorithm and the CG-Method.

For more information refer to the following pages.

cpx, decpx, cpxzeros, cpxset, cpxget, cpxmult

  These functions work with compressed matrices. These matrices store
  only the non-zero elements. There are functions to convert from and to
  compressed matrices. Large, sparse linear systems can be solved
  quickly.
  
  cpx(A): compresses a thin matrix to a compressed matrix A.
  The compressed matrix stores only the non-zero values of A. It
  consists of lines of the form (i,j,x), which means A[i,j]=x. Note that
  compressed matrices are a separate data type in Euler.
  
  decpx(C): De-compresses a compressed matrix to a full matrix.
  This is the reverse operation to cpx.
  
  cpxzeros([n,m]): Creates a new empty compressed matrix.
  To add elements to this matrix, use cpxset.
  
  cpxset(X,K): Sets elements of the compressed matrix X.
  K is a matrix containing lines of type (i,j,x). Then X[i,j] will be
  set to x. If the element already exists in X, it is replaced by the
  new value.
  
  cpxget(X): Matrix with lines (i,j,x[i,j]) with x[i,j]!=0.
  Inverse of cpxset.
  
  cpxmult(A,B) : Mmultiplies a compressed matrix A with a matrix B
  
cpxseidel

  cpxseidel(C,b,x,om): One step of the Gauss-Seidel algorithm for Cx=b.
  C must be a compressed matrix, x is the step to go from, and om is the
  relaxation parameter.
  
  See: 
seidel (Linear Algebra),
seidelX (Large and Sparse Matrices),
cgX (Large and Sparse Matrices)

Maxima

The main interface to Maxima should be the symbolic expression and the symbolic function. With the help of these, Maxima integrates seamlessly into Euler.

More commands are defined in a utility file. Those commands start with mxm..., and use Maxima to provide symbolic results at run time.

There are also commands in Maxima, which extend the Maxima syntax for Euler.

For a start and more information consult the following pages.

maxima, symbolic, &, &=, &:, ::, @:, ::=, &:=, &&=, $

  Maxima is a powerful, open Algebra system contained in Euler. By
  default, the Maxima process starts in the background, whenever Euler
  starts or is restarted. Note that Euler restarts by default when a new
  notebook is loaded.
  
  Maxima can be used directly or via symbolic expressions. The direct
  mode has a compatibility mode, which makes the syntax of Maxima and
  Euler more similar. It is the preferred mode.
  
  :: ... starts a Maxima command in compatibility mode.
  maxima ... is an alternative way to start a Maxima command.
  : ... starts a Maxima command in direct mode (disabled by default).
  
  &expression evaluates a symbolic expression. Returns the string
  evaluated in Maxima. An alternative is ::expression. The expression
  must be well formed. Maxima command flags can be appended using |, and
  with can be used to assign values. The expression can be enclosed in
  quotes.
  
  >&(x+4)^2 | expand
                                2
                               x  + 8 x + 16
  >&"diff(x^5,x,2) with x=5"
                                    2500
  
  The result in Euler is a string with the symbolic flag. It can be used
  line any other expression.
  
  >plot2d(&diff(sin(x)*x,x),0,2pi);
  
  function f(x) &= expression defines a function for Maxima and Euler.
  The expression is evaluated before the function is defined.
  
  >expr &= x^4;
  >function f(x) &= diff(expr,x)
                                       3
                                    4 x
  
  Symbolic functions assigns a symbolic expression to a variable in
  Maxima and Euler, after the expression has been evaluated by Maxima.
  
  a &&= expression assignes an expression only in symbolic form. The
  expression is evaluated before it is defined. This is useful if the
  expression contains functions, which cannot be evaluated numerically.
  
  function f(x) &&= expression defines a function for Maxima only. The
  expression is not evaluated in the case. It works like a macro. So
  this definition can be used for functions, which need to evaluate at
  run time with additional information.
  
  >function D2(f,x) &&= diff(f,x,2);
  >&D2(x^5,x) 
                                       3
                                   20 x
  
  &:expression returns the string, evaluated in Maxima, and evaluates
  the result in Euler. In functions, the string is inserted into the
  function body at compile time. Finish the command with , or ;, or
  enclose the expression in quotes.
  
  >function f(x) &= x^4;
  >function df(x) := &:diff(expr,x);
  >type df
   function df (x)
   useglobal; return 4*x^3; 
   endfunction
  
  @:expression works like &:expression (deprecated)
  
  a &:= value sets the value for both Euler and Maxima.
  a ::= value does the same (deprecated)
  
  $expression is a symbolic expression like &expressions. But it
  prints with Latex, if Latex is installed. There might be a short
  delay, if such a command is executed.
  
  See: 
mxmstart (Maxima Functions for Euler),
mxmset (Maxima Functions for Euler),
mxmget (Maxima Functions for Euler),
function (Euler Core)
@, @@

  @expr : Is replaced with the content of the variable expr in symbolic
  exressions, Maxima commands, and function definitions at compile time.
  It is an alternative to symbolic expressions, in case the expression
  is defined in an Euler string only. But it will also work for
  numerical values and even matrices.
  
  >expr:="x^5"; &diff(@expr,x)
                                       4
                                    5 x
  >a=solve("x^x",1,y=2), &bfloat(@a^@a)
   1.55961046946
                    1.9999999999999988897769753748435b0
  >v=1:5; &map(sqrt,@v)
                     [1, sqrt(2), sqrt(3), 2, sqrt(5)]
  
  In function definitions, @expr inside strings is not replaced at
  compile time. Therefore, &"diff(@expr,x)" in functions replaces @expr
  at run time, and computes the derivative then.
  
  >function dtest (expr,var) := &"diff(@expr,@var)"
  >type dtest
   function dtest (expr, var)
   useglobal; return &"diff(@expr,@var)" 
   endfunction
  >dtest("x^4","x") 
                                       3
                                    4 x
  
  @@ : In Maxima and symbolic expressions, this allows the input of a
  "@".
  
  See: 
mxm (Euler Core)
mxm

  mxm("diff(x^2,x)") Evaluates in Maxima. 
  The result is a string. This is deprectated. Use &diff(x^x,x) instead.
  
  Note that @a is replaced by the content of the variable a, if @a is
  contained in the Maxima command.
  
  >expr := "x^3-x"
   x^3-x
  >mxm("diff("+expr+",x)")
   3*x^2-1
  >&diff(@expr,x)
                                     2
                                  3 x  - 1
  
  See: 
mxmeval (Maxima Functions for Euler),
@ (Euler Core),
@ (Maxima Documentation)
maximamode, euler

  Toggles Maxima mode. If on, all commands are sent to Maxima. In maxima
  mode, euler ... will send the command to Euler.
  
  maximamode: Toggles the mode
  maximamode on: Compatibility mode
  maximamode direct: Direct mode
  maximamode off: Maxima mode is off
  
tex

  tex(expression) produces the Latex output for the string.
  The string could be a symbolic expression.
  
  maxima: expression
  Can be used in comments to produce a Latex formula of the expression.
  
  latex: expression
  Directly produces a Latex formula. The expression must be a valid
  Latex code.
  
  Latex needs to be installed for both of these.
  
  >tex("integrate(x^2,x)")
   \frac{x^3}{3}
  >tex("'integrate(x^2,x)")
   \int {x^2}{\;dx}
  >intrandom(2,2,6); tex(frac(%))
   \begin{pmatrix}3 & 5 \\ 3 & 2 \\ \end{pmatrix}
  

The following functions are symbolic functions defined in a file, which is loaded every time Maxima starts. These functions are extensions to the Maxima syntax specific to Euler.

grad, hesse, diffat

  grad(epxression) symbolic: Gradient of expression
  The variables are sorted alphabetically.
  
  gradient(expression,variable) symbolic: Gradient of expression
  
  hesse(expression) symbolic: Hessian of expression
  The variables are sorted alphabetically.
  
  hessian(expression,[variables]) symbolic: Hessian of expression
  
  diffat(expression,x=value{,n}) symbolic: Evaluated differentiation
  Works like diff(expression,x,n) with x=value
  
crossproduct, scalp

  crossproduct(v,w) symbolic: Crossproduct in 3-space
  
  scalp(v,w) symbolic: Scalar product
  
getlagrange, solvelagrange

  getlagrange(f,g,[variables]) symbolic: Get Lagrange equations
  for extremals of f(variables) with the condition g(variables)=0.
  
  getlagrange(f,g) symbolic: Get Lagrange equations
  Use the variables of f.
  
  solvelagrange(f,g,[variables]) symbolic: Solve Lagrange equations
  for extremals of f(variables) with the condition g(variables)=0.
  
  solvelagrange(f,g) symbolic: Solve Lagrange equations
  Use the variables of f.
  
with

  with: expression with [var=value,var=value,...] (symbolic)
  with: expression with var=value (symbolic)
  Evaluate the symbolic expressions and assign variable values.
  Works like at(expression,assignments)
  

Various Commands

magic

  magic(n) creates a magic square of size n>=3.
  
  >shortestformat; magic(3)
           8         1         6 
           3         5         7 
           4         9         2 
  >magic(6)
          32        29         4         1        24        21 
          30        31         2         3        22        23 
          12         9        17        20        28        25 
          10        11        18        19        26        27 
          13        16        36        33         5         8 
          14        15        34        35         6         7 
matlab

  matlab on
  matlab off
  matlab
  
  Toggle the Matlab mode. In this mode the syntax of Euler is closer
  to Matlab. For a reference read the documentation about Euler and
  Matlab.
  
tic, toc

  tic; ... commands ... toc; measures the time of the commands
  in millisecond resolution.
  
  >tic; inv(normal(100,100)); toc;
   Used 0.047 seconds
   
playwave

  playwave(string) : Play a sound file in WAV format.
printf

  printf(format,x) : Prints x in the format
  There the format string is a C type format using C format strings
  %..., as in printf("x=%15.10f",x). Make sure, not to use more format
  strings than values.
  
  See: 
print (Output Formats),
print (Maxima Documentation),
| (Euler Core),
| (Maxima Documentation)
time, wait

  time() : The time in seconds.
  
  wait(n) or wait(n,text): waits for n seconds (text for status line).
  This functions interrupts, if the user presses a key. Returns
  {time,key} the time waited, and a key, if one was pressed.
  
  See: 
key (Euler Core),
key (Maxima Documentation)
epsilon, setepsilon, localepsilon, relerror

  epsilon() : The internal epsilon used for various purposes.
  setepsilon(x) : sets the internal epsilon.
  localepsilon() : sets the epsilon locally for a function.
  
  Some numerical algorithms allow to set the local epsilon using an
  assigned argument eps=...
  
  relerror(x,y) : |x-y|/|y| for y<>0, and x for y~=0.
  
  >bisect("x^2-2",0,2)
   1.41421356237
  >bisect("x^2-2",0,2,eps=0.001)
   1.41455078125
  
  See: 
~= (Euler Core)
free, hexdump, memorydump, list, listvar, forget, clear, clearall, remvalue, type

  free() : The free space on the stack.
  
  list : lists all built-in functions, commands and all functions.
  list string: lists only items containing the string.
  
  listvar: lists all variables, their types and sizes.
  listvar string: lists all variables containing the string.
  
  clear var,... : removes the variables.
  clearall : removes all user variables, but not default variables and
  %variables.
  
  remvalue var,... : removes the variables
  
  forget function,... : removes the functions.
  
  hexdump var : dumps the variable or user defined function var 
  in hexadecimal form.
  
  type function : Type the code of a function
  type var : Type the content of a variable
  
  See: 
restart (Euler Core)
restart

  Restarts Euler and its notebooks. All variables and user functions
  are lost. Usually, this function is called using the menu entry.
  
  See: 
clear (Euler Core),
forget (Euler Core),
forget (Maxima Documentation),
remvalue (Euler Core),
remvalue (Maxima Documentation)
name

  name(var) : The name of the variable var.
  
  See: 
%, %%

  %: is the result of the previous command (not assignment). This works
  in Maxima and Euler. In symbolic expressions, % refers to the previous
  Euler result. If this is another symbolic expression, % is replaced
  by this symbolic expression (in brackets). In Maxima lines, it refers
  to the previous Maxima result. Over several command lines, is safer to
  use variables.
  
  %%: Is used in Maxima block commands to refer to the previous result.
  So &(x^2,%%^2) yields x^4.
  
relax

  relax : Command to relax strict mode, when reading an Euler file.
  
  Strict mode inhibits certain old constructions. It can be switched off
  in the Euler menu. For Euler files some of these regulations are
  relaxed, but not all. To relax all regulations, start the Euler file
  with the relax command.
  
addmenu, submenu

  addmenu command : Adds the command to the user menu.
  The command can contain place holders as ?item. Whenever the user
  places the cursor in front of the question mark and starts typing, the
  place holder is removed. If the line contains a place holder, the
  cursor right key positions the cursor in front of the next place
  holder.
  
  submenu command : Generates a new submenu in the user menu.
  The default submenu is the filename of the Euler file, or "Other".
  
  The user menu is cleared at each restart.

A dynamic link libraries (DLL) is a Windows feature to add functions to a running program. In Euler, it is possible to compile external functions in DLLs. You can find more information on this in the following notebook.

dll, closedll, tccompile

  dll(name,function,n) : Loads the function f (a string) from the dll
  with the name, assuming it has n arguments.
  
  closedll(name) : Unload the DLL.
  
  tccompile filename; Compile the C file with tccompile.
errors, isNAN, NAN, underflows

  Handles generation of NAN (not a number) or error messages.
  
  errors on, off: Turn error messages on or off
  
  NAN : Not a number
  
  isNAN(x) : Tests, if x is a NAN
  
  underflows on, off: Turns underflows for ^ and exp on and off. The
  default is off.
  
%

  % contains the recent result of Euler and Maxima
  (different for Euler and Maxima).
  
setkey

  setkey(n,text) : Sets the keyboard function key n to the text.
  
  Some function key do not work without the Ctrl or Shift key.
  
exec, message, execwrite, execwriteln, execread

  exec("command","arguments","directory",print,hidden,wait) : external command.
  For details have a look at the utility functions exec.
  
  execwrite(string) : Write a string to an open pipe.
  execwriteln(string) : Write a string and a new line to an open pipe.
  
  execread() : Reads strings from an open pipe.
  The return value is a vector of strings, one for each line.
  
  message("This is a message") : Shows a dialog with this message. 
  Use "First line"+nl$+"Second Line" for line breaks.
  
  See: 
cd (Euler Core),
exec (Euler Core),
exec (Basic Utilities)
yacas, yacasclear, yacasmode

  Yacas is no more recommended for Euler. If you still want to use
  it, you need to enable it in the menu. Then you can enter a Yacas
  commands with >>...
  
  yacas(expr) : lets Yacas evaluate the expression. 
  It returns the result string or the Yacas error message.
  
  yacasclear() : starts a new Yacas session.
  
  yacasmode (on|off) : toggles or sets Yacas mode.
  In Yacas mode, it is possible to use Euler commands with
  euler ...
  
  >yacas ... : Sends a command to Yacas in Euler mode.
  >> ... : Sends a command to Yacas in Euler mode.
  
  >yacas("D(x) x^x")
   x^x*(Ln(x)+1)
  
  See: 
converty (Yacas),
y2matrix (Yacas),
y2vector (Yacas),
ynewton (Yacas),
mxm (Euler Core),
mxmeval (Maxima Functions for Euler)

Documentation Homepage