Skip to content

Inexact zeros #35319

@videlec

Description

@videlec

This issue aims to discuss the problem of comparison, and in particular comparison to zero, of ambient structures that provide exact computations which involve inexact objects or objects with multiple representations. It covers

  • power series : O(t)
  • p-adic numbers : O(p)
  • (some subset of) symbolic expressions : sqrt(6) - sqrt(3) * sqrt(2)
  • ball arithmetic: RBF(0.3, 1e-18)
  • interval arithmetic: RIF(0.3 - 1e-18, 0.3 + 2e-18)
  • some quotients (do we have a relevant example?)

One of the goal is to come up with conventions that allows to manipulate accurately algebraic constructions on them such as (sparse) polynomials and (sparse) matrices. This is currently completely broken

sage: R.<t> = PowerSeriesRing(QQ)
sage: m = matrix(2, {(0,0): O(t), (1,1): O(t)}, sparse=True)
sage: m * m
[0 0]
[0 0]
sage: R['x,y'](O(t))
0

Where the result here should have been [[O(t^2) 0] [0 O(t^2)]] and O(t). Note that generic dense matrices are better behaved

sage: m = matrix(2, {(0,0): O(t), (1,1): O(t)}, sparse=False)
sage: m * m
[O(t^2)      0]
[     0 O(t^2)]

In order to solve the above algebraic construction, it is desirable to have finer distinction between different notions of being zero in order to distinguish "exact zero" that we can drop from a sparse data structure and "zero up to some precision" that should be kept. More generally, this issue is about about making specifications for comparisons of elements. For that purpose, it might be convenient to distinguish different notions of equalities

  • “syntactic” equality : identical data structures
    eg for power series, same precision and same polynomial
  • “semantic” equality : same mathematical object
    eg for power series, infinite precision and same polynomial
    (note that "semantic" difference is not the contrary of equality : two power series are semantically different if at their common precision their polynomial differ)
    (note "semantic" equality does not specify whether x == x should hold)
  • “approximate” equality : objects that look the same at the precision to which they are known
    eg for power series, equality of polynomials up to their common precision

Power series currently use approximate equality while balls use semantic equality.

What we would like to use for sparse polynomials and sparse matrices over power series/p-adic are "semantic" equality. Though it is not clear what is the best option for symbolic expressions. Something in between "syntactic" and "semantic" is probably what should be used so that "trivial" simplification could be made to keep reasonable arithmetic speed.

The main questions that are in need for specifications are

  • How many ways of comparing objects or zeroness do we need? Should these be parent specific or global comparison operators?
  • Should we implement operators or add parameters to parent to change the behavior of comparison? (potential explosion of parents!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions