Kernel: Python 3
weight.multiply
This function is overloaded, it supports these signatures:
weight.multiply(w)The product of two weights.
weight.multiply(num)The repeated multiplication (power) of a weight with itself. Exponent
-1denotes the infinity.weight.multiply((min,max))The sum of repeated multiplications of an expression:
w.multiply((2,4))= . Whenmin = -1, it denotes0, whenmax = -1, it denotes the infinity.
Preconditions:
min<=max
Examples
In [1]:
Simple Multiplication
Instead of a.multiply(b), you may write a * b.
In [2]:
Out[2]:
In [3]:
Out[3]:
Repeated Multiplication
Instead of w.multiply(3), you may write w ** 3.
In [4]:
Out[4]:
In [5]:
Out[5]:
Use the exponent -1 to mean infinity. Alternatively, you may invoke w.star instead of w ** -1.
In [6]:
Out[6]:
In [7]:
Out[7]:
Sums of Repeated Multiplications
Instead of w.multiply((2, 4)), you may write w ** (2, 4). Again, use exponent max = -1 to denotes infinity.
In [8]:
Out[8]:
In [9]:
Out[9]:
In [10]:
Out[10]:
In [11]:
Out[11]:
In [12]:
Out[12]: