Hi, On Fri, Jan 13, 2017 at 1:54 PM, Дмитрий Фролов <kain9...@gmail.com> wrote: > Hellow! I have problem: I need to solve equation with one variable, but > solution must be complex number. "find_root()" and "root()" in > scipy.optimize can't do it. Help me please.
root() from scipy.optimize should work: F.ex. to find the root of f(z) = z^2 + 1, write z = x + iy so that f(x,y) = (x^2-y^2+1, 2*xy). Following the example in: https://docs.scipy.org/doc/scipy-0.18.1/reference/tutorial/optimize.html import numpy as np import scipy.optimize as opti def func(x): f = [x[0]**2 - x[1]**2 + 1, 2*x[0]*x[1]] # The Jacobian: df = np.array([[2*x[0], -2*x[1]], [2*x[1], 2*x[0]]]) return f, df sol = opti.root(func, [0.5, 0.5], jac=True, method='lm') print sol.x Cheers, -- Vegard Lima -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.