Ask Your Question

Revision history [back]

Multivariate symbolics

There is a handy keyword with formal power series, the number of generators (num_gens), and it works like this:

sage: PowerSeriesRing(QQ, 'x', num_gens=5)
Multivariate Power Series Ring in x0, x1, x2, x3, x4 over Rational Field

Is there this kind of shortcut for working with polynomials?

That would simplify this piece of code:

sage: n=4    # dimension of state-space
sage: polygens(QQ, ['x'+str(i) for i in [1..n]])    # define the vector of state variables
(x1, x2, x3, x4)

As a side note, i think the var constructor also lacks a vector form?

sage: var(['x'+str(i) for i in [1..n]])
(x1, x2, x3, x4)

This could be useful to simplify constructions as:

sage: A = matrix(SR, [['a'+str(i)+str(j) for j in [1..n]] for i in [1..n]]); A

[a11 a12 a13 a14]
[a21 a22 a23 a24]
[a31 a32 a33 a34]
[a41 a42 a43 a44]

In Matlab i can do justA = sym('a', n) for the latter, and i didn't find an shortcut like this in Sage.

Multivariate symbolics

There is a handy keyword with formal power series, the number of generators (num_gens), and it works like this:

sage: PowerSeriesRing(QQ, 'x', num_gens=5)
Multivariate Power Series Ring in x0, x1, x2, x3, x4 over Rational Field

Is there this kind of shortcut for working with polynomials?

That would simplify this piece of code:

sage: n=4    # dimension of state-space
sage: polygens(QQ, ['x'+str(i) for i in [1..n]])    # define the vector of state variables
(x1, x2, x3, x4)

As a side note, i think the var constructor also lacks a vector form?

sage: var(['x'+str(i) for i in [1..n]])
(x1, x2, x3, x4)

This could be useful to simplify constructions as:

sage: A = matrix(SR, [['a'+str(i)+str(j) for j in [1..n]] for i in [1..n]]); A

[a11 a12 a13 a14]
[a21 a22 a23 a24]
[a31 a32 a33 a34]
[a41 a42 a43 a44]

In Matlab i can do justA = sym('a', n) for the latter, and i didn't find an a shortcut like this in Sage.

Multivariate symbolics

There is a handy keyword with formal power series, the number of generators (num_gens), and it works like this:

sage: PowerSeriesRing(QQ, 'x', num_gens=5)
Multivariate Power Series Ring in x0, x1, x2, x3, x4 over Rational Field

Is there this kind of shortcut for working with polynomials?

That would simplify this piece of code:

sage: n=4    # dimension of state-space
sage: polygens(QQ, ['x'+str(i) for i in [1..n]])    # define the vector of state variables
(x1, x2, x3, x4)

As a side note, i think the var constructor also lacks a vector form?

sage: var(['x'+str(i) for i in [1..n]])
(x1, x2, x3, x4)

This could be useful to simplify constructions as:

sage: A = matrix(SR, [['a'+str(i)+str(j) for j in [1..n]] for i in [1..n]]); A

[a11 a12 a13 a14]
[a21 a22 a23 a24]
[a31 a32 a33 a34]
[a41 a42 a43 a44]

In Matlab i can do justA = sym('a', n) for the latter, and i didn't find a shortcut like this in Sage.

Multivariate symbolics

There is a handy keyword with formal power series, the number of generators (num_gens), and it works like this:

sage: PowerSeriesRing(QQ, 'x', num_gens=5)
Multivariate Power Series Ring in x0, x1, x2, x3, x4 over Rational Field

Is there this kind of shortcut for working with polynomials?

That would simplify this piece of code:

sage: n=4    # dimension of state-space
sage: polygens(QQ, ['x'+str(i) for i in [1..n]])    # define the vector of state variables
(x1, x2, x3, x4)

As a side note, i think the var constructor also lacks a vector form?

sage: var(['x'+str(i) for i in [1..n]])
(x1, x2, x3, x4)

This could be useful to simplify constructions as:

sage: A = matrix(SR, [['a'+str(i)+str(j) for j in [1..n]] for i in [1..n]]); A

[a11 a12 a13 a14]
[a21 a22 a23 a24]
[a31 a32 a33 a34]
[a41 a42 a43 a44]

In Matlab i can do justthis is A = sym('a', n) for the latter, and , but i didn't find a similar shortcut like this in Sage.

Multivariate symbolics

I would like to simplify this piece of code:

sage: n=4    # dimension of state-space
sage: x = polygens(QQ, ['x'+str(i) for i in [1..n]]); x    # define the vector of state variables
(x1, x2, x3, x4)

There is a handy keyword with formal power series, the number of generators (num_gens), and it works like this:

sage: PowerSeriesRing(QQ, 'x', num_gens=5)
Multivariate Power Series Ring in x0, x1, x2, x3, x4 over Rational Field

Is there this There is a kind of shortcut for working analogue with polynomials?

That polynomials, but not keyworded:

sage: PolynomialRing(QQ, 'x', 5)
Multivariate Polynomial Ring in x0, x1, x2, x3, x4 over Rational Field

I would simplify this piece of code:

sage: n=4    # dimension of state-space
sage: polygens(QQ, ['x'+str(i) for i in [1..n]])    # like to know if any of these can be used to define the a vector of state variables
(x1, x2, x3, x4)
polynomial variables in the object x.


As a side note, i think the var constructor also lacks a vector form?

sage: var(['x'+str(i) for i in [1..n]])
(x1, x2, x3, x4)

This could be useful to simplify constructions as:

