# Sub-manifold: bug or my misunderstanding?

### Define a manifold and sub-manifold:

R2 = Manifold(2, 'R^2', start_index=1) # R^2
c_xy.<x,y> = R2.chart() # Cartesian coordinates on R^2
M = R2.open_subset('M', coord_def={c_xy: x>0 and y>0}) # First quadrant

### Test the coordinate restrictions:

R2.point((0,1)) in M; R2.point((0,0)) in M; R2.point((1,0)) in M; R2.point((1,1)) in M

### Result:

False False True True

Question: Have I misunderstood how to restrict to the first quadrant, or have I stumbled on a bug?

edit retag close merge delete

Sort by » oldest newest most voted

Actually, you must declare the first quadrant as

M = R2.open_subset('M', coord_def={c_xy: [x>0, y>0]})


Then the output of your test is correct, i.e. it is False False False True.

Of course the syntax you used, i.e. x>0 and y>0, is more user friendly, and we should definitively implement it! For the time being, coordinate conditions passed as a list are combined with and, while those passed as a tuple are combined with or. For instance [x>0, (y>2, y<-2)] stands for x>0 and (y>2 or y<-2). This is documented in the function add_restrictionson http://sagemanifolds.obspm.fr/doc/ref..., but not in the function open_subset, as it should; sorry for the inconvenience.

more