Skip to content

Hold symbolic powers unevaluated if evaluation fails #21758

@rwst

Description

@rwst

Automatic evaluation of symbolic expressions of "numerics" prevents construction of such expressions despite them being perfectly numerically approximatable (or otherwise useful) if exact evaluation in the algebraic sense fails. This is usually not a problem with function expressions (because of the easily added hold=True), and sums and products (?), but powers have to be constructed awkwardly:

            sage: SR(2) ^ SR(QQbar(sqrt(2)))
            Traceback (most recent call last):
            ...
            TypeError: no canonical coercion ...
            sage: SR(2).power(SR(QQbar(sqrt(2))), hold=True)
            2^1.414213562373095?

The ticket catches TypeErrors in the first case and automatically uses the second form, to allow:

            sage: SR(2) ^ SR(QQbar(sqrt(2)))
            2^1.414213562373095?

CC: @videlec

Component: symbolics

Author: Ralf Stephan

Branch/Commit: u/rws/hold_symbolic_powers_unevaluated_if_evaluation_fails @ 49ab133

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions