Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit c9df1ee

Browse files
author
Release Manager
committed
Trac #28462: Bug in computing the second fundamental form of a Riemannian submanifold
As reported in this [https://ask.sagemath.org/question/47786 ask.sagemath question], we have currently (Sage 8.8 and 8.9.beta9): {{{ sage: P = Manifold(3, 'P', structure='Riemannian') sage: Q = Manifold(2, 'Q', ambient=P, structure='Riemannian') sage: CP.<x,y,z> = P.chart() sage: CQ.<u,v> = Q.chart() sage: g = P.metric() sage: c = 2/(1 + y^2 + z^2) sage: g[0,0], g[1,1], g[2,2] = 1, c^2, c^2 sage: phi = Q.diff_map(P, (u+v, u, v)) sage: phi_inv = P.diff_map(Q, (y, z)) sage: Q.set_embedding(phi, inverse=phi_inv) sage: Q.second_fundamental_form() TypeError: unable to convert 1/2*sqrt(2)*(u^4 + v^4 + 2*(u^2 + 1)*v^2 + 2*u^2 + 1)*y/ (sqrt(u^4 + v^4 + 2*(u^2 + 1)*v^2 + 2*u^2 + 3)*(y^2 + z^2 + 1)) + 1/2*sqrt(2)*(u^4 + v^4 + 2*(u^2 + 1)*v^2 + 2*u^2 + 1)*z/ (sqrt(u^4 + v^4 + 2*(u^2 + 1)*v^2 + 2*u^2 + 3)*(y^2 + z^2 + 1)) to an integer }}} This results from the mention of the ring `SR` missing in the declaration of a matrix involved in the computation. The issue is fixed by this ticket. URL: https://trac.sagemath.org/28462 Reported by: egourgoulhon Ticket author(s): Eric Gourgoulhon Reviewer(s): Florentin Jaffredo
2 parents 4c8a1ec + f815378 commit c9df1ee

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

src/sage/manifolds/differentiable/pseudo_riemannian_submanifold.py

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,23 @@ def second_fundamental_form(self):
10581058
sage: N.extrinsic_curvature().display() # long time
10591059
K = -4/(x^4 + 8*x^2 + 16) dx*dx
10601060
1061+
An example with a non-Euclidean ambient metric::
1062+
1063+
sage: M = Manifold(2, 'M', structure='Riemannian')
1064+
sage: N = Manifold(1, 'N', ambient=M, structure='Riemannian',
1065+
....: start_index=1)
1066+
sage: CM.<x,y> = M.chart()
1067+
sage: CN.<u> = N.chart()
1068+
sage: g = M.metric()
1069+
sage: g[0, 0], g[1, 1] = 1, 1/(1 + y^2)^2
1070+
sage: phi = N.diff_map(M, (u, u))
1071+
sage: N.set_embedding(phi)
1072+
sage: N.second_fundamental_form()
1073+
Field of symmetric bilinear forms K on the 1-dimensional Riemannian
1074+
submanifold N embedded in the 2-dimensional Riemannian manifold M
1075+
sage: N.second_fundamental_form().display()
1076+
K = 2*sqrt(u^4 + 2*u^2 + 2)*u/(u^6 + 3*u^4 + 4*u^2 + 2) du*du
1077+
10611078
"""
10621079
if self._ambient._dim - self._dim != 1:
10631080
raise ValueError("second_fundamental_form is defined only for"
@@ -1080,15 +1097,19 @@ def second_fundamental_form(self):
10801097
n = self.normal()
10811098

10821099
for chart in self.atlas():
1083-
gamma_n = matrix(self._dim + 1, self._dim + 1)
1100+
gamma_n = matrix(SR, self._dim + 1, self._dim + 1)
1101+
subs = dict(zip(self._ambient.default_chart()[:],
1102+
self._immersion.expression(chart)))
10841103
for i in range(self._dim + 1):
10851104
for j in range(self._dim + 1):
1086-
gamma_n[i, j] = sum(
1087-
nab[self._ambient.frames()[0], :][i][j][k].expr() *
1105+
Gam_ij = [nab[self._ambient.frames()[0],
1106+
:][i][j][k].expr().subs(subs)
1107+
for k in range(self._dim + 1)]
1108+
gamma_n[i, j] = chart.simplify(sum(
1109+
Gam_ij[k] *
10881110
n.restrict(chart.domain()).comp(
1089-
n.restrict(chart.domain())._fmodule.bases()[0])
1090-
[:][k].expr() for k in
1091-
range(self._dim + 1))
1111+
n.restrict(chart.domain())._fmodule.bases()[0])
1112+
[:][k].expr() for k in range(self._dim + 1)))
10921113
dXdu = self._immersion.differential_functions(chart)
10931114
dNdu = matrix(SR, self._dim + 1, self._dim)
10941115
for i in range(self._dim + 1):
@@ -1100,7 +1121,11 @@ def second_fundamental_form(self):
11001121
self._immersion.restrict(chart.domain())).restrict(
11011122
chart.domain())[:, chart]
11021123
K = dXdu.transpose() * g * (dNdu + gamma_n * dXdu)
1103-
resu[chart.frame(), :] = K
1124+
si = self._sindex
1125+
for i in self.irange():
1126+
for j in self.irange(i): # since K is symmetric
1127+
resu[chart.frame(), i, j, chart] = chart.simplify(
1128+
K[i - si, j - si].expr())
11041129

11051130
self._second_fundamental_form = resu
11061131
return self._second_fundamental_form

0 commit comments

Comments
 (0)