Changeset 17583


Ignore:
Timestamp:
06/04/20 14:05:19 (11 months ago)
Author:
chaider
Message:

#2971 Modified sqrt symbol: added negative square root to interval

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/Interval.cs

    r17579 r17583  
    237237
    238238    /// <summary>
    239     /// Calculates the principal square root of a given interval. Discards the second possible result of root, because
    240     /// all interpreters just calculate the positive principal root.
     239    /// The interval contains both possible results of the calculated square root +-sqrt(x). That results in a wider
     240    /// interval, but it contains all possible solutions.
    241241    /// </summary>
    242242    /// <param name="a">Interval to build square root from.</param>
     
    244244    public static Interval SquareRoot(Interval a) {
    245245      if (a.LowerBound < 0) return new Interval(double.NaN, double.NaN);
    246       return new Interval(Math.Sqrt(a.LowerBound), Math.Sqrt(a.UpperBound));
     246      return new Interval(-Math.Sqrt(a.UpperBound), Math.Sqrt(a.UpperBound));
    247247    }
    248248
Note: See TracChangeset for help on using the changeset viewer.