ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 17 Jan 2017 11:21:23 +0100imaginary unit and subspaces of the complex polynomial ring?https://ask.sagemath.org/question/36307/imaginary-unit-and-subspaces-of-the-complex-polynomial-ring/I am trying to work with the complex, multivariate polynomial ring R.<x,y> = CC['x,y'].
When I try to create an element in my ring R
f = x + I*y
i get parent(f) is a symbolic ring and not R, which seems to happen due to the "I". Is there a way to interpret "I" as an element in my R?
Also if I have a long list "L" of elements in the ring "R" is there an easy way to define a real subspace of R (alternatively R could also be a real polynomial ring) spanned by the elements of L and to check whether a given polynomial f lies in this span?Mon, 16 Jan 2017 11:31:58 +0100https://ask.sagemath.org/question/36307/imaginary-unit-and-subspaces-of-the-complex-polynomial-ring/Answer by slelievre for <p>I am trying to work with the complex, multivariate polynomial ring R.<x,y> = CC['x,y'].
When I try to create an element in my ring R
f = x + I*y
i get parent(f) is a symbolic ring and not R, which seems to happen due to the "I". Is there a way to interpret "I" as an element in my R?</p>
<p>Also if I have a long list "L" of elements in the ring "R" is there an easy way to define a real subspace of R (alternatively R could also be a real polynomial ring) spanned by the elements of L and to check whether a given polynomial f lies in this span?</p>
https://ask.sagemath.org/question/36307/imaginary-unit-and-subspaces-of-the-complex-polynomial-ring/?answer=36322#post-id-36322Here are two ways to solve your first problem.
- use the Python version of the complex imaginary unit, `1j`.
sage: R.<x,y> = CC['x,y']
sage: f = x + 1j*y
sage: f
x + 1.00000000000000*I*y
sage: f.parent()
Multivariate Polynomial Ring in x, y over Complex Field with 53 bits of precision
- redefine `I` to be the imaginary unit in `CC`.
sage: I = CC.gen()
sage: I = CC.gen()
sage: f = x + I * y
sage: f
x + 1.00000000000000*I*y
sage: f.parent()
Multivariate Polynomial Ring in x, y over Complex Field with 53 bits of precision
Regarding your second problem, the following fails because `R` is not a principal ideal domain.
sage: span([f], R)Tue, 17 Jan 2017 11:21:23 +0100https://ask.sagemath.org/question/36307/imaginary-unit-and-subspaces-of-the-complex-polynomial-ring/?answer=36322#post-id-36322