# How to check if a square root is irrational

What's the easiest way in sage to check if the square root of a given rational number (for example 1,671 or 2,56) is irrational.

How to check if a square root is irrational

asked **
2012-10-13 04:00:30 -0500
**

Anonymous

What's the easiest way in sage to check if the square root of a given rational number (for example 1,671 or 2,56) is irrational.

add a comment

2

Convert your numbers to explicit rationals and ask whether their square root is in **Q**:

```
sage: sqrt(1671/1000) in QQ
False
sage: sqrt(256/100) in QQ
True
sage: sqrt(2) in QQ
False
```

Or you can do the conversions this way:

```
sage: sqrt(QQ(1.671)) in QQ
False
```

Asked: **
2012-10-13 04:00:30 -0500
**

Seen: **1,267 times**

Last updated: **Oct 13 '12**

list of graphs whowe independence number <= 2 [closed]

What are the differences between RealDoubleField() and RealField(53) ?

factorization on number fields

sort graph by independence number

Why is 3e1 not equivalent to 30?

solve() is not giving the right solutions

Counting number of trues in a 1000 line answer

How can I find the sum of fibonacci (1) + (2) + (4) + (7) + (11) + (16) + ... ?

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.