Dear all,

I just created an issue in the SymPy github project (Zero in SymPy 
<https://github.com/sympy/sympy/issues/22425>
#22425 opened 2 minutes ago by zolabar 
<https://github.com/sympy/sympy/issues?q=is%3Aissue+is%3Aopen+author%3Azolabar>).
 
Here goes the content, may be someone knows this topic and there are 
already issues on this.

Sometimes SymPy hesitates to return zero... I've encountered this problem 
in three applications. There may be a solution to this already, however I 
haven't seen it yet.

   - Problem 1: Real symmetric Matrices have only real eigenvalues...
   - Problem 2: Analiticity of Möbius transform
   - Problem 3:  Stationary Points of Himmelblau Function

Problem 1:

A = sym.Matrix(([1, 4, -2],
[4, 0, 0],
[-2, 0, 3]))

should have only real eigenvalues, since it is symmetric, but SymPy returns 
complex eigenvalues with an imaginary part of the orrder 10**(-126)...

Problem 1:

The Moebius transform

f = (7.6*sym.I*(x + sym.I*y) - c*sym.I)/(-d*x - d*sym.I*y + 1)

fulfills the Cauchy-Rieman conditions, i.e.

sym.simplify(sym.diff(sym.im(f), y)-sym.diff(sym.re(f), x)) = 0

and

sym.simplify(sym.diff(sym.im(f), x)+sym.diff(sym.re(f), y)) = 0

However, when using numerical values for d and c

f = (7.6*sym.I*(x + sym.I*y) - 15.3215831575369*sym.I)/(-2.01599778388644*x 
- 2.01599778388644*sym.I*y + 1)

it does not fullfill the Cauchy-Riemann conidtions anymore

Problem 3:

The Himmelblau function

f = (x**2+y-11)*2+(x+y*2-7)**2

has four stationary points in R x R (
https://en.wikipedia.org/wiki/Himmelblau%27s_function)

However

system = [sym.diff(f, x),
sym.diff(f, y),
]

solSet = sym.nonlinsolve(system,[x,y])
solSetReal=[]
for i in list(solSet):
if i[0].is_real and i[1].is_real:
solSetReal.append(i)

solSetReal

returns only one stationary point in R x R.

While the imaginray parts of the other stationary points are actually zero.

sym.im(list(solSet)[1][0]).evalf()

gives a value of the order 10**(-125)...

I attached a Jupyter Notebbok with the three examples

Thank you!

Regards,

Zoufiné

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/8413e06e-d899-46af-ae95-1a6882ba06e5n%40googlegroups.com.

Attachment: sympy_zero_complex.ipynb
Description: Binary data

Reply via email to