Hi,
I only manage to use solve() as in the following code:
-----------
x, y, z = var( 'x,y,z' )
genLst = [x ** 2 * y, x * y ** 2, x * y, ( x ** 2 + y ** 2 + 1 ) * y]
solLst = solve( genLst, [x, y], solution_dict = True )
bpLst = [ ( sol[x], sol[y] ) for sol in solLst ]
bp = bpLst[1]
print gcd( genLst )
print bp
-----------
The output is:
-----------
y
(0, -I)
-----------
I guess that solve works over the SymbolicRing.
The next step i would like to translate bp to the origin and again
call gcd()
----------
genLst = [ g.subs( {x:x + bp[0], y:y + bp[1]} ) for g in genLst]
print genLst
print type( genLst[0] )
gcd(genLst)
----------
The output is:
----------
[(y - I)*x^2, (y - I)^2*x, (y - I)*x, (y - I)*((y - I)^2 + x^2 + 1)]
<type 'sage.symbolic.expression.Expression'>
...stacktrace omitted...
RuntimeError: gcd: arguments must be polynomials over the rationals
----------
Strange since gcd() worked above, without declaring any ring...
If i try to coerce genLst[0] as follows:
----------
ring, ( x, y, z, I ) = PolynomialRing( QQ, 'x,y,z,I' ).objgens()
ring.coerce( genLst[0] )
----------
output:
----------
...stacktrace omitted...
TypeError: no canonical coercion from Symbolic Ring to Multivariate
Polynomial Ring in x, y, z, I over Rational Field
----------
Could someone please help me with the following questions?
1st question: What kind of ring is the SymbolicRing?
2nd question: Is it possible to solve over PolynomialRing(CC,'x y z')
or over any other ring?
3th question: How can i compute gcd(genLst) and make the above code
work?
Thanks,
Niels
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---