Metric Spaces

sage.categories.metric_spaces.MetricSpaces

The category of metric spaces.

A metric on a set \(S\) is a function \(d : S \times S \to \RR\) such that:

  • \(d(a, b) \geq 0\),
  • \(d(a, b) = 0\) if and only if \(a = b\).

A metric space is a set \(S\) with a distinguished metric.

Implementation

Objects in this category must implement either a dist on the parent or the elements or metric on the parent; otherwise this will cause an infinite recursion.

Todo

  • Implement a general geodesics class.
  • Implement a category for metric additive groups and move the generic distance \(d(a, b) = |a - b|\) there.
  • Incorporate the length of a geodesic as part of the default distance cycle.

EXAMPLES:

sage: from sage.categories.metric_spaces import MetricSpaces
sage: C = MetricSpaces()
sage: C
Category of metric spaces
sage: TestSuite(C).run()
class sage.categories.metric_spaces.MetricSpacesCategory(category, *args)

Bases: sage.categories.covariant_functorial_construction.RegressiveCovariantConstructionCategory

classmethod default_super_categories(category)

Return the default super categories of category.Metric().

Mathematical meaning: if \(A\) is a metric space in the category \(C\), then \(A\) is also a topological space.

INPUT:

  • cls – the class MetricSpaces
  • category – a category \(Cat\)

OUTPUT:

A (join) category

In practice, this returns category.Metric(), joined together with the result of the method RegressiveCovariantConstructionCategory.default_super_categories() (that is the join of category and cat.Metric() for each cat in the super categories of category).

EXAMPLES:

Consider category=Groups(). Then, a group \(G\) with a metric is simultaneously a topological group by itself, and a metric space:

sage: Groups().Metric().super_categories()
[Category of topological groups, Category of metric spaces]

This resulted from the following call:

sage: sage.categories.metric_spaces.MetricSpacesCategory.default_super_categories(Groups())
Join of Category of topological groups and Category of metric spaces