Opened 16 months ago
Closed 15 months ago
#28716 closed enhancement (fixed)
Construction of a vector frame from a family of vector fields
Reported by:  egourgoulhon  Owned by:  

Priority:  major  Milestone:  sage9.0 
Component:  geometry  Keywords:  manifolds, vector_frame 
Cc:  tscrim  Merged in:  
Authors:  Eric Gourgoulhon  Reviewers:  Michael Jung 
Report Upstream:  N/A  Work issues:  
Branch:  81e2f60 (Commits, GitHub, GitLab)  Commit:  81e2f60b2247b473b0d2aa8c059a2211faa4ff63 
Dependencies:  Stopgaps: 
Description (last modified by )
This ticket modifies DifferentiableManifold.vector_frame()
to allow for constructing a vector frame from a spanning family of linearly independent vector fields:
sage: M = Manifold(2, 'M') sage: X.<x,y> = M.chart() sage: e0 = M.vector_field(1+x^2, 1+y^2) sage: e1 = M.vector_field(2, x*y) sage: e = M.vector_frame('e', (e0, e1)); e Vector frame (M, (e_0,e_1)) sage: e[0].display() e_0 = (x^2 + 1) d/dx + (y^2 + 1) d/dy sage: e[1].display() e_1 = 2 d/dx  x*y d/dy sage: (e[0], e[1]) == (e0, e1) True
Previously, the only way to introduce the vector frame e
was to first introduce the automorphism relating the frame (d/dx, d/dy)
to (e0, e1)
and to pass this automorphism to VectorFrame.new_frame()
:
sage: aut = M.automorphism_field() sage: aut[:] = [[e0[0], e1[0]], [e0[1], e1[1]]] sage: e = X.frame().new_frame(aut, 'e')
Implementation details: such functionality already existed for bases of finite rank free modules; the relevant code is extracted from the method FiniteRankFreeModule.basis()
and put into the new method FreeModuleBasis._init_from_family()
, in order to be used in DifferentiableManifold.vector_frame()
as well.
Change History (31)
comment:1 Changed 16 months ago by
 Branch set to public/manifolds/vector_frame_from_family28716
 Commit set to 013fb8b665adaf1339372c457fca851246d30a3c
comment:2 Changed 16 months ago by
 Cc tscrim added
 Status changed from new to needs_review
comment:3 Changed 16 months ago by
 Description modified (diff)
comment:4 followup: ↓ 6 Changed 16 months ago by
Do we need the optional parameter? Basically, can we just use the fact that a tuple/list is being given and then assume it is suppose to be a family of vector fields? If it has to be a keyword, I would change from_family
to the more descriptive from_vector_fields
.
comment:5 followup: ↓ 7 Changed 16 months ago by
This is a great idea and would be very useful for vector bundles, too. Sometimes I got really annoyed by this detour. Would you mind to adapt your code, if working, for vector bundles aswell?
By the way: We should combine vector bundles and the previous implementations really really soon (in this case inherit vector frames from local frames) otherwise things could get extremly messy.
Unfortunately, I am quite busy working at my master thesis right now. I can almost feel the deadline touching my skin. I promise to work on that as soon as I've gained some time back.
Even though I don't have the time now, I've opened the corresponding ticket #28718, just to keep this task in mind.
comment:6 in reply to: ↑ 4 Changed 16 months ago by
Replying to tscrim:
Thanks for your prompt feedback.
Do we need the optional parameter? Basically, can we just use the fact that a tuple/list is being given and then assume it is suppose to be a family of vector fields?
Good idea, this is much more userfriendly! I am on it...
comment:7 in reply to: ↑ 5 Changed 16 months ago by
Replying to ghDeRhamSource:
This is a great idea and would be very useful for vector bundles, too. Sometimes I got really annoyed by this detour.
Yes, this should have been done sooner...
Would you mind to adapt your code, if working, for vector bundles aswell?
OK, I'll try to do this (see below).
By the way: We should combine vector bundles and the previous implementations really really soon (in this case inherit vector frames from local frames) otherwise things could get extremly messy.
Yes, I agree. Note however that this ticket does not touch the class VectorFrame
, only the user interface DifferentiableManifold.vector_frame()
. I'll perform a similar change to the interfaces TopologicalVectorBundle.local_frame()
and TensorBundle.local_frame()
.
Unfortunately, I am quite busy working at my master thesis right now. I can almost feel the deadline touching my skin.
Good luck with your master thesis!
I promise to work on that as soon as I've gained some time back. Even though I don't have the time now, I've opened the corresponding ticket #28718, just to keep this task in mind.
Thanks.
comment:8 Changed 16 months ago by
 Commit changed from 013fb8b665adaf1339372c457fca851246d30a3c to d0ef4d77e44422e25fbdfbc90e9c852387a15033
