Hi,

On 7 Dez., 17:03, andrew ewart <aewartma...@googlemail.com> wrote:
> I have the following code
>
> P.<x0,x1,y0,y1,y2,y3> = PolynomialRing(QQ,order='degrevlex')
> I = Ideal(x0^4-y0,x0^3*x1-y1,x0*x1^3-y2,x1^4-y3)
> print I
> R.<y0,y1,y2,y3> = PolynomialRing(QQ,order='degrevlex')
> I1=Ideal(1)
> J=I.intersection(I1)
> print J
> but gives error
> File "/usr/local/sage/sage-4.6/local/lib/python2.6/site-packages/sage/
> rings/polynomial/multi_polynomial_ideal.py", line 369, in wrapper
>     return func(*args, **kwds)
>   File "/usr/local/sage/sage-4.6/local/lib/python2.6/site-packages/
> sage/rings/polynomial/multi_polynomial_ideal.py", line 1327, in
> intersection
>     raise ValueError, "other must be an ideal in the ring of self, but
> it isn't."
> ValueError: other must be an ideal in the ring of self, but it isn't.
>
> becuase I doesnt lie in R

No. The problem is not that I does not lie in R. The problem is that
I1 does not lie in P:

  sage: P.<x0,x1,y0,y1,y2,y3> = PolynomialRing(QQ,order='degrevlex')
  sage: I = Ideal(x0^4-y0,x0^3*x1-y1,x0*x1^3-y2,x1^4-y3)
  sage: R.<y0,y1,y2,y3> = PolynomialRing(QQ,order='degrevlex')
  sage: I1=Ideal(1)
  sage: I.ring() is P
  True
  sage: I1.ring()
  Integer Ring

There is no reason to believe that any CAS could guess that you want
Ideal(1) to be an ideal in P or R or whatever ring if you don't state
it -- 1 is an integer, and thus Ideal(1) is an ideal in ZZ.

This is an answer to your question. But it seems to me that your
question is actually not relevant to your problem.

If I understand correctly, you want to eliminate the variables x0 and
x1, right? So, you could do
  sage: I.elimination_ideal([x0,x1])
  Ideal (y1*y2 - y0*y3, y2^3 - y1*y3^2, y0*y2^2 - y1^2*y3, y1^3 -
y0^2*y2) of Multivariate Polynomial Ring in x0, x1, y0, y1, y2, y3
over Rational Field

Of course, the elimination ideal still belongs to P, not to R,
although the variables x0,x1 are not used anymore. If you want to
obtain an ideal in R, you could do
  sage: R.ideal_monoid()(I.elimination_ideal([x0,x1]))
  Ideal (y1*y2 - y0*y3, y2^3 - y1*y3^2, y0*y2^2 - y1^2*y3, y1^3 -
y0^2*y2) of Multivariate Polynomial Ring in y0, y1, y2, y3 over
Rational Field

or
  sage: I.elimination_ideal([x0,x1]).change_ring(R)
  Ideal (y1*y2 - y0*y3, y2^3 - y1*y3^2, y0*y2^2 - y1^2*y3, y1^3 -
y0^2*y2) of Multivariate Polynomial Ring in y0, y1, y2, y3 over
Rational Field

Best regards,
Simon

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to