If your equation can be solved exactly,
the standard Sage way would be something like this:
sage: var('y')
y
sage: solve(y^2==-2,y)
[y == -I*sqrt(2), y == I*sqrt(2)]
sage: (y^2+2).roots()
[(-I*sqrt(2), 1), (I*sqrt(2), 1)]
sage: (y^2+2).roots()[0] # one of the roots exactly, with
multiplicity
(-I*sqrt(2), 1)
sage: (y^2+2).roots()[0][0]
-I*sqrt(2)
sage: (y^2+2).roots()[0][0].n() # one of the roots, numerically
-1.41421356237309*I

##
Advertising

On Friday, January 13, 2017 at 1:01:23 PM UTC, Дмитрий Фролов 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.
>
>
--
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.