Ask Your Question

How to evaluate polynomial in a polynomial ring at a particular value

asked 2019-09-07 04:12:38 +0200

anonymous user


Apologies in advance if this question is too simple. I have the following situation: I have a vector space over a polynomial ring, and at some point in my program I need to sub in a value for the indeterminate $t$, and evaluate the polynomial. The set up is as follows:

P.<x> = QQ[]
R.<t> = QuotientRing(P, P.ideal(x^2 - 2))
v = VectorSpace(R,4)

Then for example I have the vector:

(2*t, 3, 2, 0)

I simply want to evaluate $2*t$ at $t = sqrt(2)$ as a function from $\mathbb{R}$ to $\mathbb{R}$.

What is the easiest way to go about this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-09-08 19:12:37 +0200

rburing gravatar image

Note R is not a polynomial ring but a quotient of one.

Let's name the vector

w = v([2*t, 3, 2, 0])

One thing you can do is lift all the elements to be polynomials in x again and do a substitution:

w.apply_map(lambda z: z.lift().subs({x : sqrt(2)}))

This lands in the vector space over the symbolic ring, because sqrt(2) is symbolic.

You can also replace sqrt(2) by things like sqrt(RR(2)) or sqrt(AA(2)).

More appropriate in this situation is to recognize that you are working in an abstract number field $K = \mathbb{Q}(t) = \mathbb{Q}[x]/(x^2-2)$, and you want to use an embedding:

sage: K.<t> = NumberField(x^2 - 2)
sage: V = VectorSpace(K,4)
sage: w = V([2*t, 3, 2, 0])
sage: w.apply_map(K.embeddings(AA)[1])
(2.828427124746190?, 3, 2, 0)

Here K.embeddings(AA)[1] is the embedding of $K$ into $\mathbb{R}$ that sends $t \mapsto \sqrt{2}$.

The other embedding K.embeddings(AA)[0] is the one that sends $t \mapsto -\sqrt{2}$:

sage: w.apply_map(K.embeddings(AA)[0])
(-2.828427124746190?, 3, 2, 0)

Again here you can replace the algebraic reals AA by other fields like QQbar, RR and CC.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools



Asked: 2019-09-07 04:12:38 +0200

Seen: 369 times

Last updated: Sep 08 '19