All commands: nonletters (random order)

This page contains the description of the following commands and operators that do not start with a letter. %e, %i, ^, ^^, **, +, *, ..., :=, ::=, -, =date, = /=date, < <= <> <?> <date, <=date, > >= >date, >=date, &nobind, 1+ 1- 1/ 0-


%i (Symbolic constant)

When you say #C(0 1), this creates a complex number, with real part zero, imaginary part minus one; the square of this number is minus one. When you say sqrt(-1), you get a similar number, except that the imaginary part is a floating point number, instead of an integer, its square is the floating point number minus one. The Lisp printer prints, by default, complex numbers as [3i+2], and the symbolic printer prints then as 2 + 3 %i. The symbolic constant is understood by the symbolic evaluator; it is not a number, but its square is simplified to minus, see the power function. In Endymin, any symbol can be used as a function, in the case of %i, no arguments can be supplied (thus, this is of little interest).

%e (Symbolic constant)

This constant is the value of exp(1); see examples below for the behaviour of the symbol. The symbol is considered to have one as arity, i.e., it behaves like a function with one argument; as a consequence, a substitution like in example (6) is possible.

(1) exp(1);

(1)                                   %e

(2) %e**log(x);

(2)                                   x

(3) %e(100);

(3)                                %e(100)

(4) %e(a,b);
%e : wrong number of arguments : 2 this should be 1
(5) %e:=10;
eval : not a variable : %e

(6) a:=f(%e(log(u+v)));

(6)                           f(%e(log(u + v)))

(6) subst(%e=exp,a);

(6)                                f(u + v)

a^^b (Symbolic operator)

This computes the non-commutative power. This is useful only for matrices. An error is signaled if the first argument is a non-square matrix. Normal poser is used is the first argument is a number.

(1) x^^2;

(1)                                 x ^^ 2

(2) m1:=#MD 2 2 1 2 3 4;

                                    [1  3]
(2)                                 [    ]
                                    [2  4]

(3) m2:=#MD 2 3 1 2 3 4 5 6;

                                  [1  3  5]
(3)                               [       ]
                                  [2  4  6]

(4) m1^^2;

                                   [7   15]
(4)                                [      ]
                                   [10  22]

(5) m2^^2;
                        /[1  3  5]   \
^^ : Cannot compute : ^^|[       ], 2|
                        \[2  4  6]   /
(6) m1^^n;

                                 [1  3]
(6)                              [    ] ^^ n
                                 [2  4]

(7) m2^^n;
                        /[1  3  5]   \
^^ : Cannot compute : ^^|[       ], n|
                        \[2  4  6]   /
(8) 2^^n;

                                       n
(8)                                   2

a^ba**b   (Symbolic function/operator)

(** a b) (Lisp function)

If you say power(a,b), a**b or a^b in symbolic mode, the result is the b-th power of a. This is an extension of the Lisp function **, called in the case where arguments are numbers. We start with some examples in Lisp mode. Notice that a**b uses multiplications if b is an integer, and in general exp(b*log(a)) is computed. This explains why, in case of an error, the function shown is never the power function.

