Opened 18 months ago

# product of manifolds

Reported by: Owned by: mkoeppe major sage-9.7 manifolds gh-mjungmath, egourgoulhon, tscrim, gh-tobiasdiez N/A

### Description

Taking the cartesian product of differentiable manifolds treats them as merely topological spaces.

sage: I = manifolds.OpenInterval(0, 1)
sage: I
Real interval (0, 1)
sage: II = I.cartesian_product(I)
sage: II.category()
Category of Cartesian products of connected topological spaces


This can be improved.

### comment:1 Changed 18 months ago by tscrim

See Algebras for an example of how to do this. I am leaving for today right now and can push this tomorrow if someone else doesn't do it before then.

### comment:2 follow-up: ↓ 3 Changed 18 months ago by mkoeppe

It's not just that the category needs adjusting; but actually we should add specific cartesian_product methods that take products of charts etc

### comment:3 in reply to: ↑ 2 Changed 18 months ago by egourgoulhon

It's not just that the category needs adjusting; but actually we should add specific cartesian_product methods that take products of charts etc

Indeed, Cartesian products of manifolds are not implemented yet. The method cartesian_product inherited from the category framework works somehow:

sage: I = manifolds.OpenInterval(0, 1)
sage: II = I.cartesian_product(I)
sage: II.an_element()
(Point on the Real interval (0, 1), Point on the Real interval (0, 1))


However the outcome is not a manifold:

sage: II.atlas()
...
AttributeError: 'CartesianProduct_with_category' object has no attribute 'atlas'


I guess the outcome shall belong to a subclass of a manifold class, keeping track of the fact it is a Cartesian product. What is the usage in Sage? For instance, we have

sage: V = QQ^2
sage: V
Vector space of dimension 2 over Rational Field
sage: VV = V.cartesian_product(V)
sage: VV
The Cartesian product of (Vector space of dimension 2 over Rational Field,
Vector space of dimension 2 over Rational Field)
sage: dim(V)
2
sage: dim(VV)
...
AttributeError: 'CartesianProduct_with_category' object has no attribute '_indices'


So it seems that the Cartesian product of vector spaces is not considered as a vector space.

### comment:4 Changed 18 months ago by mkoeppe

That's right, also vector spaces are missing a specialization of this method. However, combinatorial free modules have an implementation:

sage: W = QQ^[1,2]
sage: W
Free module generated by {1, 2} over Rational Field
sage: WW = W.cartesian_product(W)
sage: WW
Free module generated by {1, 2} over Rational Field (+) Free module generated by {1, 2} over Rational Field
sage: dim(WW)
4


### comment:5 Changed 18 months ago by tscrim

I know this is out of scope of this ticket, but I wanted to just say that for normal vector spaces, one way to do it would be to simply redirect to direct_sum.

### comment:6 Changed 18 months ago by mkoeppe

• Milestone changed from sage-9.3 to sage-9.4

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

### comment:7 Changed 18 months ago by gh-mjungmath

It's about time that product manifolds will be added to the inventory. Shouldn't be too hard, at least on the level of charts. Question is: do we want to implement a whole new class such as CartesianProductManifold that also has projection maps?

### comment:8 Changed 18 months ago by mkoeppe

Yes, it should support the protocol of cartesian products of sets defined in sage.categories.sets_cat, including cartesian_factors and cartesian_projection

### comment:9 follow-up: ↓ 10 Changed 18 months ago by gh-tobiasdiez

Maybe it's a good idea to directly implement the more general case of a fibred product $M \times_N M'$ for smooth maps $f, f': M \to N$ (one of them being a submersion). The charts are a bit more complicated, but this more general situation occurs quite often.

(Not sure if sage has an implementation of categorical pullbacks.)

### comment:10 in reply to: ↑ 9 ; follow-up: ↓ 11 Changed 18 months ago by gh-mjungmath

Yes, it should support the protocol of cartesian products of sets defined in sage.categories.sets_cat, including cartesian_factors and cartesian_projection

Thanks for the reference.

Maybe it's a good idea to directly implement the more general case of a fibred product $M \times_N M'$ for smooth maps $f, f': M \to N$ (one of them being a submersion). The charts are a bit more complicated, but this more general situation occurs quite often.

