First time here? Check out the FAQ!

Ask Your Question
1

Defining manifolds in a systematic way.

asked 5 years ago

sum8tion gravatar image

updated 5 years ago

FrédéricC gravatar image

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 5 years ago

rburing gravatar image

updated 5 years ago

See the documentation on charts, particularly the arguments coordinates and names.

For example, you can do the following:

sage: x = U.chart(names=tuple('x_%d' % i for i in range(2*p*q)))
sage: x[:]
(x_0, x_1, x_2, x_3)
sage: x[0]
x_0

Another example, upon request:

x_indices = [(i,j,k) for i in range(2) for j in range(2) for k in range(2)]
M = Manifold(len(x_indices), 'M', field='complex')
U = M.open_subset('U')
x_names = tuple('x_{}_{}_{}'.format(i,j,k) for (i,j,k) in x_indices)
x_coords = U.chart(names=x_names)
x = dict(zip(x_indices,x_coords))

Then you can do:

sage: x[(0,0,0)]
x_0_0_0
Preview: (hide)
link

Comments

How do I define a frame then? My naive attempt in analogy to the usual situation,

Sage: eU = x.frame()

but this doesn't work.

sum8tion gravatar imagesum8tion ( 5 years ago )

That should work (and it does for me). What version of SageMath are you running?

rburing gravatar imagerburing ( 5 years ago )
1

Oh, I just tried it again and it worked, must have made a typo the first time, thanks.

sum8tion gravatar imagesum8tion ( 5 years ago )

Hey, is there a way to do this in such a way that the coordinates have multiple indices, like x[(i,j,k)]?

sum8tion gravatar imagesum8tion ( 5 years ago )

Sure, I added another example.

rburing gravatar imagerburing ( 5 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 5 years ago

Seen: 360 times

Last updated: Aug 19 '19