[Endymion] (** 2 100)
1267650600228229401496703205376
[Endymion] (** 2 -100)
1/1267650600228229401496703205376
[Endymion] (sqrt (** 2 100))
1125899906842624
[Endymion] (** (** 2 100) 1/2)
1.12589990684262e+15
[Endymion] (** #C(0 1) 2)
-1
[Endymion] (** #C(2 3) 1/2)
[0.895977476129838i+1.67414922803554]
[Endymion] (** #C(2 3) #C(4 5))
[-0.986428788647745i-0.75304583674856]
[Endymion] (** 0 0)
1
[Endymion] (** 0 -1)
1/ : division by zero : 0
[Endymion] (** "foo" 3)
* : not a number : foo
[Endymion] (** "foo" -3)
/ : not a number : foo
[Endymion] (** "foo" 1.3)
log : not a real number : foo
[Endymion] (** 3 "foo")
* : not a number : foo

Same in symbolic mode. In case of error, the last argument has the form: applyq("**",a,b),

(1) 2^100;

(1)                    1267650600228229401496703205376

(2) 2^-100;

                                      1
(2)                    -------------------------------
                       1267650600228229401496703205376

(3) (2^100)^1/2;

(3)                     633825300114114700748351602688

(4) (2^100)^(1/2);

(4)                          1.12589990684262e+15

(5) %i^2;

(5)                                  - 1

(6) (2+3*%i)^(1/2);

                                   |--------
(6)                               \|2 + 3 %i

(7) #C(2,3)^(1/2);

(7)                1.67414922803554 + 0.895977476129838 %i

(8) #C(2,3) **  #C(4 5);

(8)               - 0.75304583674856 - 0.986428788647745 %i

(9) 0^-1;
** : Cannot compute : **(0, - 1)
(9) "foo"^3;
** : Cannot compute : **(foo, 3)
(10) exp("foo");
exp : Cannot compute : **(%e, foo)
(11) sqrt("foo");
                          /     1\
sqrt : Cannot compute : **|foo, -|
                          \     2/
(12) x:="foo"?; 2/x;
/ : Cannot compute : **(foo, - 1)
(14) inv(x);
inv : Cannot compute : **(foo, - 1)

Other examples in symbolic mode. The result depends on the setting of the variables logsimp, that can be false, true or all.

(1) a^(b=c);

                                    b    c
(1)                                a  = a

(2) (a=b)^c;

                                    c    c
(2)                                a  = b

(3) [f(x)^1, f(x)^0, 1^f(x), 0^ f(x)];

(3)                            [f(x), 1, 1, 0]

(4) [%i^8,%i^9,%i^10, %i^11, %i^(17/4), %i^(26/5),%i^(37/6),%i^(50/7)];

                                   1/4    6/5      1/6      8/7
(4)           [1, %i, - 1, - %i, %i   , %i   , - %i   , - %i   ]


(5) [abs(x)^3, abs(x)^4, abs(x)^(2/3), abs(x)^y ];

                               3   4     2/3     y
(5)                        [|x| , x , |x|   , |x| ]


(6) [ %e^(a+b), %e^(a*b),%e^(log(a)), %e^a ];

                              a + b    a b       a
(6)                        [%e     , %e   , a, %e ]

(7) [ exp(a+b), exp(a*b), exp(log(a)), exp(a) ];

                              a + b    a b       a
(7)                        [%e     , %e   , a, %e ]

(8) [ exp(a*log(b)), exp(a*b*log(c)), exp(a*log(b)*log(c)) ];

                   a log(b)    a b log(c)    a log(b) log(c)
(8)             [%e        , %e          , %e               ]

(9) let(logsimp=true,[ exp(a*log(b)), exp(a*b*log(c)), exp(a*log(b)*log(c))]);

                      a    a b log(c)    a log(b) log(c)
(9)                 [b , %e          , %e               ]

(9) let(logsimp=all,[ exp(a*log(b)), exp(a*b*log(c)), exp(a*log(b)*log(c))]);

                          a   a b    a log(b) log(c)
(9)                     [b , c   , %e               ]

(10)  exp(2*log(%i));

                                   2 log(%i)
(10)                             %e

(11) let(logsimp=true, exp(2*log(%i)));

(11)                                 - 1

(12) exp(a*log(b)+a*b*log(c)+log(d)+ f(x));

                     f(x) + log(d) + a b log(c) + a log(b)
(12)               %e

(13) let(logsimp=true, exp(a*log(b)+a*b*log(c)+log(d)+ f(x)));
 
                           a     f(x) + a b log(c)
(13)                      b  d %e

(14) let(logsimp=all, exp(a*log(b)+a*b*log(c)+log(d)+ f(x)+2));

                              a  a b     2 + f(x)
(14)                         b  c    d %e

Other examples. (a^b)^c gives a^(b*c) if there is no simplification between the numerator of b and the denominator of b. If radexpand is true, simplification always occur. If you compare examples 1 and 2 you see the problem: if expop is large, (-x)^2 expands to x^2, and the square root is not well-defined. The rules are the following: if either b or c is not a rational number, simplification occurs if radexpand is set (true or all). If b is minus one, or if c is an integer, simplification occurs. If den(c) is coprime to num(b), simplification occurs. Otherwise the gcd of num(c) and den(b), is ssimplified.

(1) let([radexpand=all], [(a^b)^c, ((-x)^2)^(1/2), ((-%i)^2)^(1/2) ]);

                                b c
(1)                           [a   , - x, - %i]

(2) let([expop=2,radexpand=all], [ ((-x)^2)^(1/2), ((-%i)^2)^(1/2) ]);

(2)                                [x, %i]

(3) let([radexpand=false], [(a^b)^c, ((-x)^2)^(1/2), ((-%i)^2)^(1/2) ]);

                        [         |------   |-------]
                        [  b  c   |     2   |      2]
(3)                     [(a )  , \|(- x) , \|(- %i) ]


(4) [ (a^(3/4))^10, (a^b)^10, (a^(-1))^b ]; 

                              [ 15/2   10 b  1 ]
(4)                           [a    , a    , --]
                              [               b]
                              [              a ]

(5) [ (a^(10))^(3/4), (a^10)^b  ]; 

                                 10 3/4    10 b
(5)                           [(a  )   , (a  ) ]


(6) let(radexpand=true,[ (a^(10))^(3/4), (a^10)^b  ]); 

                                 10 3/4   10 b
(6)                           [(a  )   , a    ]

(7)  [(a^(11*5/3))^(2/7/11),  (a^(11*5/3/13))^(13*2/7/11) ];

                             55/3 2/77    55/3 2/77
(7)                       [(a    )    , (a    )    ]

(8)  [(a^(5/3))^(2/7),  (a^(5/3/13))^(13*2/7) ];

                                 10/21   10/21
(8)                            [a     , a     ]

(9) (b^(35/3)) ^(9/5);

                                     35 3/5
(9)                                (b  )

(10) %^5;

                                      105
(10)                                 b

Power of sums and products depend on expop and expon

(3) [ (a*b)^10, (a+b)^10, (a*b)^100, (a+b)^100 ];

                        10         10       100         100
(3)               [(a b)  , (a + b)  , (a b)   , (a + b)   ]

(4) let(expop=50, [ (a*b)^10, (a+b)^10, (a*b)^100, (a+b)^100 ]);

       10  10   10    10         9       2  8        3  7        4  6
(4)  [a   b  , a   + b   + 10 a b  + 45 a  b  + 120 a  b  + 210 a  b

        5  5        6  4        7  3       8  2       9         100
 + 252 a  b  + 210 a  b  + 120 a  b  + 45 a  b  + 10 a  b, (a b)   , 

       100
(a + b)   ]

(5) let(expon=50, [ (a*b)^-10, (a+b)^-10, (a*b)^-100, (a+b)^-100 ]);

                     [   1     1      1          1     ]
(5)                  [-------, --, --------, ----------]
                     [ 10  10  %1       100         100]
                     [a   b        (a b)     (a + b)   ]

x1 + ... + xn (Symbolic function/operator)

(+ x1 ... xn) (Lisp function)

x++ (Symbolic postfix operator)

Without arguments, the plus function returns zero, otherwise the sum. The symbolic version is an extension of the Lisp function. Note: in symbolic mode, there is a postfix operator and x++ is the same as x:=x+1 (see incr1 for details). There is also a prefix operator. In the case of +x+y+z, the plus function is called, with three arguments; the first argument is defined by+x, this is the unary plus applied to x.

[Endymion] (+)
0
[Endymion] (+ 1)
1
[Endymion] (+ 1 2 3 4 5 6 7 8)
36
[Endymion] (+ 1.0 1.L0)
2.L0
[Endymion] (+ %e %i)
+ : not a number : %e
[Endymion] (+ 2/3 #C(0 4))
[4i+2/3]
(1) 1+2+3+4+5+6+7+8;

(1)                                   36

(2) 1=2 + 3/4=5/6;

                                      11   5
(2)                               1 = -- = -
                                      4    6

(3) (1=2) + (3/4=5/6);

                                    7   17
(3)                                 - = --
                                    4   6

(4) %i+%e+%i;

(4)                               %e + 2 %i

(5) "foo"+"bar";
Bad type in arithmetic function: string for foo
Bad type in arithmetic function: string for bar
Error : Cannot compute : +(foo, bar)

x1 * ... * xn    (Symbolic function/operator)

(* x1 ... xn) (Lisp function)

Without arguments, the star function returns one, otherwise the product. The symbolic version is an extension of the Lisp function.

[Endymion] (*)
1
[Endymion] (* 2)
2
[Endymion] (* 1 2 3 4)
24
[Endymion] (* 1/2 3/4 5/6 7/8 9/10)
63/256
[Endymion] (* %e %i)
* : not a number : %e
[Endymion] (* 0 %e %i)
* : not a number : %e
[Endymion] (* %e %i 0)
* : not a number : %i
[Endymion] (* 0 3.5l0)
0
[Endymion] (* #C(2 3) #C(4 5))
[22i-7]

Same in symbolic mode

(2) 1/2*3/4*5/6*7/8*9/10;

                                     63
(2)                                  ---
                                     256

(3) %e*%i;

(3)                                 %e %i

(4) %e*%i*%e*%i;

                                        2
(4)                                 - %e

(5) (2+3*%i)*(4+5*%i);

(5)                         (2 + 3 %i) (4 + 5 %i)

(6) expand((2+3*%i)*(4+5*%i));

(6)                              - 7 + 22 %i

(7) "foo"*true;
Bad type in arithmetic function: string for foo
Bad type in arithmetic function: boolean for TRUE
Error : Cannot compute : *(foo, TRUE)

If sums appear in a product, the value of the variables expop and expon are looked at. They are in general zero; you can use expand to temporarily change them (the default value is then maxposex and maxnegex that have great values). In the case of 2*(x+y), or more generally, in the case of a product of a number and a sum, the result is expanded to (2*x)+(2*y), if either expop is positive, or expon is positive, or negdistrib is all, or negdistrib is true and the number is minus one. Note that -x or neg(x) multiplies x by minus one, and sets negdistrib to a non-false value. In the case of a*(x+y), the result is expanded to (a*x)+(a*y), if either expop or expon is positive. Expansion of (a+b)*(x+y) holds under the same conditions. If the sums are on the denominator, expansion occurs if expon is positive. In the case of A power B, expansion occurs if B is less than expop, and on the denominator, if the absolute value of B is less than expon. Note: in the example 9 below, the expression shown as 1/XY is the product of 1/X and 1/Y,

(1)  X:=(a+b)*(c+d)*x/(u+v)/(w+t);

                              x (a + b) (c + d)
(1)                           -----------------
                               (t + w) (u + v)

(2) expand(X);

             a c x                   a d x                   b c x
(2)  --------------------- + --------------------- + ---------------------
     t u + t v + u w + v w   t u + t v + u w + v w   t u + t v + u w + v w

           b d x
 + ---------------------
   t u + t v + u w + v w

(3) expand(X,1,0);

          a c x             a d x             b c x             b d x
(3)  --------------- + --------------- + --------------- + ---------------
     (u + v) (t + w)   (u + v) (t + w)   (u + v) (t + w)   (u + v) (t + w)

(4) expand((a+b)^(-10), 10, 5);


                                      1
(4)                               ---------
                                         10
                                  (a + b)

(5) expand((a+b)^(-10), 10, 15);
       10    10         9       2  8        3  7        4  6        5  5
%1 := a   + b   + 10 a b  + 45 a  b  + 120 a  b  + 210 a  b  + 252 a  b

        6  4        7  3       8  2       9
 + 210 a  b  + 120 a  b  + 45 a  b  + 10 a  b


                                      1
5)                                   --
                                      %1

(6) expand((a+b)^10);

(6)                                   %1

(7) expand((a+b+c+d)^40);


       40    40    40    40                37                2  36
(7)   a   + b   + c   + d   + 59280 a b c d   + 1096680 a b c  d

display aborted
(8) expand((%i+1000)^1000);

(8)          Number with 3000 digits + Number with 3001 digits %i

(9) expand(1/(a+b)/(c+d),1,0);

                                      1
(9)                            ---------------
                               (c + d) (a + b)

(10) expand(((a+b)*(c+d))^ -1,1,0);

                                      1
(10)                        ---------------------
                            a c + a d + b c + b d


x1 - x2     (Symbolic operator)

(#:feval:- x1 ... xn) (Symbolic function)

x-- (Symbolic postfix operator)

(- x1 ... xn) (Lisp function)

Without arguments, the minus function returns zero, with a single argument, it returns the opposite of it, with two arguments, it returns the difference, with more, it returns the difference between the first and the sum of the otherw. The symbolic function has the same behavior, and the symbolic operator is the binary version of it. In other words, in Lisp mode (- a b c) is the same as (- a (+ b c)), in symbolic mode a-b-c is read as (a-b)-c. If no error is signaled, the result is the same. Instead of 0-x you can say -x, this calle the minus function with a single argument. The Lisp function accepts only numbers, the symbolic version is an extension of it. See also +, neg. Note: in symbolic mode, there is a postfix operator and x-- is the same as x:=x-1 (see decr1 for details).

[Endymion] (-)
0
[Endymion] (- 1)
-1
[Endymion] (- 1 10)
-9
[Endymion] (- 1 10 100)
-109
[Endymion] (- 1/2 3/4 5/6)
-13/12
[Endymion] (- "foo" "bar")
- : not a number : bar
[Endymion] (- %e %i)
- : not a number : %i
[Endymion] (#:feval:- %e %i)
#:fexpression:#[+ (%e #:fexpression:#[* (-1 %i)])]

In the example that follows, we show how symbol("-") can be used as a prefix operator, this calls #:feval:-, with a variable number of arguments. We also show an error: the compiler signals a potential problem with the type of the arguments. The real problem occurs when Endymion wants to multiply the argument by minus one. The last example shows the interaction between equalities and other arithmetic operations.

(1) %e-%i;

(1)                                %e - %i

(2) symbol("-")(1/2, 3/4, 5/6);

                                       13
(2)                                  - --
                                       12

(3) #:feval:-(1/2,3/4,5/6);

                                       13
(3)                                  - --
                                       12

(4) "foo"-"bar";
Bad type in arithmetic function: string for foo
Bad type in arithmetic function: string for bar
Error : Cannot compute : -(foo, bar)
(5) (a=b)-(x=y);

(5)                             a - x = b - y

(=date date1 date2) (Lisp function)

Returns true if the first date is the same as the second. See example below.

(/=date date1 date2) (Lisp function)

Returns true if the first date is not the same as the second. See example below.

(<>date date1 date2) (Lisp function)

Returns true if the first date is not the same as the second. See example below.

(<=date date1 date2) (Lisp function)

Returns true if the first date is less or equal than the second. See example below.

(<date date1 date2) (Lisp function)

Returns true if the first date is less than the second. See example below.

(>=date date1 date2) (Lisp function)

Returns true if the first date is greater or equal than the second. See example below.

(>date date1 date2) (Lisp function)

Returns true if the first date is greater than the second. See example below.

[Endymion] (defun test (x y) (list
[Endymion]   (eqdate x y) (=date x y) (/= date x y) (<>date x y)
[Endymion]   (<date x y) (<=date x y) (>date x y) (>=date x y)))
test
[Endymion] (defun F (x y) (append (test x y) (test y x)))
F
[Endymion] (F (date) (date))
(true true () () () true () true true true () () () true () true)
[Endymion] (F #:date:#[2005 1 2 3 4 5] #:date:#[2005 1 2 3 4 5])
(true true () () () true () true true true () () () true () true)
[Endymion] (F #:date:#[2006 1 2 3 4 5] #:date:#[2005 1 2 3 4 5])
(() () true true () () true true () () true true true true () ())
[Endymion] (F #:date:#[2005 2 2 3 4 5] #:date:#[2005 1 2 3 4 5])
(() () true true () () true true () () true true true true () ())
[Endymion] (F #:date:#[2005 1 3 3 4 5] #:date:#[2005 1 2 3 4 5])
(() () true true () () true true () () true true true true () ())
[Endymion] (F #:date:#[2005 1 2 4 4 5] #:date:#[2005 1 2 3 4 5])
(() () true true () () true true () () true true true true () ())
[Endymion] (F #:date:#[2005 1 2 3 5 5] #:date:#[2005 1 2 3 4 5])
(() () true true () () true true () () true true true true () ())
[Endymion] (F #:date:#[2005 1 2 3 5 6] #:date:#[2005 1 2 3 4 5])
(() () true true () () true true () () true true true true () ())

&nobind (keyword)

If the variable list of a function is &nobind, then parameters are not bound to variables (at least if the code is compiled). You get the value of a parameter via (arg); see description of this function where there is an example of use.

x := y     (Symbolic operator)

The construction x:=y is a symbolic assignment. Details are given here

x ::= y     (Symbolic operator)

The construction x::=y defines a symbolic macro. Details are given here

x ... y step z    (Symbolic operator)

The construction 1...10 step 3 gives a sequence containing 1, 4, 7, and 10. The construction 10...1 negstep 3 gives the same in reverse order. If neither step nor negstep is given, the step is one. See makeseq_int for details.

(1+ x) (Lisp function)

The expression (1+ x) is the same as (+ 1 x), it is a bit more efficient if the argument is a small integer.

(1- x) (Lisp function)

The expression (1- x) is the same as (- x 1), it is a bit more efficient if the argument is a small integer.

(1/ x) (Lisp function)

The expression (1/ x) is the inverse of x. The argument can be a number, or a saqure matrix.

(0- x) (Lisp function)

The function 0- computes the opposite of its argument, which can be a number, a polynomial or a matrix.

(<?> x1 x2)(Lisp function)

(<> x1 x2)(Lisp function)

(< x1 x2... xn)(Lisp function)

(> x1 x2... xn)(Lisp function)

(<= x1 x2... xn)(Lisp function)

(>= x1 x2... xn)(Lisp function)

(= x1 x2... xn)(Lisp function)

The function call (<?> x y) compares the arguments x and y. The result can be -1 (smaller), +1 (greater), 0 (equal) or nil otherwise (if one of the arguments is not a real number, or in case of BigFloats that cannot be compared). The function (<> x y) compares the numbers in the same way. But in case of equality it returns nil otherwise x; note that the first argument is returned if one of the two arguments is not a real number, even though both arguments could be the same. The functions <, <=, >, >= = take n arguments; if n is less than two, the result is nul. If the arguments are in order, then x1 is returned, otherwise nil is returned; arguments are compared with <?> .

[Endymion] (<?> 1 2)
-1
[Endymion] (<?> 2 2)
0
[Endymion] (<?> 2 1)
1
[Endymion] (<?> 3/4 0.75)
0
[Endymion] (<?> 3/4 0.75L0)
()
[Endymion] (<?> 3/4 0.76L0)
-1
[Endymion] (<?> 'x 'y)
()
[Endymion] (<?> 'x 'y)
()
[Endymion] (<> 'x 'y)
x
[Endymion] (<> 1 2)
1
[Endymion] (<> 1. 1)
()
[Endymion] (<)
()
[Endymion] (< 1 2 3)
1
[Endymion] (> 3 2 1)
3
[Endymion] (> 3)
()
[Endymion] (> 3 'x 1)
()
[Endymion] (<= 1 2 2.5 5/2 3)
1
[Endymion] (< 1 2 2.5 5/2 3)
()
[Endymion] (<= 1 2 2.5 5/2 3 0)
()
[Endymion] (= 1 1 1 1 1)

Valid XHTML 1.0 Strict back to home page © INRIA 2005, 2006 Last modified $Date: 2009/01/08 17:43:30 $