Repository: sympy/sympy

Issue:
Roots of non-real elements should be non-real themselves, but their domain is unknown
### Description
This is not a bug, rather an idea for an improvement

At the moment, taking the squareroot of a non-real expression (`is_extended_real==False`) does result in the value of `is_extended_real` being `None`.

```{python}
>>> x = Symbol('x', real=True)
>>> print((I+x).is_extended_real)
False
>>> print(sqrt(I+x).is_extended_real)
None
```
To the best of my knowledge, it would be correct to assume, that the root of a non-real number is not real itself, since this follows directly from the reals being closed under multiplication, i.e. $\sqrt{a}\in \mathbb{R} \Rightarrow \sqrt{a}\cdot \sqrt{a}\in\mathbb{R}$, which contradicts with the assumption.

### Motivation
When solving multivariate quartic polynomials, the solution sometimes contains the above mentioned subexpression.
For example the polynomial $a^4 - 2a^3b - 2a^3c + a^2b^2 + 4a^2bc + a^2c^2 - 2ab^2c - 2abc^2 + b^2c^2 + 1$ has no real solution. When we solve for a, we get, among others, the following solution: $\frac{b}{2} + \frac{c}{2} - \frac{\sqrt{b^2 - 2bc + c^2 - 4I}}{2}$.

```{python}
>>> a = Symbol('a', real=True)
>>> b = Symbol('b', real=True)
>>> c = Symbol('c', real=True)
>>> expr = solve(a**4 - 2*a**3*b - 2*a**3*c + a**2*b**2 + 4*a**2*b*c + a**2*c**2 - 2*a*b**2*c - 2*a*b*c**2 + b**2*c**2 + 1, a)[0]
>>> print(expr.is_extended_real)
None
```

### Possible modification
The function `_eval_is_extended_real` of the `Pow` class could be amplified, to return False, when the base is not real and the exponent is a rational with a nominator of 1.


Discussion:

Patch:
diff --git a/.mailmap b/.mailmap
index 2b868286fc..4c0988c981 100644
--- a/.mailmap
+++ b/.mailmap
@@ -881,6 +881,7 @@ Liwei Cai <cai.lw123@gmail.com>
 Ljubiša Moćić <3rdslasher@gmail.com>
 Lokesh Sharma <lokeshhsharma@gmail.com> <your_email@youremail.com>
 Longqi Wang <iqgnol@gmail.com>
+Lorenz Winkler <lorenz.winkler@tuwien.ac.at>
 Lorenzo Contento <lorenzo.contento@gmail.com> Lorenzo Contento <lcontento@users.noreply.github.com>
 Lorenzo Contento <lorenzo.contento@gmail.com> lcontento <lcontento@users.noreply.github.com>
 Louis Abraham <louis.abraham@yahoo.fr> <louisabraham@users.noreply.github.com>
diff --git a/sympy/core/power.py b/sympy/core/power.py
index b8676164ec..02eb307fd6 100644
--- a/sympy/core/power.py
+++ b/sympy/core/power.py
@@ -560,6 +560,8 @@ def _eval_is_extended_real(self):
                     return ok
 
         if real_b is False and real_e: # we already know it's not imag
+            if isinstance(self.exp, Rational) and self.exp.p == 1:
+                return False
             from sympy.functions.elementary.complexes import arg
             i = arg(self.base)*self.exp/S.Pi
             if i.is_complex: # finite
@@ -1837,6 +1839,6 @@ def _eval_difference_delta(self, n, step):
 power.add((object, object), Pow)
 
 from .add import Add
-from .numbers import Integer
+from .numbers import Integer, Rational
 from .mul import Mul, _keep_coeff
 from .symbol import Symbol, Dummy, symbols


Test patch:
diff --git a/sympy/core/tests/test_power.py b/sympy/core/tests/test_power.py
index 8279c9f43f..9dcc828d85 100644
--- a/sympy/core/tests/test_power.py
+++ b/sympy/core/tests/test_power.py
@@ -555,7 +555,7 @@ def test_issue_14815():
     assert sqrt(x).is_extended_negative is False
     x = Symbol('x', extended_real=True)
     assert sqrt(x).is_extended_negative is False
-    assert sqrt(zoo, evaluate=False).is_extended_negative is None
+    assert sqrt(zoo, evaluate=False).is_extended_negative is False
     assert sqrt(nan, evaluate=False).is_extended_negative is None
 
 
@@ -651,3 +651,13 @@ def test_powers_of_I():
 def test_issue_23918():
     b = S(2)/3
     assert (b**x).as_base_exp() == (1/b, -x)
+
+
+def test_issue_26546():
+    x = Symbol('x', real=True)
+    assert x.is_extended_real is True
+    assert sqrt(x+I).is_extended_real is False
+    assert Pow(x+I, S.Half).is_extended_real is False
+    assert Pow(x+I, Rational(1,2)).is_extended_real is False
+    assert Pow(x+I, Rational(1,13)).is_extended_real is False
+    assert Pow(x+I, Rational(2,3)).is_extended_real is None