Sounds good.

Still, one question remains: should our new manifold keep track of changes in the factors or not? The former could result in quite annoying code-writing.

Last edited 18 months ago by gh-mjungmath (previous) (diff)

### comment:11 in reply to: ↑ 10 ; follow-up: ↓ 12 Changed 18 months ago by mkoeppe

Still, one question remains: should our new manifold keep track of changes in the factors or not? The former could result in quite annoying code-writing.

You could consider making it an error if the user tries to take the product of mutable manifolds.

### comment:12 in reply to: ↑ 11 Changed 18 months ago by gh-mjungmath

You could consider making it an error if the user tries to take the product of mutable manifolds.

Good idea. We should make it possible to turn (mutable) manifolds into immutable objects anyway. But I assume that needs a refactoring of the current use of UniqueRepresentation.

Similarly for vector bundles (and their tensor products) btw.

### comment:13 follow-up: ↓ 14 Changed 18 months ago by tscrim

The immutability would likely require a fairly big refactoring of the manifolds code to have checks when performing "mutations" of the manifold, such as adding a chart, frame, transition map, etc.

### comment:14 in reply to: ↑ 13 ; follow-up: ↓ 15 Changed 18 months ago by gh-mjungmath

The immutability would likely require a fairly big refactoring of the manifolds code to have checks when performing "mutations" of the manifold, such as adding a chart, frame, transition map, etc.

Does it? At least for the latter, one could use the mutability wrappers or _require_(im)mutable method. That's fairly doable I'd say.

As for the UniqueRepresentation part, I honestly don't know. That might be effortful.

### comment:15 in reply to: ↑ 14 ; follow-up: ↓ 16 Changed 18 months ago by egourgoulhon

As for the UniqueRepresentation part, I honestly don't know. That might be effortful.

Yes it would be desirable to get rid of UniqueRepresentation for manifolds. If I am correct, UniqueRepresentation is used only to provide an effective pickling, which is mandatory for parallel computations.

Last edited 18 months ago by egourgoulhon (previous) (diff)

### comment:16 in reply to: ↑ 15 Changed 18 months ago by tscrim

As for the UniqueRepresentation part, I honestly don't know. That might be effortful.

Yes it would be desirable to get rid of UniqueRepresentation for manifolds. If I am correct, UniqueRepresentation is used only to provide an effective pickling, which is mandatory for parallel computations.

Still on my to-do list........

@gh-mjungmath There are a lot of things that "change" the manifold. Thus, there would be a lot of methods that need to be altered to have immutability checks. There are also questions like, "Does creating a new k-form change the manifold?" In many ways, no, but it becomes tied to the manifold as it changes _vector_field_modules attribute. Plus it is something you would want to naturally lift up to the product manifold.

### comment:17 Changed 18 months ago by egourgoulhon

A general question about this ticket: to what extent do we want the outcome of cartesian_product keep track that it has been generated as a product? For instance, if

sage: S1 = manifolds.Sphere(1)
sage: T2 = S1.cartesian_product(S1)


do we want

sage: T2.an_element()
(Point on the 1-sphere S^1 of radius 1 smoothly embedded in the Euclidean plane E^2,
Point on the 1-sphere S^1 of radius 1 smoothly embedded in the Euclidean plane E^2)


or something like

sage: T2.an_element()
Point on S^1 x S^1

Last edited 18 months ago by egourgoulhon (previous) (diff)

### comment:18 Changed 18 months ago by mkoeppe

No preference here, as long as cartesian_projection is implemented

### comment:19 Changed 18 months ago by gh-mjungmath

I don't care so much either. Though, I think the latter is a bit neater.

### comment:20 Changed 13 months ago by mkoeppe

• Milestone changed from sage-9.4 to sage-9.5

### comment:21 Changed 8 months ago by mkoeppe

• Milestone changed from sage-9.5 to sage-9.6

### comment:22 Changed 5 months ago by mkoeppe

• Milestone changed from sage-9.6 to sage-9.7
Note: See TracTickets for help on using tickets.