Changes between Version 6 and Version 20 of Ticket #30291


Ignore:
Timestamp:
08/08/20 08:50:47 (4 months ago)
Author:
gh-mjungmath
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30291

    • Property Status changed from needs_review to positive_review
    • Property Cc mkoeppe added
    • Property Reviewers changed from to Travis Scrimshaw
    • Property Commit changed from 2446f7ecf68fe4034c8f92f6248cd877b2efe6f3 to 339781ab5b478be8ccf4115e085ab09707f9a8e8
  • Ticket #30291 – Description

    v6 v20  
    1 Since #30191 is merged, #30239 causes a doctest error:
     1**Setup:**
    22
    33{{{
    4 File "src/sage/manifolds/differentiable/vectorframe.py", line 160, in sage.manifolds.differentiable.vectorframe
    5 Failed example:
    6     f[1](e[1]) # the 1-form e^1 applied to the vector field e_1
    7 Expected:
    8     Scalar field e^1(e_1) on the 3-dimensional differentiable manifold M
    9 Got:
    10     Scalar field 1*1 on the 3-dimensional differentiable manifold M
     4sage: M = Manifold(2, 'M', structure='topological') # the 2-dimensional sphere S^2
     5sage: U = M.open_subset('U') # complement of the North pole
     6sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole
     7sage: V = M.open_subset('V') # complement of the South pole
     8sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole
     9sage: M.declare_union(U,V)   # S^2 is the union of U and V
     10sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)),
     11....:                                intersection_name='W',
     12....:                                restrictions1= x^2+y^2!=0,
     13....:                                restrictions2= u^2+v^2!=0)
     14sage: uv_to_xy = xy_to_uv.inverse()
     15sage: f = M.scalar_field({c_xy: 1/(1+x^2+y^2), c_uv: (u^2+v^2)/(1+u^2+v^2)},
     16....:                    name='f')
    1117}}}
    1218
    13 Much more aesthetic would be a one scalar field right away. I add some triviality checks. This should also improve performance when zero and one scalar fields are involved.
    1419
    15 I get the feeling, we already had this discussion and this should've been done already...
    16 
    17 **After this ticket (in #30239):**
     20''Current state:''
    1821
    1922{{{
    20 File "src/sage/manifolds/differentiable/vectorframe.py", line 160, in sage.manifolds.differentiable.vectorframe
    21 Failed example:
    22     f[1](e[1]) # the 1-form e^1 applied to the vector field e_1
    23 Expected:
    24     Scalar field e^1(e_1) on the 3-dimensional differentiable manifold M
    25 Got:
    26     Scalar field 1 on the 3-dimensional differentiable manifold M
     23sage: %timeit M.one_scalar_field()*f
     2410 loops, best of 5: 47.5 ms per loop
     25sage: %timeit f*M.one_scalar_field()
     2610 loops, best of 5: 48 ms per loop
    2727}}}
     28
     29''This ticket:''
     30
     31{{{
     32sage: %timeit M.one_scalar_field()*f
     33The slowest run took 4.05 times longer than the fastest. This could mean that an intermediate result is being cached.
     3410000 loops, best of 5: 21.1 µs per loop
     35sage: %timeit f*M.one_scalar_field()
     3610000 loops, best of 5: 26.5 µs per loop
     37}}}
     38
     39But the generic multiplication seems not affected:
     40
     41''Current state:''
     42
     43{{{
     44sage: %timeit f*f
     4510 loops, best of 5: 77.8 ms per loop
     46}}}
     47
     48''This ticket:''
     49
     50{{{
     51sage: %timeit f*f
     5210 loops, best of 5: 77.4 ms per loop
     53}}}
     54
     55The output is improved, too:
     56
     57''Current state:''
     58
     59{{{
     60sage: M.one_scalar_field()*M.one_scalar_field()
     61Scalar field 1*1 on the 2-dimensional topological manifold M
     62}}}
     63
     64''This ticket:''
     65
     66{{{
     67sage: M.one_scalar_field()*M.one_scalar_field()
     68Scalar field 1 on the 2-dimensional topological manifold M
     69}}}