Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Complement to @FrédéricC 's comment (which he should have posted as an answer...) :

Why I got those ugly _SAGE_VAR_u and _SAGE_VAR_x instead of straight u and x?

Because you are calling a Maxima function from Sage ; Sage will (silently) convert the arguments to Maxima and call the function (which returns Maxima objects) :

sage: maxima_calculus.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))], [t]).parent()
Maxima_lib

but will NOT convert the (Maxima) result(s) to Sage. You hzavr indeed to convert them to Sage with the .sage() method of Maxima objects :

sage: maxima_calculus.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))], [t]).sage()
[5*u^5 - 4*u^4 + (17*u^5 - 40*u^4 + 160*u^2 - 128)*x^2 + 2*(2*u^5 + 23*u^4 - 28*u^3 - 32*u^2 + 32*u)*x]

Note : I have used maxima_calculus instead of maxima : the latter calls an instance of Maxima in a separate process through pexpect, whereas the former use library calls in the same process (way faster and cleaner...).

HTH,

Complement to @FrédéricC 's comment (which he should have posted as an answer...) :

Why I got those ugly _SAGE_VAR_u and _SAGE_VAR_x instead of straight u and x?

Because you are calling a Maxima function from Sage ; Sage will (silently) convert the arguments to Maxima and call the function (which returns Maxima objects) :

sage: maxima_calculus.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))], [t]).parent()
Maxima_lib

but will NOT convert the (Maxima) result(s) to Sage. You hzavr have indeed to convert them to Sage with the .sage() method of Maxima objects :

sage: maxima_calculus.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))], [t]).sage()
[5*u^5 - 4*u^4 + (17*u^5 - 40*u^4 + 160*u^2 - 128)*x^2 + 2*(2*u^5 + 23*u^4 - 28*u^3 - 32*u^2 + 32*u)*x]

Note : I have used maxima_calculus instead of maxima : the latter calls an instance of Maxima in a separate process through pexpect, whereas the former use library calls in the same process (way faster and cleaner...).

HTH,

Complement to @FrédéricC 's comment (which he should have posted as an answer...) :

Why I got those ugly _SAGE_VAR_u and _SAGE_VAR_x instead of straight u and x?

Because you are calling a Maxima function from Sage ; Sage will (silently) convert the arguments to Maxima and call the function (which returns Maxima objects) :

sage: maxima_calculus.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))], [t]).parent()
Maxima_lib

but will NOT convert the (Maxima) result(s) to Sage. You have indeed to convert them to Sage with the .sage() method of Maxima objects :

sage: maxima_calculus.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))], [t]).sage()
[5*u^5 - 4*u^4 + (17*u^5 - 40*u^4 + 160*u^2 - 128)*x^2 + 2*(2*u^5 + 23*u^4 - 28*u^3 - 32*u^2 + 32*u)*x]

Note : I have used maxima_calculus instead of maxima : the latter calls an instance of Maxima in a separate process through pexpect, whereas the former use library calls in the same process (way faster and cleaner...).

HTH,

UPDATE : In your first attempt, you are using equations involving r

Complement to @FrédéricC 's comment (which he should have posted as an answer...) :

Why I got those ugly _SAGE_VAR_u and _SAGE_VAR_x instead of straight u and x?

Because you are calling a Maxima function from Sage ; Sage will (silently) convert the arguments to Maxima and call the function (which returns Maxima objects) :

sage: maxima_calculus.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))], [t]).parent()
Maxima_lib

but will NOT convert the (Maxima) result(s) to Sage. You have indeed to convert them to Sage with the .sage() method of Maxima objects :

sage: maxima_calculus.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))], [t]).sage()
[5*u^5 - 4*u^4 + (17*u^5 - 40*u^4 + 160*u^2 - 128)*x^2 + 2*(2*u^5 + 23*u^4 - 28*u^3 - 32*u^2 + 32*u)*x]

Note : I have used maxima_calculus instead of maxima : the latter calls an instance of Maxima in a separate process through pexpect, whereas the former use library calls in the same process (way faster and cleaner...).

HTH,

UPDATE : In your first attempt, you are using equations involving r

rational fractions. Express yourself using polynomials :

sage: reset()
sage: R.<x,t,u> = PolynomialRing(QQ)
sage: gens = [x*(1 + 4*t^5)-(t*(1 + 2*t)), u*(1 + t^2)-((2*t))]
sage: J = R.ideal(gens)
sage: J.elimination_ideal([t])
Ideal (17*x^2*u^5 + 40*x^2*u^4 - 4*x*u^5 + 46*x*u^4 + 5*u^5 - 160*x^2*u^2 + 56*x*u^3 + 4*u^4 - 64*x*u^2 + 128*x^2 - 64*x*u) of Multivariate Polynomial Ring in x, t, u over Rational Field

HTH,

Complement to @FrédéricC 's comment (which he should have posted as an answer...) :

Why I got those ugly _SAGE_VAR_u and _SAGE_VAR_x instead of straight u and x?

