Ask Your Question

Revision history [back]

First, let me suggest that all your indices start at 0, not 1. This might look weird at the beginning, but you will see that it is very convenient in the longer term.

You can define your inteterminates as follows:

sage: m,n = 6,10
sage: R = PolynomialRing(QQ,names=['t{}'.format(i) for i in range(m)] + ['lambda{}'.format(i) for i in range(n)]).fraction_field()
sage: R
Fraction Field of Multivariate Polynomial Ring in t0, t1, t2, t3, t4, t5, lambda0, lambda1, lambda2, lambda3, lambda4, lambda5, lambda6, lambda7, lambda8, lambda9 over Rational Field
sage: R.gens()
(t0,
 t1,
 t2,
 t3,
 t4,
 t5,
 lambda0,
 lambda1,
 lambda2,
 lambda3,
 lambda4,
 lambda5,
 lambda6,
 lambda7,
 lambda8,
 lambda9)

To access the inteterminates esily, you can do:

sage: t = R.gens()[:m]
sage: l = R.gens()[m:]

You can check:

sage: t[1] + l[3]
t1 + lambda3

If you want nice LaTeX rendering in jupyter notebook, you can do:

%display latex

You can define the matrix $x_i(t)$ as follows:

sage: def x(i,t):
....:     m = matrix.identity(R,n)
....:     m[i,i+1] = t
....:     return m

You can check, e.g.

sage: x(1,t[3])

The matrix $T$ can be easily defined:

sage: T = matrix.diagonal(l)

Now, if L is the list of indices $i_1,\dots,i_m$, you can define the matrix g as follows:

sage: def g(L):
....:     M = matrix.identity(R,n)
....:     for i,l in enumerate(L):
....:         M = M * x(l,t[i])
....:     return M * T

You can check for example:

sage: g([1,3,5,6])

First, let me suggest that all your indices start at 0, not 1. This might look weird at the beginning, but you will see that it is very convenient in the longer term.

You can define your inteterminates as follows:

sage: m,n = 6,10
sage: R = PolynomialRing(QQ,names=['t{}'.format(i) for i in range(m)] + ['lambda{}'.format(i) for i in range(n)]).fraction_field()
sage: R
Fraction Field of Multivariate Polynomial Ring in t0, t1, t2, t3, t4, t5, lambda0, lambda1, lambda2, lambda3, lambda4, lambda5, lambda6, lambda7, lambda8, lambda9 over Rational Field
sage: R.gens()
(t0,
 t1,
 t2,
 t3,
 t4,
 t5,
 lambda0,
 lambda1,
 lambda2,
 lambda3,
 lambda4,
 lambda5,
 lambda6,
 lambda7,
 lambda8,
 lambda9)

To access the inteterminates esily, you can do:

sage: t = R.gens()[:m]
sage: l = R.gens()[m:]

You can check:

sage: t[1] + l[3]
t1 + lambda3

If you want nice LaTeX rendering in jupyter notebook, you can do:

%display latex

You can define the matrix $x_i(t)$ as follows:

sage: def x(i,t):
....:     m = matrix.identity(R,n)
....:     m[i,i+1] = t
....:     return m

You can check, e.g.

sage: x(1,t[3])

The matrix $T$ can be easily defined:

sage: T = matrix.diagonal(l)

Now, if L is the list of indices $i_1,\dots,i_m$, you can define the matrix g $g$ as follows:

sage: def g(L):
....:     M = matrix.identity(R,n)
....:     for i,l in enumerate(L):
....:         M = M * x(l,t[i])
....:     return M * T

You can check for example:

sage: g([1,3,5,6])

First, let me suggest that all your indices start at 0, not 1. This might look weird at the beginning, but you will see that it is very convenient in the longer term.

You can define your inteterminates as follows:

sage: m,n = 6,10
sage: R = PolynomialRing(QQ,names=['t{}'.format(i) for i in range(m)] + ['lambda{}'.format(i) for i in range(n)]).fraction_field()
sage: R
Fraction Field of Multivariate Polynomial Ring in t0, t1, t2, t3, t4, t5, lambda0, lambda1, lambda2, lambda3, lambda4, lambda5, lambda6, lambda7, lambda8, lambda9 over Rational Field
sage: R.gens()
(t0,
 t1,
 t2,
 t3,
 t4,
 t5,
 lambda0,
 lambda1,
 lambda2,
 lambda3,
 lambda4,
 lambda5,
 lambda6,
 lambda7,
 lambda8,
 lambda9)

To access the inteterminates esily, you can do:

