Ask Your Question
0

How to check if a square root is irrational

asked 2012-10-13 11:00:30 +0200

anonymous user

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2012-10-13 12:00:07 +0200

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
edit flag offensive delete link more

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: 2012-10-13 11:00:30 +0200

Seen: 1,935 times

Last updated: Oct 13 '12