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
-1
denotes 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]:
In [3]:
Repeated Multiplication
Instead of w.multiply(3)
, you may write w ** 3
.
In [4]:
In [5]:
Use the exponent -1 to mean infinity
. Alternatively, you may invoke w.star
instead of w ** -1
.
In [6]:
In [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]:
In [9]:
In [10]:
In [11]:
In [12]: