Opened 2 years ago
Closed 16 months ago
#30272 closed enhancement (fixed)
Mixed Forms: set_comp, comp
Reported by:  Michael Jung  Owned by:  

Priority:  major  Milestone:  sage9.4 
Component:  manifolds  Keywords:  
Cc:  Eric Gourgoulhon, Travis Scrimshaw, Matthias Köppe  Merged in:  
Authors:  Michael Jung  Reviewers:  Eric Gourgoulhon 
Report Upstream:  N/A  Work issues:  
Branch:  91fc96f (Commits, GitHub, GitLab)  Commit:  91fc96fed615f6070a729c143703907dc227819e 
Dependencies:  #31654, #30473  Stopgaps: 
Description (last modified by )
In the upcoming changes we want to allow mixed differential forms, among other things, being made immutable (see #30181, #30261).
However, the current implementation would not support that behavior properly, namely:
sage: M = Manifold(2, 'M') sage: A = M.mixed_form() sage: a = M.diff_form(2) sage: A[2] = a sage: A[2] is a True
If A
would be set immutable and a
is not, this would contradict the behavior of an immutable element. Even if a
would automatically be set immutable as soon as A
had been set immutable, this might happen not on the behalf of the user.
I'd propose a similar approach as I had done in #30208 for bundle connections, and as it is already known for tensor fields, namely by introducing methods set_comp
and comp
(add_comp
would not be necessary). Then each instance representing a homogeneous component is bound only to the mixed differential form.
As always, suggestions and opinions are welcome.
Attachments (1)
Change History (34)
comment:1 Changed 2 years ago by
Cc:  Matthias Köppe added 

comment:2 Changed 2 years ago by
Summary:  Mixed Forms: set_comp, add_comp, comp → Mixed Forms: add_comp, comp 

comment:3 Changed 2 years ago by
Summary:  Mixed Forms: add_comp, comp → Mixed Forms: set_comp, comp 

comment:4 Changed 2 years ago by
Description:  modified (diff) 

comment:5 Changed 2 years ago by
Milestone:  sage9.2 → sage9.3 

comment:6 Changed 22 months ago by
Milestone:  sage9.3 → sage9.4 

comment:7 Changed 20 months ago by
Dependencies:  → #31653 

comment:8 Changed 20 months ago by
Dependencies:  #31653 → #31654 

comment:9 Changed 20 months ago by
Branch:  → u/ghmjungmath/mixed_forms__set_comp__comp 

comment:10 Changed 20 months ago by
Commit:  → 69f7bb51b0bd5d0cfe3db416e4e15b3bedc9997a 

Branch pushed to git repo; I updated commit sha1. New commits:
69f7bb5  Trac #30272: new standard name for homogeneous components (without tests)

comment:11 Changed 20 months ago by
First approach.
What I did:
 homogeneous components are bound to mixed form and a priori detached from other instances; in particular
sage: A[0] = f sage: A[0] is f
yields
False
now.
 components are only initialized on demand (not on initialization of the mixed form)
 by default, homogeneous components are named according to the mixed form's name:
A = A_0, A_1, ...
set_comp
method similar to tensor fields
I tried to maintain as much backwards compatibility as possible. For example, even if copies now, the names are still applied if A[:] = [f, omega, eta]
syntax is used. But the longterm idea is to favor set_comp(i)[:] = ...
syntax instead of omega[:] = ...
plus A[i] = omega
syntax.
Comments are appreciated.
comment:12 Changed 20 months ago by
Commit:  69f7bb51b0bd5d0cfe3db416e4e15b3bedc9997a → 27aa360aebdcdd632fa62d6d3161d475f3954221 

Branch pushed to git repo; I updated commit sha1. New commits:
27aa360  Trac #30272: doctests added

comment:13 Changed 20 months ago by
Status:  new → needs_review 

Here we go, that should be it. Please take a close look whether this is (at least) halfway consistent and transparent to the user.
In a next step, mixed forms will be equipped with an immutability switch.
comment:15 Changed 20 months ago by
Authors:  → Michael Jung 

comment:16 Changed 20 months ago by
Reviewers:  → Eric Gourgoulhon 

Status:  needs_review → positive_review 
LGTM.
comment:18 Changed 17 months ago by
Commit:  27aa360aebdcdd632fa62d6d3161d475f3954221 → 89dc5520f76fc7ef937c073e5a799925491a88ea 

Branch pushed to git repo; I updated commit sha1. New commits:
89dc552  Trac #30272: merged

comment:19 Changed 17 months ago by
Status:  needs_work → needs_review 

comment:20 followup: 22 Changed 17 months ago by
When clicking on the new branch, one gets a huge diff, which seems to be the whole 9.4.beta3 w.r.t 9.4.beta2. Wouldn't it be better to merge the previous ticket branch into a clean 9.4.beta3?
Changed 17 months ago by
Attachment:  Screenshot 20210627 193218.png added 

comment:21 Changed 17 months ago by
comment:22 followup: 23 Changed 17 months ago by
Replying to egourgoulhon:
When clicking on the new branch, one gets a huge diff, which seems to be the whole 9.4.beta3 w.r.t 9.4.beta2. Wouldn't it be better to merge the previous ticket branch into a clean 9.4.beta3?
That sometimes happens with the trac git helper. You don't have to worry too much about it as long as it pulls okay (a la comment:21).
comment:23 Changed 17 months ago by
Replying to tscrim:
Replying to egourgoulhon:
When clicking on the new branch, one gets a huge diff, which seems to be the whole 9.4.beta3 w.r.t 9.4.beta2. Wouldn't it be better to merge the previous ticket branch into a clean 9.4.beta3?
That sometimes happens with the trac git helper. You don't have to worry too much about it as long as it pulls okay (a la comment:21).
Indeed, this seems erratic: it looks good now, while the branch has not been changed.
comment:24 Changed 17 months ago by
Status:  needs_review → positive_review 

comment:25 Changed 17 months ago by
Status:  positive_review → needs_work 

[release@zen Sage]$ sage t long warnlong 49.3 randomseed=0 src/sage/manifolds/differentiable/mixed_form.py # 4 doctests failed Running doctests with ID 20210629215639c62006fe. Git branch: develop Using optional=build,dochtml,fedora,pip,sage,sage_spkg Doctesting 1 file. sage t long warnlong 49.3 randomseed=0 src/sage/manifolds/differentiable/mixed_form.py ********************************************************************** File "src/sage/manifolds/differentiable/mixed_form.py", line 90, in sage.manifolds.differentiable.mixed_form.MixedForm Failed example: A.display_expansion() # display expansion in basis Expected: A = [x] + [x*y dx] + [x*y^2 dx/\dy] Got: A = x + x*y dx + x*y^2 dx/\dy ********************************************************************** File "src/sage/manifolds/differentiable/mixed_form.py", line 113, in sage.manifolds.differentiable.mixed_form.MixedForm Failed example: B.display_expansion() Expected: B = [x] + [x*y dx] + [x*y^2 dx/\dy] Got: B = x + x*y dx + x*y^2 dx/\dy ********************************************************************** [...]
comment:26 Changed 17 months ago by
Ah damn, I misresolved the merge conflict.
Let's wait for #30473 anyway.
comment:27 Changed 17 months ago by
Dependencies:  #31654 → #31654, #30473 

comment:28 Changed 17 months ago by
Commit:  89dc5520f76fc7ef937c073e5a799925491a88ea → f1e7ef884b03cf3ad6a7fe09b0b8892acc818063 

Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:
da8893f  Use sage.typeset.unicode_characters in TensorProductFunctor and SignedTensorProductFunctor

2a23cb5  Unicode symbol 2202 (partial) for the text display of coordinate frames

5d096f1  fstring for unicode_symbol in TensorProductFunctor and SignedTensorProductFunctor

76c2fd5  Use Unicode symbol for the Riemann sphere example

5167e6c  Use Unicode symbol for default text display of RealLine

332410b  Use unicode_otimes in TensorProductFunctor and SignedTensorProductFunctor

f5d15d2  Merge branch 'public/manifolds/unicode_art' of git://trac.sagemath.org/sage into Sage 9.4.beta4.

d87d09b  #30473: fix doctest error in DiffMap.pullback

d62adad  merge unicode

f1e7ef8  Trac #30272: remove set_name_comp + fix doctest

comment:29 Changed 17 months ago by
Status:  needs_work → needs_review 

comment:30 Changed 17 months ago by
Commit:  f1e7ef884b03cf3ad6a7fe09b0b8892acc818063 → 91fc96fed615f6070a729c143703907dc227819e 

Branch pushed to git repo; I updated commit sha1. New commits:
91fc96f  Trac #30272: minor doctest fix

comment:32 Changed 17 months ago by
Status:  needs_review → positive_review 

The patchbot reports doctest failures that all pertain to the dependency #30473. They are all fixed in the latest version of that ticket. But I don't think it necessary to merge it here to move on.
comment:33 Changed 16 months ago by
Branch:  u/ghmjungmath/mixed_forms__set_comp__comp → 91fc96fed615f6070a729c143703907dc227819e 

Resolution:  → fixed 
Status:  positive_review → closed 
Setting new milestone based on a cursory review of ticket status, priority, and last modification date.