Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

At the moment, there is no easy way to do so. Note however that it is possible to define transition maps with integrals that Sage cannot evaluate, provided one uses the keyword hold=True. Here is an example, in case it matches your needs:

Defining the metric tensor in some chart X = (x,y) on a RIemannian manifold:

sage: M = Manifold(2, 'M', structure='Riemannian')
sage: X.<x,y> = M.chart()
sage: dx, dy = X.coframe()
sage: g = M.metric()
sage: g.set((1 + x^2)*(dx*dx) + dy*dy)
sage: g.display()
g = (x^2 + 1) dxdx + dydy

Introducing a second chart,Y = (x,u) , with some transition map involving a complicated integral:

sage: Y.<x,u> = M.chart()
sage: t = var('t')
sage: X_to_Y = X.transition_map(Y, (x, y + integrate(1/(1 + exp(-t^2)), t, 0, x, hold=True)))
sage: X_to_Y.display()
x = x
u = y + integrate(1/(e^(-t^2) + 1), t, 0, x)
sage: X_to_Y.set_inverse(x, u - integrate(1/(1 + exp(-t^2)), t, 0, x, hold=True), check=False)
sage: X_to_Y.inverse().display()
x = x
y = u - integrate(1/(e^(-t^2) + 1), t, 0, x)

Checking that Sage is capable to evaluate the differential du correctly:

sage: dx, du = Y.coframe()
sage: du.display()
du = e^(x^2)/(e^(x^2) + 1) dx + dy

Getting the expression of the metric tensor in terms of dx and du:

sage: g.display(Y)
g = (x^2 + (x^2 + 2)*e^(2*x^2) + 2*(x^2 + 1)*e^(x^2) + 1)/(e^(2*x^2) + 2*e^(x^2) + 1) dxdx - e^(x^2)/(e^(x^2) + 1) dxdu - e^(x^2)/(e^(x^2) + 1) dudx + dudu
click to hide/show revision 2
No.2 Revision

At the moment, there is no easy way to do so. Note however that it is possible to define transition maps with integrals that Sage cannot evaluate, provided one uses the keyword hold=True. Here is an example, in case it matches your needs:

Defining the metric tensor in some chart X = (x,y) on a RIemannian manifold:

sage: M = Manifold(2, 'M', structure='Riemannian')
sage: X.<x,y> = M.chart()
sage: dx, dy = X.coframe()
sage: g = M.metric()
sage: g.set((1 + x^2)*(dx*dx) + dy*dy)
sage: g.display()
g = (x^2 + 1) dxdx + dydy

Introducing a second chart,Y = (x,u) , with some transition map involving a complicated integral: integral, namely u=y+x0dt1+et2

sage: Y.<x,u> = M.chart()
sage: t = var('t')
sage: X_to_Y = X.transition_map(Y, (x, y + integrate(1/(1 + exp(-t^2)), t, 0, x, hold=True)))
sage: X_to_Y.display()
x = x
u = y + integrate(1/(e^(-t^2) + 1), t, 0, x)
sage: X_to_Y.set_inverse(x, u - integrate(1/(1 + exp(-t^2)), t, 0, x, hold=True), check=False)
sage: X_to_Y.inverse().display()
x = x
y = u - integrate(1/(e^(-t^2) + 1), t, 0, x)

Checking that Sage is capable to evaluate the differential du correctly:

sage: dx, du = Y.coframe()
sage: du.display()
du = e^(x^2)/(e^(x^2) + 1) dx + dy

Getting the expression of the metric tensor in terms of dx and du:

sage: g.display(Y)
g = (x^2 + (x^2 + 2)*e^(2*x^2) + 2*(x^2 + 1)*e^(x^2) + 1)/(e^(2*x^2) + 2*e^(x^2) + 1) dxdx - e^(x^2)/(e^(x^2) + 1) dxdu - e^(x^2)/(e^(x^2) + 1) dudx + dudu
click to hide/show revision 3
No.3 Revision

EDIT (22 Jan 2023): actually what you asking for is possible, provided one introduces the vector frame that is dual to the basis constituted by the new differentials. Here is a full example:

Defining the metric tensor in some chart X = (x,y) on a RIemannian manifold:

sage: M = Manifold(2, 'M', structure='Riemannian')
sage: X.<x,y> = M.chart()
sage: dx, dy = X.coframe()
sage: g = M.metric()
sage: g.set((1 + x^2)*(dx*dx) + dy*dy)
sage: g.display()
g = (x^2 + 1) dxdx + dydy

Considering a change of coordinates that involves a "complicated" integral:

u=y+x0dt1+et2

The corresponding differential is

sage: du = 1/(1 + exp(-x^2))*dx + dy

Suppose one wants to express the metric tensor in terms of (dx,du). First, we introduce the matrix A linking (dx,dy) to (dx,du) as follows

sage: A = matrix([[w[j] for j in M.irange()] for w in (dx, du)])
sage: A
[               1                0]
[1/(e^(-x^2) + 1)                1]

Then we compute its inverse in order to form the vector frame f dual to (dx,du):

sage: P = A.inverse()
sage: n = dim(M)
sage: vf = [ M.vector_field([P[j,i] for j in range(n)]) for i in range(n) ]
sage: vf[0].display()
∂/∂x - e^(x^2)/(e^(x^2) + 1) ∂/∂y
sage: vf[1].display()
∂/∂y

At the moment, there this stage, the variable vf represents f as a list of vector fields. In order to turn it to a vector frame on M, we declare

sage: f = M.vector_frame('f', vf, symbol_dual=['dx', 'du'],
....:                    latex_symbol_dual=[r'\mathrm{d}x', r'\mathrm{d}u'])

Let us check that f is no easy way to do so. Note however that it the vector frame dual to (dx,du):

sage: f.coframe()[0].display()
dx = dx
sage: f.coframe()[1].display()
du = e^(x^2)/(e^(x^2) + 1) dx + dy
sage: g.display(f)

We can then get the expansion of the metric tensor in terms of the 'new' differentials (dx,du) via

sage: g.display(f)
g = (x^2 + (x^2 + 2)*e^(2*x^2) + 2*(x^2 + 1)*e^(x^2) + 1)/(e^(2*x^2) + 2*e^(x^2) + 1) dxdx - e^(x^2)/(e^(x^2) + 1) dxdu - e^(x^2)/(e^(x^2) + 1) dudx + dudu

* Alternative method, involving a transition map*

It is possible to define transition maps with integrals that Sage cannot evaluate, as the one above, provided one uses the keyword hold=True. Here is an example, in case it matches your needs:

Defining the metric tensor in some Let us then introduce explicitly the chart X = (x,y) on a RIemannian manifold:

sage: M = Manifold(2, 'M', structure='Riemannian')
sage: X.<x,y> = M.chart()
sage: dx, dy = X.coframe()
sage: g = M.metric()
sage: g.set((1 + x^2)*(dx*dx) + dy*dy)
sage: g.display()
g = (x^2 + 1) dxdx + dydy

