Opened 15 months ago

Last modified 2 months ago

#30232 new defect

symbolic ring, coercion, restriction: compatible?

Reported by: gh-mjungmath Owned by:
Priority: major Milestone: sage-9.5
Component: manifolds Keywords:
Cc: egourgoulhon, mkoeppe, tscrim Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by gh-mjungmath)

At the current stage, we get the following output:

sage: M = Manifold(2, 'M', structure='topological') # the 2-dimensional sphere S^2
sage: U = M.open_subset('U') # complement of the North pole
sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole
sage: V = M.open_subset('V') # complement of the South pole
sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole
sage: M.declare_union(U,V)   # S^2 is the union of U and V
sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)),
....:                                intersection_name='W',
....:                                restrictions1= x^2+y^2!=0,
....:                                restrictions2= u^2+v^2!=0)
sage: uv_to_xy = xy_to_uv.inverse()
sage: f = M.scalar_field_algebra()(x+u)
sage: f.display()
M --> R
sage: f._express
{}

This output is not consistent with the coercion model, in particular not with the coercion SR -> ScalarFieldAlgebra. First of all, each element in SR should give rise to a well-defined element in ScalarFieldAlgebra. This is not fulfilled in the first example. More precisely:

sage: g = A(x)
sage: g.display()
M --> R
on U: (x, y) |--> x
on W: (u, v) |--> u/(u^2 + v^2)
sage: h = V.scalar_field_algebra()(x)
sage: h.display()
V --> R
on W: (u, v) |--> u/(u^2 + v^2)
on W: (x, y) |--> x

The scalar fields resulting from the coercion SR -> ScalarFieldAlgebra are not defined on the whole manifold, as they should be for a coercion. In fact, the results are not even well-defined since they are not uniquely determined by the input.

Things get more out of control if no transition map is stated (for example, the transitivity axiom for coercions is violated). However, we probably can assume that this would not reflect the intended usage.

Change History (17)

comment:1 Changed 15 months ago by gh-mjungmath

  • Description modified (diff)

comment:2 Changed 15 months ago by gh-mjungmath

  • Description modified (diff)

comment:3 Changed 15 months ago by gh-mjungmath

What about applying add_expr_by_continuation to obtain a scalar field on the whole manifold? This would also result in an error message if no transition map has been stated and solve two problems at once.

Last edited 15 months ago by gh-mjungmath (previous) (diff)

comment:4 Changed 15 months ago by mkoeppe

I can't comment on the details, but if it's not canonical, it should not be a coercion but only a conversion.

comment:5 Changed 15 months ago by gh-mjungmath

I agree. However, the symbolic ring is stated as the base ring of the commutative algebra of scalar fields, which means that there must be a coercion by definition.

Alternatively, the base ring must be changed. But to what?

Last edited 15 months ago by gh-mjungmath (previous) (diff)

comment:6 Changed 15 months ago by tscrim

The implementation of the scalar field algebra is currently a bit of an abuse since SR is not the true base topological field of the manifold, just an approximation for it. However, there is a good case for the convenience of having it. If you decide to not keep the abuse, then I would change the base field of the scalar field algebra to be the base field of the manifold.

comment:7 follow-up: Changed 14 months ago by gh-mjungmath

What about this stating as our base ring? It seems that this is exactly what we need.

comment:8 in reply to: ↑ 7 ; follow-up: Changed 14 months ago by egourgoulhon

Replying to gh-mjungmath:

What about this stating as our base ring? It seems that this is exactly what we need.

Well, I am not sure, because in addition to the coordinate symbols, we need other variables, which may represent some parameters in the scalar field. For instance, we may have

sage: M = Manifold(2, 'M')                                                      
sage: X.<x,y> = M.chart()                                                       
sage: a = var('a')                                                              
sage: f = M.scalar_field(a*x)                                                   

comment:9 in reply to: ↑ 8 ; follow-up: Changed 14 months ago by egourgoulhon

Replying to egourgoulhon:

Replying to gh-mjungmath:

What about this stating as our base ring? It seems that this is exactly what we need.

Well, I am not sure, because in addition to the coordinate symbols, we need other variables, which may represent some parameters in the scalar field.

To clarify, we have currently:

sage: M = Manifold(2, 'M')                                                      
sage: X.<x,y> = M.chart()                                                       
sage: a = var('a', domain='real')                                                             
sage: f = M.scalar_field(a*x)
sage: g = a*f                                                                   
sage: g                                                                         
Scalar field on the 2-dimensional differentiable manifold M
sage: g.display()                                                               
M --> R
(x, y) |--> a^2*x

Having SR be the base field of the scalar field algebra allows the operation a*f to work directly, but maybe there is a better way...

comment:10 Changed 14 months ago by mkoeppe

  • Milestone changed from sage-9.2 to sage-9.3

comment:11 in reply to: ↑ 9 ; follow-up: Changed 14 months ago by gh-mjungmath

Replying to egourgoulhon:

Replying to egourgoulhon:

Replying to gh-mjungmath:

What about this stating as our base ring? It seems that this is exactly what we need.

Well, I am not sure, because in addition to the coordinate symbols, we need other variables, which may represent some parameters in the scalar field.

To clarify, we have currently:

sage: M = Manifold(2, 'M')                                                      
sage: X.<x,y> = M.chart()                                                       
sage: a = var('a', domain='real')                                                             
sage: f = M.scalar_field(a*x)
sage: g = a*f                                                                   
sage: g                                                                         
Scalar field on the 2-dimensional differentiable manifold M
sage: g.display()                                                               
M --> R
(x, y) |--> a^2*x

Having SR be the base field of the scalar field algebra allows the operation a*f to work directly, but maybe there is a better way...

I see your point. What about using the option accepting_variables and then successively add parameters to the base ring?

comment:12 in reply to: ↑ 11 Changed 13 months ago by egourgoulhon

Replying to gh-mjungmath:

Having SR be the base field of the scalar field algebra allows the operation a*f to work directly, but maybe there is a better way...

I see your point. What about using the option accepting_variables and then successively add parameters to the base ring?

Do you mean calling accepting_variables internally, i.e. in a way transparent to the user? I don't think we can ask the end user to do something more fancy than `var('a')...

comment:13 Changed 9 months ago by gh-mjungmath

Last edited 3 months ago by gh-mjungmath (previous) (diff)

comment:14 Changed 7 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review of ticket status, priority, and last modification date.

comment:15 Changed 3 months ago by mkoeppe

+1 on encoding dependence on parameters via subrings. #32008 (CallableSymbolicExpressionRing over subrings of SR) may be relevant.

comment:16 Changed 3 months ago by gh-mjungmath

We probably have to subclass that subring, so that it dynamically keeps track of charts defined on the manifold and thus rejects all variables coming from charts.

Last edited 3 months ago by gh-mjungmath (previous) (diff)

comment:17 Changed 2 months ago by mkoeppe

  • Milestone changed from sage-9.4 to sage-9.5
Note: See TracTickets for help on using tickets.