SD14: Morphisms and points
system:sage

{{{id=0|
# morphism between rings
R.<x> = QQ[]; S.<y> = QQ[]
phi = R.hom([y^2+1]); phi
///
Ring morphism:
  From: Univariate Polynomial Ring in x over Rational Field
  To:   Univariate Polynomial Ring in y over Rational Field
  Defn: x |--> y^2 + 1
}}}

{{{id=1|
# morphism between Spec's
X = Spec(S); Y = Spec(R)
f = X.hom(phi); f
///
Affine Scheme morphism:
  From: Spectrum of Univariate Polynomial Ring in y over Rational Field
  To:   Spectrum of Univariate Polynomial Ring in x over Rational Field
  Defn: Ring morphism:
          From: Univariate Polynomial Ring in x over Rational Field
          To:   Univariate Polynomial Ring in y over Rational Field
          Defn: x |--> y^2 + 1
}}}

{{{id=2|
# morphism given by equations
A2.<x, y> = AffineSpace(QQ, 2)
X = A2.subscheme([x*y-1])
Y = A2
f = X.hom([x,0], Y); f
///
Scheme morphism:
  From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
  x*y - 1
  To:   Affine Space of dimension 2 over Rational Field
  Defn: Defined on coordinates by sending (x, y) to
        (x, 0)
}}}

{{{id=3|
P = A2([5, 2]); P in X
///
False
}}}

{{{id=5|
# bug
P = A2([5, 1/5]); P in X
///
False
}}}

{{{id=6|
P = X([5, 1/5]); P in X
///
True
}}}

{{{id=7|
type(P)
///
<class 'sage.schemes.generic.morphism.SchemeMorphism_affine_coordinates'>
}}}

{{{id=8|
f(P)
///
(5, 0)
}}}

{{{id=9|
f([5, 1/5])
///
(5, 0)
}}}

{{{id=10|
f([0, 1])
///
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/aghitza/.sage/sage_notebook/worksheets/admin/7/code/55.py", line 7, in <module>
    exec compile(ur'f([_sage_const_0 , _sage_const_1 ])' + '\n', '', 'single')
  File "/opt/sage/local/lib/python2.5/site-packages/SQLAlchemy-0.4.6-py2.5.egg/", line 1, in <module>
    
  File "/opt/sage/local/lib/python2.5/site-packages/sage/schemes/generic/morphism.py", line 266, in __call__
    x = dom(x)
  File "/opt/sage/local/lib/python2.5/site-packages/sage/schemes/generic/scheme.py", line 182, in __call__
    return self.point(args)
  File "/opt/sage/local/lib/python2.5/site-packages/sage/schemes/generic/scheme.py", line 215, in point
    return self._point_class(self, v, check=check)
  File "/opt/sage/local/lib/python2.5/site-packages/sage/schemes/generic/algebraic_scheme.py", line 105, in _point_class
    return self.__A._point_class(*args, **kwds)
  File "/opt/sage/local/lib/python2.5/site-packages/sage/schemes/generic/affine_space.py", line 222, in _point_class
    return morphism.SchemeMorphism_affine_coordinates(*args, **kwds)
  File "/opt/sage/local/lib/python2.5/site-packages/sage/schemes/generic/morphism.py", line 383, in __init__
    X.codomain()._check_satisfies_equations(v)
  File "/opt/sage/local/lib/python2.5/site-packages/sage/schemes/generic/algebraic_scheme.py", line 229, in _check_satisfies_equations
    self._error_bad_coords(v)
  File "/opt/sage/local/lib/python2.5/site-packages/sage/schemes/generic/algebraic_scheme.py", line 219, in _error_bad_coords
    raise TypeError, "coordinates %s do not define a point on %s"%(list(v),self)
TypeError: coordinates [0, 1] do not define a point on Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
  x*y - 1
}}}

{{{id=11|

///
}}}