sage: A = matrix(SR, [['a'+str(i)+str(j) for j in [1..n]] for i in [1..n]]); A

[a11 a12 a13 a14]
[a21 a22 a23 a24]
[a31 a32 a33 a34]
[a41 a42 a43 a44]

In Matlab this is A = sym('a', n), but i didn't find a similar shortcut in Sage.

Multivariate symbolics

I would like to simplify this piece of code:

sage: n=4    # dimension of state-space
sage: x = polygens(QQ, ['x'+str(i) for i in [1..n]]); x    # define the vector of state variables
(x1, x2, x3, x4)

There is a handy keyword with formal power series, the number of generators (num_gens), and it works like this:

sage: PowerSeriesRing(QQ, 'x', num_gens=5)
Multivariate Power Series Ring in x0, x1, x2, x3, x4 over Rational Field

There is a kind of analogue with polynomials, but not keyworded:

sage: PolynomialRing(QQ, 'x', 5)
Multivariate Polynomial Ring in x0, x1, x2, x3, x4 over Rational Field

I would like to know if any of these can be used to define a vector of polynomial variables in the object x.


As a side note, i think the var constructor also lacks a vector form?

sage: var(['x'+str(i) for i in [1..n]])
(x1, x2, x3, x4)

This could be useful to simplify constructions as:

sage: A = matrix(SR, [['a'+str(i)+str(j) for j in [1..n]] for i in [1..n]]); A

[a11 a12 a13 a14]
[a21 a22 a23 a24]
[a31 a32 a33 a34]
[a41 a42 a43 a44]

In Matlab this is A = sym('a', n), but i didn't find a similar shortcut in Sage.

Multivariate symbolics

I would like to simplify Consider this piece of code:

sage: n=4    # dimension of state-space
sage: x = polygens(QQ, ['x'+str(i) for i in [1..n]]); x    # define the vector of state variables
(x1, x2, x3, x4)

There is a handy keyword with formal power series, the number of generators (num_gens), and it works like this:

sage: PowerSeriesRing(QQ, 'x', num_gens=5)
Multivariate Power Series Ring in x0, x1, x2, x3, x4 over Rational Field

There is a kind of analogue with polynomials, but not keyworded:

sage: PolynomialRing(QQ, 'x', 5)
Multivariate Polynomial Ring in x0, x1, x2, x3, x4 over Rational Field

I would like Is it possible to know if use any of these can be used to define a vector of polynomial variables in the object x. as the beginning (but without list comprehension)?


As a side note, i think the var constructor also lacks a vector form?

sage: var(['x'+str(i) for i in [1..n]])
(x1, x2, x3, x4)

This could be useful to simplify constructions as:

sage: A = matrix(SR, [['a'+str(i)+str(j) for j in [1..n]] for i in [1..n]]); A

[a11 a12 a13 a14]
[a21 a22 a23 a24]
[a31 a32 a33 a34]
[a41 a42 a43 a44]

In Matlab this is A = sym('a', n), but i didn't find a similar shortcut in Sage.

Multivariate symbolics

Consider this piece of code:

sage: n=4    # dimension of state-space
sage: x = polygens(QQ, ['x'+str(i) for i in [1..n]]); x    # define the vector of state variables
(x1, x2, x3, x4)

There is a handy keyword with formal power series, the number of generators (num_gens), and it works like this:

sage: PowerSeriesRing(QQ, 'x', num_gens=5)
Multivariate Power Series Ring in x0, x1, x2, x3, x4 over Rational Field

There is a kind of analogue with polynomials, but not keyworded:

sage: PolynomialRing(QQ, 'x', 5)
Multivariate Polynomial Ring in x0, x1, x2, x3, x4 over Rational Field

Is it possible to use any of these to define a vector of polynomial variables in the object x as the beginning (but without list comprehension)?


As a side note, i think the var constructor also lacks a vector form?

sage: var(['x'+str(i) for i in [1..n]])
(x1, x2, x3, x4)

This could be useful to simplify constructions as:

sage: A = matrix(SR, [['a'+str(i)+str(j) for j in [1..n]] for i in [1..n]]); A

[a11 a12 a13 a14]
[a21 a22 a23 a24]
[a31 a32 a33 a34]
[a41 a42 a43 a44]

In Matlab this is A = sym('a', n), but i didn't find a similar shortcut in Sage.

Multivariate symbolics

Consider this piece of code:

sage: n=4    # dimension of state-space
sage: x = polygens(QQ, ['x'+str(i) for i in [1..n]]); x    # vector of state variables
(x1, x2, x3, x4)

There is a handy keyword with formal power series, the number of generators (num_gens), and it works like this:like:

sage: PowerSeriesRing(QQ, 'x', num_gens=5)
Multivariate Power Series Ring in x0, x1, x2, x3, x4 over Rational Field

There is a kind of analogue with polynomials, but not keyworded:

sage: PolynomialRing(QQ, 'x', 5)
Multivariate Polynomial Ring in x0, x1, x2, x3, x4 over Rational Field

Is it possible to use any of these to define a vector of polynomial variables in the object x as the beginning (but without list comprehension)?


As a side note, i think the var constructor also lacks a vector form?

sage: var(['x'+str(i) for i in [1..n]])
(x1, x2, x3, x4)

This could be useful to simplify constructions as:

sage: A = matrix(SR, [['a'+str(i)+str(j) for j in [1..n]] for i in [1..n]]); A

[a11 a12 a13 a14]
[a21 a22 a23 a24]
[a31 a32 a33 a34]
[a41 a42 a43 a44]

In Matlab this is A = sym('a', n), but i didn't find a similar shortcut in Sage.