- Join over
**1.5M+ people** - Join over
**100K+ communities** - Free
**without limits** - Create
**your own community**

- 07:15codecov[bot] commented #18032
- 07:15sylee957 reopened #18032
- 07:15sylee957 closed #18032
- 06:51BhargavSatya starred sympy/sympy
- 06:33czgdp1807 commented #18047
- 06:32Smit-create commented #18047
- 06:29its2smit commented #18047
- 06:29its2smit commented #18047
- 06:24JoelBondurant closed #2892
- 05:45czgdp1807 commented #2892
- 05:30sympy-bot commented #18032
- 05:30czgdp1807 edited #18032
- 05:30czgdp1807 closed #1686
- 05:30czgdp1807 commented #1686
- 05:28czgdp1807 closed #1722
- 05:28czgdp1807 commented #1722
- 05:25czgdp1807 commented #2380
- 05:22czgdp1807 labeled #2361
- 05:21czgdp1807 commented #2361
- 05:19sympy-bot commented #17822

It seems that your system is over-determined. It has 6 equations in 5 variables. It can have solutions only if the determinant of the extended system is 0.

```
>>> P = Matrix([[ -0.917, 0.042, 0. , 0. , -1. ],
... [ 0.708, -1.125, 0.042, 0. , 5. ],
... [ 0.375, 1.125, -1.125, 0.042, -10. ],
... [ -0.208, -0.042, 1.125, -1.125, 10. ],
... [ 0.042, 0. , -0.042, 1.125, -5. ],
... [ 0. , 0. , 0. , -0.042, 1. ]])
>>> c = Matrix([-1. , 0. , 0. , -0.042, 1.083, -0.042])
>>> Pc = P.row_join(c)
>>> Pc.det()
0.000998125750125132
```

In this example, the determinant not 0 because of the inaccuracy of floating point numbers. Hence there is no solution.

i am learning python megacourse on udemy and it is also teaching numpy, so i was wondering if it might be useful

A potential solution could be to define

`rationalize = lambda x: [nsimplify(e) for e in x]`

(this will turn numbers from a list into rationals). And then do

```
PI = Matrix(map(rationalize, [
[-11/12, 1/24, 0, 0, -1],
[ 17/24, -9/8, 1/24, 0 ,5],
[3/8, 9/8, -9/8, 1/24, -10],
[-5/24, -1/24, 9/8, -9/8, 10],
[1/24, 0, -1/24, 9/8, -5],
[0, 0, 0, -1/24, 1]
]))
```

and similarly for `c`

. I've just checked and this returns the right solutions

@valglad Amazing! I will test.

There are 6 rows and only 5 columns. One row could be omitted.

I have created

`mrationalize = lambda x: [nsimplify(e) for e in [r for r in x]]`

that I do not like much the fell.
I have a problem with calculating eigenvectors for a simple 3x3 matrix in sympy. Trying to execute

```
q = symbols("q", positive=True)
m = Matrix([[-2, exp(-q), 1], [exp(q), -2, 1], [1, 1, -2]])
#m.eigenvects(simplify=True)
m.eigenvals()
```

results in very complicated expressions for the eigenvalues, trying to get the eigenvectors fails with a NotImplementedError. I expect the latter to be due to the former. However, when trying to do the same thing in Mathematica, I get much simpler expressions for everything. Is there some option / flag that I can set to have sympy compute these eigenvalues and eigenvectors? Is there currently some form of limitation within sympy that prevents me from doing this?

@adoa does Mathematica give a simpler expression for the eigenvalues?

Oh apparently they can be simplified if you call

`simplify`

You need to learn the basics of git, to download the code and push it up to GitHub

@adoa it seems there is a

`simplify`

flag, but it doesn't work
This may help you

You should use whichever you feel more comfortable with

(sorry for these silly questions... I am trying my best ,i just need some guidance )

I guess it's because

`Add`

does the smart substitution but `Symbol`

does not
The cosine is irrelevant. It's the same with

`x.subs(x - 1, y)`

vs. `(x + 1).subs(x - 1, y)`

So

`Symbol._eval_subs`

should do the same thing as `Add._eval_subs`

.
@asmeurer: I am somewhat confused regarding the simplification. Apparently there is a difference between

`simplify(a_list)`

and `[simplify(element) for element in a_list]`

. With the latter, I get the same expressions as in Mathematica, the former does not simplify at all o_O. In any case: thanks for opening the issue :-)
It's a bit unclear in the docstring. I take it they are being represented as radius vectors from the origin along the major & minor axis ?