Opened 16 months ago

Last modified 16 months ago

#30291 closed enhancement

Scalar Field Arithmetics: Trivial Cases — at Version 6

Reported by: gh-mjungmath Owned by:
Priority: major Milestone: sage-9.2
Component: manifolds Keywords:
Cc: egourgoulhon, tscrim, mkoeppe Merged in:
Authors: Michael Jung Reviewers:
Report Upstream: N/A Work issues:
Branch: u/gh-mjungmath/scalar_field_arithmetics__trivial_cases (Commits, GitHub, GitLab) Commit: 2446f7ecf68fe4034c8f92f6248cd877b2efe6f3
Dependencies: Stopgaps:

Status badges

Description (last modified by gh-mjungmath)

Since #30191 is merged, #30239 causes a doctest error:

File "src/sage/manifolds/differentiable/vectorframe.py", line 160, in sage.manifolds.differentiable.vectorframe
Failed example:
    f[1](e[1]) # the 1-form e^1 applied to the vector field e_1
Expected:
    Scalar field e^1(e_1) on the 3-dimensional differentiable manifold M
Got:
    Scalar field 1*1 on the 3-dimensional differentiable manifold M

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.

I get the feeling, we already had this discussion and this should've been done already...

After this ticket (in #30239):

File "src/sage/manifolds/differentiable/vectorframe.py", line 160, in sage.manifolds.differentiable.vectorframe
Failed example:
    f[1](e[1]) # the 1-form e^1 applied to the vector field e_1
Expected:
    Scalar field e^1(e_1) on the 3-dimensional differentiable manifold M
Got:
    Scalar field 1 on the 3-dimensional differentiable manifold M

Change History (6)

comment:1 Changed 16 months ago by gh-mjungmath

  • Authors set to Michael Jung
  • Cc egourgoulhon tscrim added
  • Description modified (diff)
  • Summary changed from try-except block in display method to Scalar Field Arithmetics: Trivial Cases
  • Type changed from PLEASE CHANGE to enhancement

comment:2 Changed 16 months ago by gh-mjungmath

  • Component changed from PLEASE CHANGE to manifolds

comment:3 Changed 16 months ago by gh-mjungmath

  • Description modified (diff)

comment:4 Changed 16 months ago by gh-mjungmath

  • Description modified (diff)
  • Status changed from new to needs_review

comment:5 Changed 16 months ago by gh-mjungmath

  • Branch set to u/gh-mjungmath/scalar_field_arithmetics__trivial_cases

comment:6 Changed 16 months ago by gh-mjungmath

  • Commit set to 2446f7ecf68fe4034c8f92f6248cd877b2efe6f3
  • Description modified (diff)

New commits:

2446f7eTrac 30291: simple checks for trivial cases in _mul_, _add_ and _div_
Note: See TracTickets for help on using tickets.