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:
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.6sym.I(x + sym.Iy) - csym.I)/(-dx - dsym.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.6sym.I(x + sym.Iy) - 15.3215831575369sym.I)/(-2.01599778388644x - 2.01599778388644sym.I*y + 1)
it does not fullfill the Cauchy-Riemann conidtions anymore
Problem 3:
The Himmelblau function
f = (x**2+y-11)2+(x+y2-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 a topic in the Google Groups "sympy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sympy/rMAWl_g8z9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sympy+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxSTY4mUUV5cYVvRc77yKUURGKR%3DCOoBm0ZAhUtgxXkV%2Bg%40mail.gmail.com.