# Wrong result from Matrix norm #11413

Closed
opened this Issue Jul 20, 2016 · 8 comments

Projects
None yet
3 participants
Member

### asmeurer commented Jul 20, 2016

 Reported on the mailing list: ``````>>> v=symbols('v:3',real=True);v (v0, v1, v2) >>> V=Matrix(v);V Matrix([ [v0], [v1], [v2]]) >>> U=V.normalized() >>> U Matrix([ [v0/sqrt(v0**2 + v1**2 + v2**2)], [v1/sqrt(v0**2 + v1**2 + v2**2)], [v2/sqrt(v0**2 + v1**2 + v2**2)]]) >>> U.norm() sqrt(v0**2/(-v0**2 - v1**2 - v2**2) + v1**2/(-v0**2 - v1**2 - v2**2) + v2**2/(-v0**2 - v1**2 - v2**2)) >>> _.simplify() I `````` The answer should be 1. Where are those minus signs coming from?

Contributor

### kritkaran94 commented Jul 20, 2016

 How to work on this ? I want to take up this issue.
Member

### jksuom commented Jul 20, 2016

 This line will change the sign when `base = v0**2 + v1**2 + v2**2` is real but not known to be positive.
Member

### asmeurer commented Jul 20, 2016

 Is that line wrong? Also, the check there should probably be for nonnegative, rather than positive. The square roots in the expression are not known to not be zero.
Member

### jksuom commented Jul 20, 2016

 Maybe the sign should be left unchanged except when `base` is explicitly found to be negative.
Member

### asmeurer commented Jul 20, 2016

 Checking nonnegative instead of positive two lines above should be equivalent to that, since the whole block is only run if `base.is_real`.
Member

### asmeurer commented Jul 20, 2016

 Ah, no it won't because of `None` cases (which is the real problem for this issue). It needs to explicitly be ```if base.is_negative: return (-base)**re(exponent)*exp(-S.Pi*im(exponent))```

Contributor

### kritkaran94 commented Jul 21, 2016

 I am working on this issue.

Merged

### kritkaran94 added a commit to kritkaran94/sympy that referenced this issue Jul 21, 2016

``` added test for issue# sympy#11413 ```
``` 27bcdcd ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue Jul 22, 2016

``` Correct Abs.eval when argument is Pow ```
```Taken from comments in sympy/sympy#11413.  Also, a little
cleanup from test_complexes.py

Closes sympy/sympy#11413```
``` b03bf9f ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue Jul 22, 2016

``` Correct Abs.eval when argument is Pow ```
```Taken from comments in sympy/sympy#11413.  Also, a little
cleanup from test_complexes.py

Closes sympy/sympy#11413```
``` ebacd3c ```
Member

### jksuom commented Jul 22, 2016

 Fixed by #11417