镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

The norm of a vector with complex entries is NaN when evaluated and wrong when simplified #2423

Description

@Rafael-SOWNet

The norm of a vector with complex entries is wrong one way and NaN the other. Measured on master bbf56b5:

gives should be
"abs([1 + i, 2])".ToEntity().Evaled NaN sqrt(6)
"abs([3, 4])".ToEntity().Evaled 5 5
"abs([x, y])".Simplify() sqrt(x ^ 2 + y ^ 2) sqrt(abs(x) ^ 2 + abs(y) ^ 2)
  • NaN claims the norm does not exist, but every vector has one.
  • sqrt(x^2 + y^2) is the norm only for real x and y. At x = i, y = 0 it gives 0 where the norm is 1.
  • Compiled over Complex, abs([x, y]) gives the wrong value at a complex point; over double it is right.

Found while measuring matrix compilation; no other issue covers it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions