every time I am running collect*factors(*); it shows kernel crashed and restarted and I have to run all the cells from the beginning.

0 votes

every time I am running collect*factors(*); it shows kernel crashed and restarted and I have to run all the cells from the beginning.

for example i have a term like
ex:Y*{a b}=2^{1/2}\psi 2^{1/2}k*{a} k_{b};
and after that I entered collect*factors(*);
then a new window appears notifying "kernel crashed unexpectedly, and has been restarted. You will need to re-run all cells".

If I enter in an empty notebook

```
ex:= Y_{a b}=2^{1/2}\psi 2^{1/2}k_{a} k_{b};
collect_factors(_);
```

it does not crash, so your case probably contains more code. Can you give a *complete* and *minimal* example that shows the crash?

If I have the following definition
Q2:=Q2*{a b}= k*{a} k*{b}
ex:Y{a b}=2^{1/2}\psi 2^{1/2}Q2*{a b};
does this affect the result because there is a numerical factor combined with Q?

I just ran this much in a new kernel and still have the same problem:

```
ex:=k^{a}n_{c a}+2**{1/2} k_{c} 2**{1/2};
collect_factors(_);
```

Ok, I see what is going wrong. As a temporary workaround, can you do

`map_sympy(_, "simplify");`

instead of `collect_terms`

. That will take care of the simplification of the square roots as well. I'll post here when the bug is fixed.

So I was working with the temporary code

`map_sympy(_, "simplify");`

It worked for expression like

`ex:=k^{a}n_{c a}+2**{1/2} k_{c} 2**{1/2};`

However when I had to simplify an expression having terms like

```
ex:= Y^{a}_{b c d}=F^{a}_{b c d}+2**{1/2}\psi 2**{1/2}k^{a} Q1_{b c d}+ l^{a} Q2_{b c d};
map_sympy(_, "simplify");
```

then it resulted in the following error.

TokenError: ('EOF in multi-line statement',(2, 0)) At : /usr/lib/python3/dist-packages/sympy/parsing/sympy_tokenize.py(384) : generate_tokens

One more thing I noticed is that substituting `\psi`

with some letter say `p`

did the work.