ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 09 Apr 2015 07:14:46 -0500complex, real, common ring, crash in 'vector' constructorhttp://ask.sagemath.org/question/26473/complex-real-common-ring-crash-in-vector-constructor/ (x,y,z) = var('x,y,z')
x = z.real_part()
y = z.imag_part()
test = vector((x,1,1))
test = vector((x,y,1))
test = vector((z.real_part,1,1))
Last line causes an error, can't find common ring for all elements.
These variables all have type "Expression"; but some expressions denote
complex numbers and some denote real numbers. How do I tell sage about that?
(Sage 6.5 on Mac OS 10).Wed, 08 Apr 2015 14:11:48 -0500http://ask.sagemath.org/question/26473/complex-real-common-ring-crash-in-vector-constructor/Comment by slelievre for <pre><code>(x,y,z) = var('x,y,z')
x = z.real_part()
y = z.imag_part()
test = vector((x,1,1))
test = vector((x,y,1))
test = vector((z.real_part,1,1))
</code></pre>
<p>Last line causes an error, can't find common ring for all elements. <br/>
These variables all have type "Expression"; but some expressions denote
complex numbers and some denote real numbers. How do I tell sage about that?
(Sage 6.5 on Mac OS 10).</p>
http://ask.sagemath.org/question/26473/complex-real-common-ring-crash-in-vector-constructor/?comment=26477#post-id-26477tmonteil is right, your last line should be `test = vector((z.real_part(),1,1))`.Thu, 09 Apr 2015 07:14:46 -0500http://ask.sagemath.org/question/26473/complex-real-common-ring-crash-in-vector-constructor/?comment=26477#post-id-26477Comment by tmonteil for <pre><code>(x,y,z) = var('x,y,z')
x = z.real_part()
y = z.imag_part()
test = vector((x,1,1))
test = vector((x,y,1))
test = vector((z.real_part,1,1))
</code></pre>
<p>Last line causes an error, can't find common ring for all elements. <br/>
These variables all have type "Expression"; but some expressions denote
complex numbers and some denote real numbers. How do I tell sage about that?
(Sage 6.5 on Mac OS 10).</p>
http://ask.sagemath.org/question/26473/complex-real-common-ring-crash-in-vector-constructor/?comment=26474#post-id-26474Didn't you forgot parenthesis in `z.real_part()` ?Wed, 08 Apr 2015 15:47:50 -0500http://ask.sagemath.org/question/26473/complex-real-common-ring-crash-in-vector-constructor/?comment=26474#post-id-26474