Ask Your Question
1

find square root of of an algebraic number

asked 2016-12-17 07:39:15 +0100

Sha gravatar image

I have an algebraic number -4536*sqrt(33)+61128. How can I find the root of this number using Sage?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-12-17 09:15:25 +0100

slelievre gravatar image

updated 2016-12-17 11:00:49 +0100

First note that written as-4536*sqrt(33)+61128, the number is part of Sage's symbolic ring.

To work with algebraic numbers, the best is to work either

  • in a number field,
  • in the field of algebraic numbers, QQbar),
  • in the field of real algebraic numbers, AA.

Example of working in AA:

sage: a = -4536*sqrt(33)+61128
sage: aa = AA(a)
sage: aa
35070.66383530351?
sage: aa.sqrt()
187.2716311545973?
sage: bb = aa.sqrt()
sage: bb
187.2716311545973?
sage: bb.radical_expression()
42*sqrt(33) - 54

Example of working in a number field:

First we check the approximate value of sqrt(33):

sage: sqrt(33).n()
5.74456264653803

Create an embedded number field:

sage: K.<r33> = NumberField(x^2-33, 5.8)

Check if our number field element is a square:

sage: a = -4536*r33+61128
sage: a.is_square()
True

Take the square root:

sage: a.sqrt()
42*r33 - 54

Final note: in all cases, the method sqrt will return one of the two square roots. Keep in mind that there is another one --- it's just the opposite of the one you got.

So if you let b = a.sqrt(), then remember that -b is also a square root of a.

edit flag offensive delete link more

Comments

Thank you for explaining this to me. It is so useful for my calculation.

Sha gravatar imageSha ( 2016-12-17 14:06:52 +0100 )edit
1

The following question is useful for understanding different number types:

https://ask.sagemath.org/question/995...

paulmasson gravatar imagepaulmasson ( 2016-12-17 22:12:07 +0100 )edit
1

Alternative code, working in a quadratic number field, as in our case, and factorizing in it.

sage: K.<a> = QuadraticField( 33 )
sage: K
Number Field in a with defining polynomial x^2 - 33
sage: s = 61128 - 4536*a
sage: sqrt(s)
42*a - 54
sage: factor(s)
(-184*a + 1057) * (-1/2*a - 5/2)^18 * (-1/2*a + 5/2)^4 * (-a + 6)^6
sage: w = (-184*a + 1057)
sage: w.is_unit()
True
sage: sqrt( w )
-4*a + 23
sage: u, = K.units()
sage: u
4*a + 23
sage: sqrt(s).factor()
(4*a - 23) * (-1/2*a - 5/2)^9 * (-1/2*a + 5/2)^2 * (-a + 6)^3
sage: s.norm()
3057647616
sage: s.norm().factor()
2^22 * 3^6
dan_fulea gravatar imagedan_fulea ( 2017-03-18 02:14:34 +0100 )edit

Thank you. This has been so helpful.

Sha gravatar imageSha ( 2017-03-23 06:44:41 +0100 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-12-17 07:39:15 +0100

Seen: 2,661 times

Last updated: Dec 17 '16