Macaulay2 » Documentation
Packages » Macaulay2Doc > The Macaulay2 language > operators > *
next | previous | forward | backward | up | index | toc

* -- a binary operator, usually used for multiplication

Synopsis

Description

The return type depends on the types of x and y. If they have the same type, then usually the return type is the common type of x and y.

Multiplication involving ring elements (including integers, rational numbers, real and complex numbers), ideals, vectors, matrices, modules is generally the usual multiplication, or composition of functions.

The intersection of sets is given by multiplication. See Set * Set.
i1 : set{hi,you,there} * set{hi,us,here,you}

o1 = set {hi, you}

o1 : Set

Multiplication involving a list attempts to multiply each element of the list.
i2 : R = QQ[a..d];
i3 : a * {b,c,d}

o3 = {a*b, a*c, a*d}

o3 : List

Multiplication of matrices (Matrix * Matrix) or ring maps is the same as composition.
i4 : f = map(R,R,{b,c,a,d})

o4 = map (R, R, {b, c, a, d})

o4 : RingMap R <-- R
i5 : g = map(R,R,{(a+b)^2,b^2,c^2,d^2})

                  2           2   2   2   2
o5 = map (R, R, {a  + 2a*b + b , b , c , d })

o5 : RingMap R <-- R
i6 : f*g

                  2           2   2   2   2
o6 = map (R, R, {b  + 2b*c + c , c , a , d })

o6 : RingMap R <-- R
i7 : (f*g)(a) == f(g(a))

o7 = true

Submodules of modules may be produced using multiplication and addition.
i8 : M = R^2; I = ideal(a+b,c);

o9 : Ideal of R
i10 : N = I*M + a*R^2

o10 = image | a+b 0   c 0 a 0 |
            | 0   a+b 0 c 0 a |

                              2
o10 : R-module, submodule of R
i11 : isHomogeneous N

o11 = true

Intervals

If one of the factors is an RRi, the output is an interval containing all products of pairs in the factors.

i12 : 2*interval(1,3)

o12 = [2,6]

o12 : RRi (of precision 53)
i13 : interval(1,3)*interval(-1,2)

o13 = [-3,6]

o13 : RRi (of precision 53)
i14 : interval(-1,1)*interval(-1,1)

o14 = [-1,1]

o14 : RRi (of precision 53)

See also

Ways to use symbol * :

For the programmer

The object * is a keyword.

This operator may be used as a binary operator in an expression like x*y. The user may install binary methods for handling such expressions with code such as

         X * Y := (x,y) -> ...

where X is the class of x and Y is the class of y.

This operator may be used as a prefix unary operator in an expression like *y. The user may install a method for handling such expressions with code such as

           * Y := (y) -> ...

where Y is the class of y.