Ask Your Question

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

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 close merge delete

## 1 Answer

Sort by » oldest newest most voted 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))
(2.828427124746190?, 3, 2, 0)


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

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

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


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

more

## Your Answer

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

Add Answer

## Stats

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

Seen: 143 times

Last updated: Sep 08 '19