# Singular Book 1.4.9 -- global versus local rings

Consider the union of a line and a plane in affine 3-space.
 i1 : S = QQ[x,y,z]; i2 : I = ideal(y*(x-1), z*(x-1)); o2 : Ideal of S
The dimension is 2, the maximum of the dimensions of the two components. In order to find the dimension, Macaulay2 requires the Groebner basis of I. It computes this behind the scenes, and caches the value with I.
 i3 : dim I o3 = 2 i4 : gens gb I o4 = | xz-z xy-y | 1 2 o4 : Matrix S <--- S
Notice that $y$ is not in $I$.
 i5 : y % I o5 = y o5 : S
Now let's use a local order.
 i6 : R = QQ[x,y,z,MonomialOrder=>{Weights=>{-1,-1,-1},RevLex},Global=>false]; i7 : J = substitute(I,R) o7 = ideal (- y + x*y, - z + x*z) o7 : Ideal of R i8 : gens gb J o8 = | y-xy z-xz | 1 2 o8 : Matrix R <--- R
The dimension in this case is 1.
 i9 : dim J o9 = 1

The following is WRONG. In this local ring, $y$ is in the ideal $J$.

 i10 : y % J o10 = 0 o10 : R

Translate the origin to $(1,0,0)$. The plane $x-1 = 0$ goes through this new origin.

 i11 : J = substitute(J, {x=>x+1}) o11 = ideal (x*y, x*z) o11 : Ideal of R i12 : dim J o12 = 2

Compute the global dimension after translation.

 i13 : use ring I o13 = S o13 : PolynomialRing i14 : I1 = substitute(I, {x=>x+1}) o14 = ideal (x*y, x*z) o14 : Ideal of S i15 : dim I1 o15 = 2