Ask Your Question
2

Derivative in infinite polynomial ring

asked 2020-09-05 18:32:15 +0100

mathstudent gravatar image

I am defining my ring as R.<x>=InfinitePolynomialRing(QQ), and this should give me ring with variables x[1],x[2],... etc. right? Now I want to differentiate a polynomial with respect to x[1] variable. So I defined f=x[1]^3 (for example). I am trying f.derivative(x[1]) but that does not work. It shows " 'typeerror': argument 'var' has incorrect type (expected sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular, got InfinitePolynomial_dense)." Can someone please explain what is wrong and what I should do to fix it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-09-05 20:53:08 +0100

Emmanuel Charpentier gravatar image

A nice one...

Consider

sage: R.<x>=InfinitePolynomialRing(QQ)
sage: f=R(x[1]^3)

Note that :

sage: [u.parent() for u in f.variables()]
[Multivariate Polynomial Ring in x_2, x_1, x_0 over Rational Field]

(yes, I played with R a bit...) contrasting with:

sage: x[1].parent()
Infinite polynomial ring in x over Rational Field

Hence the error you noticed. However :

sage: x[1] in f.variables()
True

It is there ; you just have to find it :

sage: f.variables().index(x[1])
0

Hence the (awkward) :

sage: f.derivative(f.variables()[f.variables().index(x[1])])
3*x_1^2

A better way would be to cast x[1] to the proper class. Finding which isn't intuitive...

edit flag offensive delete link more

Comments

Thanks a lot.

mathstudent gravatar imagemathstudent ( 2020-09-06 10:42:42 +0100 )edit

Can this nonconformity of "Multivariate Polynomial Ring" and "Infinite polynomial ring" be brought into conformity so that operations (for example the derivative) can be executed intuitively?

Thrash gravatar imageThrash ( 2022-11-19 17:12:31 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-09-05 18:32:15 +0100

Seen: 381 times

Last updated: Sep 05 '20