EDIT (22 Jan 2023): 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 above one, provided one uses the keyword hold=True
. Let us then introduce explicitly the chart Y
= $(x,u)$ 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