Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Defining manifolds in a systematic way.

I'm working on writing an algorithm that does some specific computations with manifolds. I would like to be able to simply enter 2 numbers "p" and "q" which determine the manifold's dimension p*q, and have the algorithm run right from there. This requires having Sage set up the manifold right from those two numbers. I'm having trouble at the level of defining the chart. Below I begin a naive attempt.

Sage: p=1
Sage: q=2
Sage: M = Manifold((2*p*q), 'M', field='complex')
Sage: U = M.open_subset('U')
Sage: x = list(var('x_%d' %i) for i in range((2*p*q)))

Everything works fine up to this point. Now, I need to define variables for a chart for this manifold. I would like to do something like

Sage: c.<x[0],x[1],x[2],x[3]> = U.chart()

where I'm using the variables I've defined as my coordinates. However, Sage doesn't allow me to do this. Furthermore, even if I could, I'm not sure how I would set this up so I didn't have to type in the variables by hand, because I want to set it up so I just have to feed Sage p and q, and let it build the manifold on its own.

click to hide/show revision 2
retagged

Defining manifolds in a systematic way.

I'm working on writing an algorithm that does some specific computations with manifolds. I would like to be able to simply enter 2 numbers "p" and "q" which determine the manifold's dimension p*q, and have the algorithm run right from there. This requires having Sage set up the manifold right from those two numbers. I'm having trouble at the level of defining the chart. Below I begin a naive attempt.

Sage: p=1
Sage: q=2
Sage: M = Manifold((2*p*q), 'M', field='complex')
Sage: U = M.open_subset('U')
Sage: x = list(var('x_%d' %i) for i in range((2*p*q)))

Everything works fine up to this point. Now, I need to define variables for a chart for this manifold. I would like to do something like

Sage: c.<x[0],x[1],x[2],x[3]> = U.chart()

where I'm using the variables I've defined as my coordinates. However, Sage doesn't allow me to do this. Furthermore, even if I could, I'm not sure how I would set this up so I didn't have to type in the variables by hand, because I want to set it up so I just have to feed Sage p and q, and let it build the manifold on its own.