Introducing a second chart,Y = $(x,u)$ , with some transition map involving a complicated integral, namely $$ u = y + \int_0^x\frac{\mathrm{d}t}{1 + e^{-t^2}}$$onM`:

sage: Y.<x,u> = M.chart()
sage: t = var('t')
sage: X_to_Y = X.transition_map(Y, (x, y + integrate(1/(1 + exp(-t^2)), t, 0, x, hold=True)))
sage: X_to_Y.display()
x = x
u = y + integrate(1/(e^(-t^2) + 1), t, 0, x)
sage: X_to_Y.set_inverse(x, u - integrate(1/(1 + exp(-t^2)), t, 0, x, hold=True), check=False)
sage: X_to_Y.inverse().display()
x = x
y = u - integrate(1/(e^(-t^2) + 1), t, 0, x)

Checking that Sage is capable to evaluate the differential du correctly:

sage: dx, du = Y.coframe()
sage: du.display()
du = e^(x^2)/(e^(x^2) + 1) dx + dy

Getting the expression of the metric tensor in terms of dx and du:

sage: g.display(Y)
g.display(Y)  # same result as above
g = (x^2 + (x^2 + 2)*e^(2*x^2) + 2*(x^2 + 1)*e^(x^2) + 1)/(e^(2*x^2) + 2*e^(x^2) + 1) dxdx - e^(x^2)/(e^(x^2) + 1) dxdu - e^(x^2)/(e^(x^2) + 1) dudx + dudu
click to hide/show revision 4
No.4 Revision

EDIT (22 Jan 2023): actually what you asking for is possible, provided one introduces the vector frame that is dual to the basis constituted by the new differentials. Here is a full example:

Defining the metric tensor in some chart X = (x,y) on a RIemannian manifold:

sage: M = Manifold(2, 'M', structure='Riemannian')
sage: X.<x,y> = M.chart()
sage: dx, dy = X.coframe()
sage: g = M.metric()
sage: g.set((1 + x^2)*(dx*dx) + dy*dy)
sage: g.display()
g = (x^2 + 1) dxdx + dydy

Considering a change of coordinates that involves a "complicated" integral:

u=y+x0dt1+et2

The corresponding differential is

sage: du = 1/(1 + exp(-x^2))*dx + dy

Suppose one wants to express the metric tensor in terms of the differentials $(\mathrm{d}x, \mathrm{d}u)$. \mathrm{d}u),insteadofthedefaultcoframe(\mathrm{d}x, \mathrm{d}y)$. First, we introduce the matrix A linking (dx,dy) to (dx,du) as follows

sage: A = matrix([[w[j] for j in M.irange()] for w in (dx, du)])
sage: A
[               1                0]
[1/(e^(-x^2) + 1)                1]

Then we compute its inverse in order to form the vector frame f dual to (dx,du):

sage: P = A.inverse()
sage: n = dim(M)
sage: vf = [ M.vector_field([P[j,i] for j in range(n)]) for i in range(n) ]
sage: vf[0].display()
∂/∂x - e^(x^2)/(e^(x^2) + 1) ∂/∂y
sage: vf[1].display()
∂/∂y

At this stage, the variable vf represents f as a list of vector fields. In order to turn it to a vector frame on M, we declare

sage: f = M.vector_frame('f', vf, symbol_dual=['dx', 'du'],
....:                    latex_symbol_dual=[r'\mathrm{d}x', r'\mathrm{d}u'])

Let us check that f is the vector frame dual to (dx,du):

sage: f.coframe()[0].display()
dx = dx
sage: f.coframe()[1].display()
du = e^(x^2)/(e^(x^2) + 1) dx + dy
sage: g.display(f)

We can then get the expansion of the metric tensor in terms of the 'new' differentials (dx,du) via

sage: g.display(f)
g = (x^2 + (x^2 + 2)*e^(2*x^2) + 2*(x^2 + 1)*e^(x^2) + 1)/(e^(2*x^2) + 2*e^(x^2) + 1) dxdx - e^(x^2)/(e^(x^2) + 1) dxdu - e^(x^2)/(e^(x^2) + 1) dudx + dudu

* Alternative method, involving a transition map*

It is possible to define transition maps with integrals that Sage cannot evaluate, as the one above, provided one uses the keyword hold=True. Let us then introduce explicitly the chart Y= $(x,u)$ onM`:

sage: Y.<x,u> = M.chart()
sage: t = var('t')
sage: X_to_Y = X.transition_map(Y, (x, y + integrate(1/(1 + exp(-t^2)), t, 0, x, hold=True)))
sage: X_to_Y.display()
x = x
u = y + integrate(1/(e^(-t^2) + 1), t, 0, x)
sage: X_to_Y.set_inverse(x, u - integrate(1/(1 + exp(-t^2)), t, 0, x, hold=True), check=False)
sage: X_to_Y.inverse().display()
x = x
y = u - integrate(1/(e^(-t^2) + 1), t, 0, x)

Checking that Sage is capable to evaluate the differential du correctly:

sage: dx, du = Y.coframe()
sage: du.display()
du = e^(x^2)/(e^(x^2) + 1) dx + dy

Getting the expression of the metric tensor in terms of dx and du:

