Opened 2 years ago

Closed 2 years ago

# Dot and cross products along a differentiable map

Reported by: Owned by: Eric Gourgoulhon major sage-9.2 manifolds dot product, cross product, curve Travis Scrimshaw, Michael Jung, Matthias Köppe Eric Gourgoulhon Travis Scrimshaw N/A b793247 b793247cb36beea4617c79330fa6559958de7e5b

### Description

This ticket makes the methods `dot_product()`, `cross_product()` and `norm()` of class `VectorField` work for vector fields defined along a differentiable map, the codomain of which is a Riemannian manifold. Previously, these methods worked only for vector fields on a Riemannian manifold, i.e. along the identity map. An important subcase is of course that of a curve in a Riemannian manifold.

For instance, considering a helix parametrized by its arc length:

```sage: E.<x,y,z> = EuclideanSpace()
sage: R.<s> = RealLine()
sage: C = E.curve((2*cos(s/3), 2*sin(s/3), sqrt(5)*s/3), (s, 0, 6*pi),
....:             name='C')
```

we have now

```sage: T = C.tangent_vector_field()
sage: T.display()
C' = -2/3*sin(1/3*s) e_x + 2/3*cos(1/3*s) e_y + 1/3*sqrt(5) e_z
sage: norm(T)
Scalar field |C'| on the Real interval (0, 6*pi)
sage: norm(T).expr()
1
```

Introducing the unit normal vector N via the derivative of T:

```sage: I = C.domain()
sage: Tp = I.vector_field([diff(T[i], s) for i in E.irange()], dest_map=C,
....:                     name="T'")
sage: N = Tp / norm(Tp)
```

we get the binormal vector as the cross product of T and N:

```sage: B = T.cross_product(N)
sage: B
Vector field along the Real interval (0, 6*pi) with values on the
Euclidean space E^3
sage: B.display()
1/3*sqrt(5)*sin(1/3*s) e_x - 1/3*sqrt(5)*cos(1/3*s) e_y + 2/3 e_z
```

We can then form the Frenet-Serret frame:

```sage: FS = I.vector_frame(('T', 'N', 'B'), (T, N, B),
....:                     symbol_dual=('t', 'n', 'b'))
sage: FS
Vector frame ((0, 6*pi), (T,N,B)) with values on the Euclidean space E^3
```

and check that it is orthonormal:

```sage: [[u.dot(v).expr() for v in FS] for u in FS]
[[1, 0, 0], [0, 1, 0], [0, 0, 1]]
```

The Frenet-Serret formulas are obtained as:

```sage: Np = I.vector_field([diff(N[i], s) for i in E.irange()],
....:                     dest_map=C, name="N'")
sage: Bp = I.vector_field([diff(B[i], s) for i in E.irange()],
....:                     dest_map=C, name="B'")
sage: for v in (Tp, Np, Bp):
....:     v.display(FS)
....:
T' = 2/9 N
N' = -2/9 T + 1/9*sqrt(5) B
B' = -1/9*sqrt(5) N
```

### comment:1 Changed 2 years ago by Eric Gourgoulhon

Branch: → public/manifolds/30318-dot_cross_product_along_diff_map → 2f3ac094f2ef2765f4b9d447fbfac5e5680056ca

New commits:

 ​2f3ac09 `30318: Dot and cross products along a differentiable map`

### comment:2 Changed 2 years ago by Eric Gourgoulhon

Cc: Travis Scrimshaw Michael Jung Matthias Köppe added new → needs_review

### comment:3 follow-up:  5 Changed 2 years ago by Travis Scrimshaw

Reviewers: → Travis Scrimshaw

Thank you for this. The code looks good. One minor doctest tweak:

```-sage: [[u.dot(v).expr() for v in FS] for u in FS]
+sage: matrix([[u.dot(v).expr() for v in FS] for u in FS])
```

as I think the output is a little easier to read and to reflect that it is the Gram matrix of dot product as a bilinear form.

Once changed (or you say my idea is stupid) and a green patchbot, then positive review.

Last edited 2 years ago by Travis Scrimshaw (previous) (diff)

### comment:4 Changed 2 years ago by Eric Gourgoulhon

Status: needs_review → needs_work

There are doctest errors in `pseudo_riemannian_submanifold.py`.

### comment:5 in reply to:  3 Changed 2 years ago by Eric Gourgoulhon

Thank you for this. The code looks good. One minor doctest tweak:

```-sage: [[u.dot(v).expr() for v in FS] for u in FS]
+sage: matrix([[u.dot(v).expr() for v in FS] for u in FS])
```

as I think the output is a little easier to read and to reflect that it is the Gram matrix of dot product as a bilinear form.

Thanks for the suggestion; I'll perform the change.

### comment:6 Changed 2 years ago by git

Commit: 2f3ac094f2ef2765f4b9d447fbfac5e5680056ca → b793247cb36beea4617c79330fa6559958de7e5b

Branch pushed to git repo; I updated commit sha1. New commits:

 ​b793247 `#30318: Improve dot and cross product`

### comment:7 Changed 2 years ago by Eric Gourgoulhon

Status: needs_work → needs_review

The latest version corrects the doctest errors, takes into account comment:5 and extends the capabilities to the dot/cross product between a vector field along a diff map and a vector field defined on the codomain of the diff map.

### comment:8 Changed 2 years ago by Travis Scrimshaw

Status: needs_review → positive_review

Thank you. LGTM.

### comment:9 Changed 2 years ago by Eric Gourgoulhon

Thank you for the review!

### comment:10 Changed 2 years ago by Volker Braun

Branch: public/manifolds/30318-dot_cross_product_along_diff_map → b793247cb36beea4617c79330fa6559958de7e5b → fixed positive_review → closed
Note: See TracTickets for help on using tickets.