Opened 7 months ago
Closed 7 months ago
#30318 closed enhancement (fixed)
Dot and cross products along a differentiable map
Reported by:  egourgoulhon  Owned by:  

Priority:  major  Milestone:  sage9.2 
Component:  manifolds  Keywords:  dot product, cross product, curve 
Cc:  tscrim, ghmjungmath, mkoeppe  Merged in:  
Authors:  Eric Gourgoulhon  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  b793247 (Commits, GitHub, GitLab)  Commit:  b793247cb36beea4617c79330fa6559958de7e5b 
Dependencies:  Stopgaps: 
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 FrenetSerret 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 FrenetSerret 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
Change History (10)
comment:1 Changed 7 months ago by
 Branch set to public/manifolds/30318dot_cross_product_along_diff_map
 Commit set to 2f3ac094f2ef2765f4b9d447fbfac5e5680056ca
comment:2 Changed 7 months ago by
 Cc tscrim ghmjungmath mkoeppe added
 Status changed from new to needs_review
comment:3 followup: ↓ 5 Changed 7 months ago by
 Reviewers set to 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.
comment:4 Changed 7 months ago by
 Status changed from needs_review to needs_work
There are doctest errors in pseudo_riemannian_submanifold.py
.
comment:5 in reply to: ↑ 3 Changed 7 months ago by
Replying to tscrim:
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 7 months ago by
 Commit changed from 2f3ac094f2ef2765f4b9d447fbfac5e5680056ca to b793247cb36beea4617c79330fa6559958de7e5b
Branch pushed to git repo; I updated commit sha1. New commits:
b793247  #30318: Improve dot and cross product

comment:7 Changed 7 months ago by
 Status changed from needs_work to 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 7 months ago by
 Status changed from needs_review to positive_review
Thank you. LGTM.
comment:9 Changed 7 months ago by
Thank you for the review!
comment:10 Changed 7 months ago by
 Branch changed from public/manifolds/30318dot_cross_product_along_diff_map to b793247cb36beea4617c79330fa6559958de7e5b
 Resolution set to fixed
 Status changed from positive_review to closed
New commits:
30318: Dot and cross products along a differentiable map