comment:9 Changed 16 months ago by
 Description modified (diff)
In the latest version (cf. comment:8 commits)
vector_frame()
accepts a tuple/list of vector fields as a positional argument, the keyword argumentfrom_family
being suppressed, following the suggestion made in comment:4. The
ZeroDivisionError
that occurs if the vector fields are not linearly independent (the exception is raised when computing the inverse of the automorphism relating the new frame to a previous one) is cached with a proper error message.  The documentation of the module
sage.manifolds.differentiable.vectorframe
has been updated to take into account the new functionality. TensorBundle.local_frame()
has been updated to offer the same functionality, following comment:5. A
TODO
section has been added toTopologicalVectorBundle.local_frame()
for implementing a similar functionality with local sections in the future.
I propose to stay here for this ticket, i.e. to let the modification of TopologicalVectorBundle.local_frame()
to a future ticket (#28718 ?). This is mostly to avoid code duplication with DifferentiableManifold.vector_frame()
, waiting for a clearer view of #28718. Besides, I will be extremely busy in the coming weeks and I would like very much the vector_frame()
functionality introduced in the current ticket to make its way in Sage 9.0.
comment:10 Changed 16 months ago by
Do you agree with the above changes (comment:9)?
comment:11 followup: ↓ 13 Changed 16 months ago by
Partially. Of course, we can postpone this to another ticket, preferrably to #28718. However, I think this fits in here perfectly well and enables the feature for vector bundles in Sage 9.0 without too much effort [1] as you already did it for the tensor bundle. But I have no strong opinion on that so just do as you prefer.
One personal reformulation:
 any connection with previously defined vector frames or vector fields  (the connection can be performed later via the method + connecting it to previously defined vector frames or vector fields + (this can still be performed later via the method
[1] at least so far as I can see
comment:12 Changed 16 months ago by
 Commit changed from d0ef4d77e44422e25fbdfbc90e9c852387a15033 to 6635fad2f2c51e5b8e99ea4da98e6b9cd26b020c
Branch pushed to git repo; I updated commit sha1. New commits:
6635fad  Construction of a local frame on a vector bundle from a family of sections

comment:13 in reply to: ↑ 11 Changed 16 months ago by
Replying to ghDeRhamSource:
Partially. Of course, we can postpone this to another ticket, preferrably to #28718. However, I think this fits in here perfectly well and enables the feature for vector bundles in Sage 9.0 without too much effort [1] as you already did it for the tensor bundle.
OK I've done it in the above commit. I've also improved the catching of the error in case of linearly dependent elements.
One personal reformulation:
 any connection with previously defined vector frames or vector fields  (the connection can be performed later via the method + connecting it to previously defined vector frames or vector fields + (this can still be performed later via the method
Done as well.
comment:14 Changed 16 months ago by
Thank you so much! I'll give it a further look this or tomorrow afternoon.
It seems, we are at beta6 now.
comment:15 followup: ↓ 17 Changed 16 months ago by
I gave it some short tests. This is a huge improvement for using frames! Thanks! :)
Just a minor thing:
 ``self`` (`n` being the dimension of ``self``) defining the local + ``self`` (`n` being the rank of ``self``) defining the local
Apart from that it looks fine to me. As soon as you merged the recent develop branch into this one and patchbot says "yes", I could give it a positive review. Travis?
comment:16 Changed 16 months ago by
 Commit changed from 6635fad2f2c51e5b8e99ea4da98e6b9cd26b020c to 81e2f60b2247b473b0d2aa8c059a2211faa4ff63
comment:17 in reply to: ↑ 15 Changed 16 months ago by
Replying to ghDeRhamSource:
Just a minor thing:
 ``self`` (`n` being the dimension of ``self``) defining the local + ``self`` (`n` being the rank of ``self``) defining the local
Thanks for pointing this; it is corrected in the above commit.
comment:18 followup: ↓ 19 Changed 16 months ago by
There is one thing I'm not sure about. Namely the line:
mat = [[c[[i]] for c in comps] for i in fmodule.irange()] aut.add_comp(basis)[:] = mat this > aut.add_comp(self)[:] = mat fmodule.set_change_of_basis(basis, self, aut)
in free_module_basis.py
.
Shouldn't it be the identity matrix with respect to that basis? Or did I get something wrong?
comment:19 in reply to: ↑ 18 ; followup: ↓ 20 Changed 16 months ago by
Replying to ghDeRhamSource:
There is one thing I'm not sure about. Namely the line:
mat = [[c[[i]] for c in comps] for i in fmodule.irange()] aut.add_comp(basis)[:] = mat this > aut.add_comp(self)[:] = mat fmodule.set_change_of_basis(basis, self, aut)in
free_module_basis.py
.Shouldn't it be the identity matrix with respect to that basis? Or did I get something wrong?
The formula is correct: it should not be the identity matrix but the matrix of the changeofbasis automorphism, which has the same expression in both bases.
comment:20 in reply to: ↑ 19 Changed 16 months ago by
 Reviewers set to Michael Jung
 Status changed from needs_review to positive_review
Replying to egourgoulhon:
The formula is correct: it should not be the identity matrix but the matrix of the changeofbasis automorphism, which has the same expression in both bases.
Yeah, you're absolutely right. I thought it through once again and come to the same conclusion now. Furthermore, some tests on this did work properly. Sorry!
So from my perspective, everything is fine. I'll give it a positive review.
comment:21 Changed 16 months ago by
Thank you for the review!
comment:22 followup: ↓ 23 Changed 15 months ago by
 Status changed from positive_review to needs_work
Merge conflict
comment:23 in reply to: ↑ 22 ; followup: ↓ 24 Changed 15 months ago by
comment:24 in reply to: ↑ 23 ; followup: ↓ 25 Changed 15 months ago by
Replying to egourgoulhon:
Replying to vbraun:
Merge conflict
There is no conflict with the just released 9.0.beta7. Is it a conflict with #27784 (which is not merged yet)?
Not sure. But to run some tests for my thesis, I merged these two tickets and a conflict occured. Just a very minor thing about lines if I remember correctly.
However, either ticket needs to be merged to be certain.
comment:25 in reply to: ↑ 24 Changed 15 months ago by
Replying to ghDeRhamSource:
Replying to egourgoulhon:
Replying to vbraun:
Merge conflict
There is no conflict with the just released 9.0.beta7. Is it a conflict with #27784 (which is not merged yet)?
Not sure. But to run some tests for my thesis, I merged these two tickets and a conflict occured. Just a very minor thing about lines if I remember correctly.
Yes most of the time these conflicts due to various developments performed in parallel are very minor and easy to solve.
However, either ticket needs to be merged to be certain.
Yes. I am afraid we have to wait for the next beta to solve this...
comment:26 followup: ↓ 27 Changed 15 months ago by
Since you basically know what ticket, I would just merge that in and set this back to positive review with that as a dependency.
comment:27 in reply to: ↑ 26 ; followup: ↓ 28 Changed 15 months ago by
comment:28 in reply to: ↑ 27 ; followup: ↓ 29 Changed 15 months ago by
Replying to ghDeRhamSource:
Replying to tscrim:
Since you basically know what ticket, I would just merge that in and set this back to positive review with that as a dependency.
Good idea. I'll do that for #27784. I need to add a minor thing into the documentation of characteristic classes anyway.
Done.
comment:29 in reply to: ↑ 28 Changed 15 months ago by
Replying to ghDeRhamSource:
Replying to ghDeRhamSource:
Replying to tscrim:
Since you basically know what ticket, I would just merge that in and set this back to positive review with that as a dependency.
Good idea. I'll do that for #27784. I need to add a minor thing into the documentation of characteristic classes anyway.
Done.
Thanks!
I am then setting this ticket back to positive review and will have a look at #27784.
comment:30 Changed 15 months ago by
 Status changed from needs_work to positive_review
According to comment:29.
comment:31 Changed 15 months ago by
 Branch changed from public/manifolds/vector_frame_from_family28716 to 81e2f60b2247b473b0d2aa8c059a2211faa4ff63
 Resolution set to fixed
 Status changed from positive_review to closed
New commits:
Add construction of a vector frame from a family of vector fields