Skip to content

Add is_trivial_zero() to coordinate functions and scalar fields on manifolds #23623

@egourgoulhon

Description

@egourgoulhon

This ticket implements the fast method is_trivial_zero in coordinate functions (classes sage.manifolds.coord_func.CoordFunction and sage.manifolds.coord_func_symb.CoordFunctionSymb) and scalar fields (class sage.manifolds.scalarfield.ScalarField). The method is_trivial_zero is then used instead of == 0 in tensor calculus, especially in tensor assignement, where the check for zero is performed because only nonzero components of a tensor are stored. This avoids the call to Maxima, which can be problematic in some cases, as reported in
this sage-devel post. Moreover, this results in a significant speed-up factor. For instance, the computation time of the coefficients of the Levi-Civita connection of the Kerr-Newman metric, as performed in cell 20 of this example notebook, is reduced from 5.37 s to 4.11 s (this is on a Intel Core i7-6700HQ computer).

CC: @roed314 @tscrim

Component: geometry

Keywords: coordinate function, scalar field, tensor calculus

Author: Eric Gourgoulhon

Branch/Commit: 169afc2

Reviewer: Richard L Lozes

Issue created by migration from https://trac.sagemath.org/ticket/23623

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions