# Problem with solve()

asked 2016-08-02 08:27:59 -0600

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Hi, I'm unable to solve a polynomial using Sage.

I have a function that creates a polynomial given a vector of coefficients

def createPolynomForCoeff(Hcoefficient):
indexMap = indexCoeffMap(len(Hcoefficient))
pdb.set_trace()
xt,yt = var('xt, yt')
h(xt,yt) = 0*xt*yt
for i in range(len(Hcoefficient)):
h = h + Hcoefficient[i]*(xt^indexMap[i][0])*( yt^indexMap[i][1])
return h


Another function takes the polynomial, finds roots and do some calculations with the roots(not yet written)

def fRoots(h,N):
xt, yt = var('xt, yt')
tmpRoots = solve(h == 0, xt, yt)
return tmpRoots


My problem is that solve solves only for xt, e.g: ([xt == -3/324958370652260843508466983800081371393543861233065*(211195885313944282936234464966717105743153589003712170900488769205796484783769135230857222907689545278*yt + 1)/(3379134165023108526979751439467473691890457424059394734407820307292743756540306163693715566523032724448*yt + 1)], [1])

Any help is very welcome!

Marc

edit retag close merge delete

Does using solve(h == 0, [x1,y1]) or solve([h == 0], x1,y1) or solve([h == 0], [x1,y1]) give you the right answer? It seems that if solve is supplied with a single equation, it doesn't try to look for multiple variables in the arguments.