Because you are calling a Maxima function from Sage ; Sage will (silently) convert the arguments to Maxima and call the function (which returns Maxima objects) :

sage: maxima_calculus.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))], [t]).parent()
Maxima_lib

but will NOT convert the (Maxima) result(s) to Sage. You have indeed to convert them to Sage with the .sage() method of Maxima objects :

sage: maxima_calculus.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))], [t]).sage()
[5*u^5 - 4*u^4 + (17*u^5 - 40*u^4 + 160*u^2 - 128)*x^2 + 2*(2*u^5 + 23*u^4 - 28*u^3 - 32*u^2 + 32*u)*x]

Note : I have used maxima_calculus instead of maxima : the latter calls an instance of Maxima in a separate process through pexpect, whereas the former use library calls in the same process (way faster and cleaner...).

HTH,

UPDATE : In your first attempt, you are using equations involving rational fractions. Express yourself using polynomials fractions :

sage: reset()
sage: R.<x,t,u> = PolynomialRing(QQ)
sage: gens = [x*(1 + 4*t^5)-(t*(1 + 2*t)), u*(1 + t^2)-((2*t))]
sage: J = R.ideal(gens)
sage: J.elimination_ideal([t])
Ideal (17*x^2*u^5 + 40*x^2*u^4 - 4*x*u^5 + 46*x*u^4 + 5*u^5 - 160*x^2*u^2 + 56*x*u^3 + 4*u^4 - 64*x*u^2 + 128*x^2 - 64*x*u) (x == -((t*(1 + 2*t))/(1 + 4*t^5))).parent()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In [33], line 1
----> 1 (x == -((t*(Integer(1) + Integer(2)*t))/(Integer(1) + Integer(4)*t**Integer(5)))).parent()

AttributeError: 'bool' object has no attribute 'parent'
sage: (x-((t*(1 + 2*t))/(1 + 4*t^5))).parent()
Fraction Field of Multivariate Polynomial Ring in x, t, u over Rational Field

Express yourself using polynomials :

sage: reset()
sage: R.<x,t,u> = PolynomialRing(QQ)
sage: gens = [x*(1 + 4*t^5)-(t*(1 + 2*t)), u*(1 + t^2)-((2*t))]
sage: J = R.ideal(gens)
sage: J.elimination_ideal([t])
Ideal (17*x^2*u^5 + 40*x^2*u^4 - 4*x*u^5 + 46*x*u^4 + 5*u^5 - 160*x^2*u^2 + 56*x*u^3 + 4*u^4 - 64*x*u^2 + 128*x^2 - 64*x*u) of Multivariate Polynomial Ring in x, t, u over Rational Field

HTH,

Complement to @FrédéricC 's comment (which he should have posted as an answer...) :

Why I got those ugly _SAGE_VAR_u and _SAGE_VAR_x instead of straight u and x?

Because you are calling a Maxima function from Sage ; Sage will (silently) convert the arguments to Maxima and call the function (which returns Maxima objects) :

sage: maxima_calculus.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))], [t]).parent()
Maxima_lib

but will NOT convert the (Maxima) result(s) to Sage. You have indeed to convert them to Sage with the .sage() method of Maxima objects :

sage: maxima_calculus.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))], [t]).sage()
[5*u^5 - 4*u^4 + (17*u^5 - 40*u^4 + 160*u^2 - 128)*x^2 + 2*(2*u^5 + 23*u^4 - 28*u^3 - 32*u^2 + 32*u)*x]

Note : I have used maxima_calculus instead of maxima : the latter calls an instance of Maxima in a separate process through pexpect, whereas the former use library calls in the same process (way faster and cleaner...).

HTH,

UPDATE : In your first attempt, you are using equations involving rational fractions :

sage: (x == -((t*(1 + 2*t))/(1 + 4*t^5))).parent()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In [33], line 1
----> 1 (x == -((t*(Integer(1) + Integer(2)*t))/(Integer(1) + Integer(4)*t**Integer(5)))).parent()

AttributeError: 'bool' object has no attribute 'parent'
sage: (x-((t*(1 + 2*t))/(1 + 4*t^5))).parent()
Fraction Field of Multivariate Polynomial Ring in x, t, u over Rational Field

Express yourself using polynomials :

sage: reset()
sage: R.<x,t,u> = PolynomialRing(QQ)
sage: gens = [x*(1 + 4*t^5)-(t*(1 4*t^5)+(t*(1 + 2*t)), u*(1 + t^2)-((2*t))]
t^2)+2*t]
sage: J = R.ideal(gens)
sage: J.elimination_ideal([t])
Ideal (17*x^2*u^5 + - 40*x^2*u^4 - + 4*x*u^5 + 46*x*u^4 + 5*u^5 - + 160*x^2*u^2 + - 56*x*u^3 + - 4*u^4 - 64*x*u^2 + - 128*x^2 - + 64*x*u) of Multivariate Polynomial Ring in x, t, u over Rational Field

HTH,