Ask Your Question

Revision history [back]

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) dx⊗dx + dy⊗dy

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 $\mathrm{d}u$ 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 $\mathrm{d}x$ and $\mathrm{d}u$:

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) dx⊗dx - e^(x^2)/(e^(x^2) + 1) dx⊗du - e^(x^2)/(e^(x^2) + 1) du⊗dx + du⊗du

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) dx⊗dx + dy⊗dy

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

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 $\mathrm{d}u$ 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 $\mathrm{d}x$ and $\mathrm{d}u$:

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) dx⊗dx - e^(x^2)/(e^(x^2) + 1) dx⊗du - e^(x^2)/(e^(x^2) + 1) du⊗dx + du⊗du

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) dx⊗dx + dy⊗dy

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

$$ u = y + \int_0^x\frac{\mathrm{d}t}{1 + e^{-t^2}}$$

The corresponding differential is

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

Suppose one wants to express the metric tensor in terms of $(\mathrm{d}x, \mathrm{d}u)$. First, we introduce the matrix $A$ linking $(\mathrm{d}x,\mathrm{d}y)$ to $(\mathrm{d}x, \mathrm{d}u)$ 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 $(\mathrm{d}x, \mathrm{d}u)$:

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 $(\mathrm{d}x, \mathrm{d}u)$:

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 $(\mathrm{d}x, \mathrm{d}u)$ 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) dx⊗dx - e^(x^2)/(e^(x^2) + 1) dx⊗du - e^(x^2)/(e^(x^2) + 1) du⊗dx + du⊗du

* 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) dx⊗dx + dy⊗dy

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 $\mathrm{d}u$ 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 $\mathrm{d}x$ and $\mathrm{d}u$:

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) dx⊗dx - e^(x^2)/(e^(x^2) + 1) dx⊗du - e^(x^2)/(e^(x^2) + 1) du⊗dx + du⊗du

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) dx⊗dx + dy⊗dy

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

$$ u = y + \int_0^x\frac{\mathrm{d}t}{1 + e^{-t^2}}$$

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)$, instead of the default coframe $(\mathrm{d}x, \mathrm{d}y)$. First, we introduce the matrix $A$ linking $(\mathrm{d}x,\mathrm{d}y)$ to $(\mathrm{d}x, \mathrm{d}u)$ 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 $(\mathrm{d}x, \mathrm{d}u)$:

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 $(\mathrm{d}x, \mathrm{d}u)$:

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 $(\mathrm{d}x, \mathrm{d}u)$ 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) dx⊗dx - e^(x^2)/(e^(x^2) + 1) dx⊗du - e^(x^2)/(e^(x^2) + 1) du⊗dx + du⊗du

* 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 $\mathrm{d}u$ 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 $\mathrm{d}x$ and $\mathrm{d}u$:

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) dx⊗dx - e^(x^2)/(e^(x^2) + 1) dx⊗du - e^(x^2)/(e^(x^2) + 1) du⊗dx + du⊗du

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) dx⊗dx + dy⊗dy

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

$$ u = y + \int_0^x\frac{\mathrm{d}t}{1 + e^{-t^2}}$$

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)$, instead of the default coframe $(\mathrm{d}x, \mathrm{d}y)$. First, we introduce the matrix $A$ linking $(\mathrm{d}x,\mathrm{d}y)$ to $(\mathrm{d}x, \mathrm{d}u)$ 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 $(\mathrm{d}x, \mathrm{d}u)$:

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 $(\mathrm{d}x, \mathrm{d}u)$:

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 $(\mathrm{d}x, \mathrm{d}u)$ 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) dx⊗dx - e^(x^2)/(e^(x^2) + 1) dx⊗du - e^(x^2)/(e^(x^2) + 1) du⊗dx + du⊗du

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 $\mathrm{d}u$ 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 $\mathrm{d}x$ and $\mathrm{d}u$:

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) dx⊗dx - e^(x^2)/(e^(x^2) + 1) dx⊗du - e^(x^2)/(e^(x^2) + 1) du⊗dx + du⊗du