# .is_real function

Why does "sqrt(5).is_real()" come up false when it is obviously not? This seems to happen with any square root.

.is_real function

1

Hi,

Never believe the symbolic ring as it can answer False when the result is True (hopefully a True is real True). To get the answer to your question, you would better do:

```
sage: QQbar(5).sqrt() in AA
True
```

Note: **QQbar** is the set of algebraic number and **AA** is the set of real algebraic numbers.

Vincent

Asked: **
2014-02-13 16:29:11 -0600
**

Seen: **302 times**

Last updated: **Jun 29 '14**

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.

There are many problems with this function. - sqrt(5).real_part() -> sqrt(5) - sqrt(5).imag_part() ->0 - sqrt(25).is_real() -> AttributeError: 'sage.rings.integer.Integer' object has no attribute 'is_real' - SR(sqrt(25)).is_real() -> True - SR(sqrt(5)).is_real() -> False - CC(sqrt(5)).is_real -> True

I think this is because `sqrt` gives a symbolic thing, which Sage would have to exert possibly significant computational effort to decide whether it is real (think of showing whether an arbitrary expression is zero) and so answers `False` since it can't prove `True`.

"sqrt gives a symbolic thing, ..." perhaps , but Sage knows that sqrt(5).imag_part() is 0 then it isn't so difficult to answer True at this question. But I have only notions of programming.