sage: t = R.gens()[:m]
sage: l = R.gens()[m:]

You can check:

sage: t[1] + l[3]
t1 + lambda3

If you want nice LaTeX rendering in jupyter notebook, you can do:

%display latex

You can define the matrix $x_i(t)$ as follows:

sage: def x(i,t):
....:     m = matrix.identity(R,n)
....:     m[i,i+1] = t
....:     return m

You can check, e.g.

sage: x(1,t[3])

The matrix $T$ can be easily defined:

sage: T = matrix.diagonal(l)

Now, if L is the list of indices $i_1,\dots,i_m$, $i_0,\dots,i_{m-1}$, you can define the matrix $g$ as follows:

sage: def g(L):
....:     M = matrix.identity(R,n)
....:     for i,l in enumerate(L):
....:         M = M * x(l,t[i])
....:     return M * T

You can check for example:

sage: g([1,3,5,6])

First, let me suggest that all your indices start at 0, not 1. This might look weird at the beginning, but you will see that it is very convenient in the longer term.

You can define your inteterminates as follows:

sage: m,n = 6,10
sage: R = PolynomialRing(QQ,names=['t{}'.format(i) for i in range(m)] + ['lambda{}'.format(i) for i in range(n)]).fraction_field()
sage: R
Fraction Field of Multivariate Polynomial Ring in t0, t1, t2, t3, t4, t5, lambda0, lambda1, lambda2, lambda3, lambda4, lambda5, lambda6, lambda7, lambda8, lambda9 over Rational Field
sage: R.gens()
(t0,
 t1,
 t2,
 t3,
 t4,
 t5,
 lambda0,
 lambda1,
 lambda2,
 lambda3,
 lambda4,
 lambda5,
 lambda6,
 lambda7,
 lambda8,
 lambda9)

To access the inteterminates esily, you can do:

sage: t = R.gens()[:m]
sage: l = R.gens()[m:]

You can check:

sage: t[1] + l[3]
t1 + lambda3

If you want nice LaTeX rendering in jupyter notebook, you can do:

%display latex

You can define the matrix $x_i(t)$ as follows:

sage: def x(i,t):
....:     m = matrix.identity(R,n)
....:     m[i,i+1] = t
....:     return m

You can check, e.g.

sage: x(1,t[3])

The matrix $T$ can be easily defined:

sage: T = matrix.diagonal(l)

Now, if L is the list of indices $i_0,\dots,i_{m-1}$, you can define the matrix $g$ as follows:

sage: def g(L):
....:     M = matrix.identity(R,n)
....:     for i,l in enumerate(L):
....:         M = M * x(l,t[i])
....:     return M * T

You can check for example:

sage: g([1,3,5,6])
g([0,1,3,5,6,8])

First, let me suggest that all your indices start at 0, not 1. This might look weird at the beginning, but you will see that it is very convenient in the longer term.

You can define your inteterminates as follows:

sage: m,n = 6,10
sage: R = PolynomialRing(QQ,names=['t{}'.format(i) for i in range(m)] + ['lambda{}'.format(i) for i in range(n)]).fraction_field()
sage: R
Fraction Field of Multivariate Polynomial Ring in t0, t1, t2, t3, t4, t5, lambda0, lambda1, lambda2, lambda3, lambda4, lambda5, lambda6, lambda7, lambda8, lambda9 over Rational Field
sage: R.gens()
(t0,
 t1,
 t2,
 t3,
 t4,
 t5,
 lambda0,
 lambda1,
 lambda2,
 lambda3,
 lambda4,
 lambda5,
 lambda6,
 lambda7,
 lambda8,
 lambda9)

To access the inteterminates esily, easily, you can do:

sage: t = R.gens()[:m]
sage: l = R.gens()[m:]

You can check:

sage: t[1] + l[3]
t1 + lambda3

If you want nice LaTeX rendering in jupyter notebook, you can do:

%display latex

You can define the matrix $x_i(t)$ as follows:

sage: def x(i,t):
....:     m = matrix.identity(R,n)
....:     m[i,i+1] = t
....:     return m

You can check, e.g.

sage: x(1,t[3])

The matrix $T$ can be easily defined:

sage: T = matrix.diagonal(l)

Now, if L is the list of indices $i_0,\dots,i_{m-1}$, you can define the matrix $g$ as follows:

sage: def g(L):
....:     M = matrix.identity(R,n)
....:     for i,l in enumerate(L):
....:         M = M * x(l,t[i])
....:     return M * T

You can check for example:

sage: g([0,1,3,5,6,8])