sage: g.display(Y)  # same result as above
g = (x^2 + (x^2 + 2)*e^(2*x^2) + 2*(x^2 + 1)*e^(x^2) + 1)/(e^(2*x^2) + 2*e^(x^2) + 1) dxdx - e^(x^2)/(e^(x^2) + 1) dxdu - e^(x^2)/(e^(x^2) + 1) dudx + dudu
click to hide/show revision 5
No.5 Revision

EDIT (22 Jan 2023): actually what you are asking for is possible, provided one introduces the vector frame that is dual to the basis constituted by the new differentials. Here is a full example:

Defining the metric tensor in some chart X = (x,y) on a RIemannian manifold:

sage: M = Manifold(2, 'M', structure='Riemannian')
sage: X.<x,y> = M.chart()
sage: dx, dy = X.coframe()
sage: g = M.metric()
sage: g.set((1 + x^2)*(dx*dx) + dy*dy)
sage: g.display()
g = (x^2 + 1) dxdx + dydy

Considering a change of coordinates that involves a "complicated" integral:

u=y+x0dt1+et2

The corresponding differential is

sage: du = 1/(1 + exp(-x^2))*dx + dy

Suppose one wants to express the metric tensor in terms of the differentials (dx,du), instead of the default coframe (dx,dy). First, we introduce the matrix A linking (dx,dy) to (dx,du) as follows

sage: A = matrix([[w[j] for j in M.irange()] for w in (dx, du)])
sage: A
[               1                0]
[1/(e^(-x^2) + 1)                1]

Then we compute its inverse in order to form the vector frame f dual to (dx,du):

sage: P = A.inverse()
sage: n = dim(M)
sage: vf = [ M.vector_field([P[j,i] for j in range(n)]) for i in range(n) ]
sage: vf[0].display()
∂/∂x - e^(x^2)/(e^(x^2) + 1) ∂/∂y
sage: vf[1].display()
∂/∂y

At this stage, the variable vf represents f as a list of vector fields. In order to turn it to a vector frame on M, we declare

sage: f = M.vector_frame('f', vf, symbol_dual=['dx', 'du'],
....:                    latex_symbol_dual=[r'\mathrm{d}x', r'\mathrm{d}u'])

Let us check that f is the vector frame dual to (dx,du):

sage: f.coframe()[0].display()
dx = dx
sage: f.coframe()[1].display()
du = e^(x^2)/(e^(x^2) + 1) dx + dy

We can then get the expansion of the metric tensor in terms of the 'new' differentials (dx,du) via

sage: g.display(f)
g = (x^2 + (x^2 + 2)*e^(2*x^2) + 2*(x^2 + 1)*e^(x^2) + 1)/(e^(2*x^2) + 2*e^(x^2) + 1) dxdx - e^(x^2)/(e^(x^2) + 1) dxdu - e^(x^2)/(e^(x^2) + 1) dudx + dudu

Alternative method, involving a transition map

It is possible to define transition maps with integrals that Sage cannot evaluate, such as the one above, above one, provided one uses the keyword hold=True. Let us then introduce explicitly the chart Y = $(x,u)$ onM`:on M:

sage: Y.<x,u> = M.chart()
sage: t = var('t')
sage: X_to_Y = X.transition_map(Y, (x, y + integrate(1/(1 + exp(-t^2)), t, 0, x, hold=True)))
sage: X_to_Y.display()
x = x
u = y + integrate(1/(e^(-t^2) + 1), t, 0, x)
sage: X_to_Y.set_inverse(x, u - integrate(1/(1 + exp(-t^2)), t, 0, x, hold=True), check=False)
sage: X_to_Y.inverse().display()
x = x
y = u - integrate(1/(e^(-t^2) + 1), t, 0, x)

Checking that Sage is capable to evaluate the differential du correctly:

sage: dx, du = Y.coframe()
sage: du.display()
du = e^(x^2)/(e^(x^2) + 1) dx + dy

Getting the expression of the metric tensor in terms of dx and du:

sage: g.display(Y)  # same result as above
g = (x^2 + (x^2 + 2)*e^(2*x^2) + 2*(x^2 + 1)*e^(x^2) + 1)/(e^(2*x^2) + 2*e^(x^2) + 1) dxdx - e^(x^2)/(e^(x^2) + 1) dxdu - e^(x^2)/(e^(x^2) + 1) dudx + dudu