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.Thu, 03 Nov 2016 11:50:38 +0100factor x^2 - 30*x + 2817 in sqrt(-2)https://ask.sagemath.org/question/35337/factor-x2-30x-2817-in-sqrt-2/ Is there a way I can use SAGE to factor my polynomial x^2 - 30*x + 2817 in sqrt(-2).Wed, 02 Nov 2016 06:47:32 +0100https://ask.sagemath.org/question/35337/factor-x2-30x-2817-in-sqrt-2/Comment by slelievre for <p>Is there a way I can use SAGE to factor my polynomial x^2 - 30*x + 2817 in sqrt(-2).</p>
https://ask.sagemath.org/question/35337/factor-x2-30x-2817-in-sqrt-2/?comment=35352#post-id-35352Note that we write Sage rather than SAGE.Wed, 02 Nov 2016 16:56:35 +0100https://ask.sagemath.org/question/35337/factor-x2-30x-2817-in-sqrt-2/?comment=35352#post-id-35352Answer by rtc for <p>Is there a way I can use SAGE to factor my polynomial x^2 - 30*x + 2817 in sqrt(-2).</p>
https://ask.sagemath.org/question/35337/factor-x2-30x-2817-in-sqrt-2/?answer=35338#post-id-35338I think you are looking for the roots of the polynomial:
f = x^2 - 30*x + 2817
f.roots()
which gives:
[(-36*I*sqrt(2) + 15, 1), (36*I*sqrt(2) + 15, 1)]
This would mean that your original function is equal to:
$$ x^2-30x+2817 = \left(x-(15-36 \sqrt{-2})\right)\left(x-(15+36\sqrt{-2})\right)$$Wed, 02 Nov 2016 07:22:36 +0100https://ask.sagemath.org/question/35337/factor-x2-30x-2817-in-sqrt-2/?answer=35338#post-id-35338Comment by Sha for <p>I think you are looking for the roots of the polynomial:</p>
<pre><code>f = x^2 - 30*x + 2817
f.roots()
</code></pre>
<p>which gives:</p>
<pre><code>[(-36*I*sqrt(2) + 15, 1), (36*I*sqrt(2) + 15, 1)]
</code></pre>
<p>This would mean that your original function is equal to:</p>
<p>$$ x^2-30x+2817 = \left(x-(15-36 \sqrt{-2})\right)\left(x-(15+36\sqrt{-2})\right)$$</p>
https://ask.sagemath.org/question/35337/factor-x2-30x-2817-in-sqrt-2/?comment=35339#post-id-35339yes this is what I am looking for.. thank you..Wed, 02 Nov 2016 09:07:24 +0100https://ask.sagemath.org/question/35337/factor-x2-30x-2817-in-sqrt-2/?comment=35339#post-id-35339Answer by slelievre for <p>Is there a way I can use SAGE to factor my polynomial x^2 - 30*x + 2817 in sqrt(-2).</p>
https://ask.sagemath.org/question/35337/factor-x2-30x-2817-in-sqrt-2/?answer=35389#post-id-35389Note that you can also work over the field QQbar of algebraic numbers.
Here is how you would factor your polynomial there and find its roots.
sage: P.<x> = QQbar[]
sage: p = x^2 - 30*x + 2817
sage: p.factor()
(x - 15.00000000000000? - 50.91168824543143?*I) * (x - 15.00000000000000? + 50.91168824543143?*I)
sage: p.roots()
[(15.00000000000000? - 50.91168824543143?*I, 1),
(15.00000000000000? + 50.91168824543143?*I, 1)]
If you want a radical expression for the roots:
sage: for r in p.roots():
....: print(r[0].radical_expression())
....:
-36*I*sqrt(2) + 15
36*I*sqrt(2) + 15
Thu, 03 Nov 2016 11:32:30 +0100https://ask.sagemath.org/question/35337/factor-x2-30x-2817-in-sqrt-2/?answer=35389#post-id-35389Comment by Sha for <p>Note that you can also work over the field QQbar of algebraic numbers.</p>
<p>Here is how you would factor your polynomial there and find its roots.</p>
<pre><code>sage: P.<x> = QQbar[]
sage: p = x^2 - 30*x + 2817
sage: p.factor()
(x - 15.00000000000000? - 50.91168824543143?*I) * (x - 15.00000000000000? + 50.91168824543143?*I)
sage: p.roots()
[(15.00000000000000? - 50.91168824543143?*I, 1),
(15.00000000000000? + 50.91168824543143?*I, 1)]
</code></pre>
<p>If you want a radical expression for the roots:</p>
<pre><code>sage: for r in p.roots():
....: print(r[0].radical_expression())
....:
-36*I*sqrt(2) + 15
36*I*sqrt(2) + 15
</code></pre>
https://ask.sagemath.org/question/35337/factor-x2-30x-2817-in-sqrt-2/?comment=35390#post-id-35390Thank you for explaining this to me. It is so useful in my calculation.Thu, 03 Nov 2016 11:50:38 +0100https://ask.sagemath.org/question/35337/factor-x2-30x-2817-in-sqrt-2/?comment=35390#post-id-35390