Skip to content

Applying a transformation to all elements of a set #322

Description

@WhiteBlackGoose

It will be possible once we implement quantifiers

Example for intervals

image

Activity

  1. added this to the 1.6 milestone on Mar 12, 2021
  2. Rafael-SOWNet commented on Aug 31, 2026

    @Rafael-SOWNet
    Member

    Measured on master today. This does not need quantifiers, and most of it is already done.

    Finite sets already map any function

    "({ 1, 2, 3 }) ^ 2".ToEntity().Simplify()   // { 1, 4, 9 }
    "sin({ 1, 2, 3 })".ToEntity().Simplify()    // { sin(1), sin(2), sin(3) }
    "ln({ 1, 2, 3 })".ToEntity().Simplify()     // { 0, ln(2), ln(3) }
    "({ 1, 2, 3 }) + 1".ToEntity().Simplify()   // { 2, 3, 4 }

    Intervals are half done, and the half that exists needs no quantifier either

    "(0; 1) + 1".ToEntity().Simplify()   // (1; 2)      ✔
    "(0; 1) - 5".ToEntity().Simplify()   // (-5; -4)    ✔
    "(0; 1) * 2".ToEntity().Simplify()   // (0; 1) * 2  ✘ untouched
    "ln((0; 1))".ToEntity().Simplify()   // ln((0; 1))  ✘ untouched

    Sumf and Minusf have interval cases in Evaluation.Continuous.Arithmetics.Classes.cs; Mulf and Divf have none. So the gap is interval arithmetic, not quantification — sliding an interval is already there, scaling it is not.

    Reading the two that exist turned up a wrong answer

    Subtracting an interval reflects it, so its ends have to swap — and the code slid both without swapping:

    "5 - (0; 1)".ToEntity().Simplify()          // was (5; 4) — left end above right, so empty
    "4.5 in (5 - (0; 1))".ToEntity().Simplify() // was False

    Fixed in #1117, with the openness swapping too (5 - (0; 1] is [4; 5), not (4; 5]).

    What is left for this issue

    Mulf and Divf over an interval, which is a sign analysis rather than a new concept:

    multiplier (a; b) * k
    k > 0 (k*a; k*b), ends and openness in place
    k < 0 (k*b; k*a), ends and openness swapped — exactly as subtraction does
    k = 0 { 0 }, the interval collapsing to a point
    sign unknown left alone, because answering would be choosing one

    Division by a constant is the same with 1/k; division by an interval straddling zero is not an interval at all and should be left alone.

    Non-monotonic functions are a different question and I would leave them out: ln((0; 1)) is (-oo; 0) because ln is increasing, but sin((0; 7)) is [-1; 1] and getting there needs to know where the turning points are. Monotonic-function-over-interval is a reasonable follow-up; general f over an interval is the thing that would want more machinery.

    The label says Not now, so I have not implemented the multiplication — happy to if you want it, and the sign table above is the whole of it.

  3. modified the milestones: 1.7, Future on Sep 18, 2026
  4. modified the milestones: Future, 2.6.0 on Sep 18, 2026
  5. Happypig375 commented on Sep 18, 2026

    @Happypig375
    Member

    This is easy to do, just do 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

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions