Skip to content

Substitute with fold=true does not preserve rationals #1299

Open
JuliaSymbolics/SymbolicUtils.jl
#668
@hersle

Description

@hersle

It is annoying that

@variables x
substitute(1//2 * cos(x), x => 0)

gives 0.5 and not 1//2.

The reason is natural: cos(0) evaluates to 1.0 (not 1), giving (1//2) * 1.0, which is converted to 0.5.
Is there a way to fix this?

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