1 | initial version |
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
.