# Maxima eliminate with ugly _SAGE_VAR_

Why I got those ugly _SAGE_VAR_u and _SAGE_VAR_x instead of straight u and x? I am using SageMath 8.9.

var('x, t, u')
maxima.eliminate([x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))],[t])


[(17*_SAGE_VAR_u^5-40*_SAGE_VAR_u^4+160*_SAGE_VAR_u^2-128)*_SAGE_VAR_x^2+(4*_SAGE_VAR_u^5+46*_SAGE_VAR_u^4-56*_SAGE_VAR_u^3-64*_SAGE_VAR_u^2+64*_SAGE_VAR_u)*_SAGE_VAR_x+5*_SAGE_VAR_u^5-4*_SAGE_VAR_u^4]


How do I get rid off it? Substituting does not seem to work.

Update:

Eliminating without maxima - why it does not wok?

R.<x,t,u> = PolynomialRing(QQ)
gens = [x == -((t*(1 + 2*t))/(1 + 4*t^5)), u == -((2*t)/(1 + t^2))]
J = R.ideal(gens)
J.elimination_ideal([t])


Ideal (0) of Multivariate Polynomial Ring in x, t, u over Rational Field


While this works:

R.<x,y,z> = PolynomialRing(QQ)
gens = [ x^2 + y^2 + z^2 - 14, x*y + y*z + z*x -11, x*y*z - y^2 -2]
J = R.ideal(gens)
J.elimination_ideal([x,y])


Ideal (z^12 + 2*z^11 - 25*z^10 - 40*z^9 + 329*z^8 - 4*z^7 - 1763*z^6 + 3984*z^5 + 2475*z^4 - 43722*z^3 + 75942*z^2 - 60588*z + 23409) of Multivariate Polynomial Ring in x, y, z over Rational Field

edit retag close merge delete

2

You can just convert back to sage using .sage() method on the result. And your sage is very obsolete.

( 2023-10-08 17:12:54 +0200 )edit

Thanks, this could be an answer. Yes I know, but I have not in plan to install Linux to use the latest version, I heard it slows down Windows after installation of Windows Subsystem for Linux and Linux.

( 2023-10-08 17:32:18 +0200 )edit

@FrédéricC: I edited my question... maybe you can answer also the update.

( 2023-10-08 17:41:56 +0200 )edit
1

I have not in plan to install Linux to use the latest version.

Since the Cygwin version of Sage is no longer maintained, you cut yourself of Sage advances (which are interesting...).

I heard it slows down Windows after installation of Windows Subsystem for Linux and Linux.

You may need to add RAM to your system. And possibly check the hearsays...

An alternative is to install Linux in a double boot installation, then use your Windows partition in a virtual machine. This works at least with Virtualbox, and may be doable with qemu.

( 2023-10-08 17:45:53 +0200 )edit

Sort by » oldest newest most voted

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 + 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,

more

Thanks. Can you also answer the update in my question?

( 2023-10-08 17:44:13 +0200 )edit

Can you also answer the update in my question?

Done.

But this should have been a separate question...

( 2023-10-08 18:00:22 +0200 )edit