2019-12-16 11:52:59 +0200 received badge ● Notable Question (source) 2018-07-24 19:31:10 +0200 received badge ● Popular Question (source) 2018-01-01 10:23:23 +0200 commented answer Getting all (complex) solutions of a non polynomial equation Thanks for this code. This solution also works for me ! 2018-01-01 10:22:48 +0200 commented answer Getting all (complex) solutions of a non polynomial equation Thanks ! This command works but it doesn't give the list of roots, unlike the code of Emmanuel Charpentier. 2017-12-27 10:45:08 +0200 answered a question Getting all (complex) solutions of a non polynomial equation Thank you very much ! The numerical resolution works perfectly ! But notice that you have forgotten "t^4" term in F definition. Then, the solving of the equation give 6 roots {-2.8752155238395045 - 1.6035277768266649e-16*I, -0.5433030528116871 + 2.5081428804803407e-17*I, 0.5277361688701939 - 0.5071712949223567*I, 0.5277361688701941 + 0.5071712949223569*I, 0.9541487172225926 + 1.4813528249977233e-16*I, 1.408897521688212 + 3.3107296343907337e-16*I}  which are identical to the ones given by Mathematica. {{x -> -2.87522},{x -> -0.543303},{x -> 0.527736-0.507171i},{x -> 0.527736+0.507171i},{x -> 0.95415},{x -> 1.4089}}  This suits me. However, for information, I would to mention that I've checked the following code on https://sagecell.sagemath.org/ : P.=PolynomialRing(CDF); FF=FractionField(P); alpha=[CDF(complex(2*(random()-0.5),2*(random()-0.5))) for p in range(6)]; F=alpha[1]+alpha[2]*t+alpha[3]*t^2+t^4+(alpha[4]+alpha[5]*t^2)/(t^2-alpha[0]); foo=SR(repr(F).replace("t","x")).solve(x) [q.rhs().n() for q in foo]  and I've got the following errors : --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () 19 20 foo=SR(repr(F).replace("t","x")).solve(x) ---> 21 [q.rhs().n() for q in foo] 22 /home/sc_serv/sage/src/sage/structure/element.pyx in sage.structure.element.Element.n (build/cythonized/sage/structure/element.c:8063)() 861 0.666666666666667 862 """ --> 863 return self.numerical_approx(prec, digits, algorithm) 864 865 N = deprecated_function_alias(13055, n) /home/sc_serv/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.numerical_approx (build/cythonized/sage/symbolic/expression.cpp:36129)() 5782 res = x.pyobject() 5783 else: -> 5784 raise TypeError("cannot evaluate symbolic expression numerically") 5785 5786 # Important -- the we get might not be a valid output for numerical_approx in TypeError: cannot evaluate symbolic expression numerically  2017-12-27 10:22:03 +0200 received badge ● Supporter (source) 2017-12-27 10:22:01 +0200 received badge ● Scholar (source) 2017-12-26 20:39:19 +0200 received badge ● Editor (source) 2017-12-26 20:04:10 +0200 received badge ● Student (source) 2017-12-26 17:55:10 +0200 asked a question Getting all (complex) solutions of a non polynomial equation Hi ! I was used to solve the following equation with Mathematica. $$\alpha_1 + \alpha_2x + \alpha_3x^2 + x^4 + \frac{\alpha_4}{x^2-\alpha_0} + \frac{\alpha_5 x^2}{x^2-\alpha_0}=0$$ where $\alpha_i$ are constants. The Mathematica function "Solve" gives me all the numerical roots of this non polynomial equation very easily. These roots can be real or complex. I'm a very beginner at Sage. I have tried several methods to solve this equation automatically but it seems that all methods I've used work only for polynomial equations. Here they are : alpha0 = 0.25 alpha1 = -2.5 alpha2 = 6.9282 alpha3 = -5.5 alpha4 = 0.5 alpha5 = -0.5 x = var('x') eq = alpha1 + alpha2*x + alpha3*x**2 + x**4 + alpha4/(x**2 - alpha0) + alpha5*x**2/(x**2 - alpha0) == 0. # test 1 # solve(eq, x, ring=CC) # ==> [0 == 20000*x^6 - 115000*x^4 + 138564*x^3 - 32500*x^2 - 34641*x + 22500] # test 2 # solve(eq, x, ring=CC, solution_dict=True) # ==> [{0: 20000*x^6 - 115000*x^4 + 138564*x^3 - 32500*x^2 - 34641*x + 22500}] # test 3 # eq.roots(x, ring=CC,multiplicities=False) # ==> TypeError: fraction must have unit denominator  Do you have any idea of a method to get the approximated roots of the equation ? Thanks in advance EDIT : correction of an error in the equation ; add few tests