Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/07/19 23:47:53 (5 years ago)
Author:
mkommend
Message:

#2966: Merged 16629, 16631, 16646, 16740, 16743, 16757, 16758, 16769, 16822 to stable.

Location:
stable
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis

  • stable/HeuristicLab.Problems.DataAnalysis/3.4

  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval.cs

    r17097 r17100  
    124124
    125125      double min = Math.Min(Math.Min(v1, v2), Math.Min(v3, v4));
    126       double max = Math.Max(Math.Min(v1, v2), Math.Max(v3, v4));
     126      double max = Math.Max(Math.Max(v1, v2), Math.Max(v3, v4));
    127127      return new Interval(min, max);
    128128    }
     
    167167    }
    168168    public static Interval Cosine(Interval a) {
    169       return Interval.Sine(Interval.Subtract(a, new Interval(Math.PI / 2, Math.PI / 2)));
     169      return Interval.Sine(Interval.Add(a, new Interval(Math.PI / 2, Math.PI / 2)));
    170170    }
    171171    public static Interval Tangens(Interval a) {
    172172      return Interval.Divide(Interval.Sine(a), Interval.Cosine(a));
     173    } 
     174    public static Interval HyperbolicTangent(Interval a) {
     175      return new Interval(Math.Tanh(a.LowerBound), Math.Tanh(a.UpperBound));
    173176    }
    174177
     
    201204
    202205    public static Interval Square(Interval a) {
    203       return Power(a, new Interval(2, 2));
    204     }
    205 
    206     public static Interval Cubic(Interval a) {
    207       return Power(a, new Interval(3, 3));
     206      if (a.UpperBound <= 0) return new Interval(a.UpperBound * a.UpperBound, a.LowerBound * a.LowerBound);     // interval is negative
     207      else if (a.LowerBound >= 0) return new Interval(a.LowerBound * a.LowerBound, a.UpperBound * a.UpperBound); // interval is positive
     208      else return new Interval(0, Math.Max(a.LowerBound*a.LowerBound, a.UpperBound*a.UpperBound)); // interval goes over zero
     209    }
     210
     211    public static Interval Cube(Interval a) {
     212      return new Interval(Math.Pow(a.LowerBound, 3), Math.Pow(a.UpperBound, 3));
    208213    }
    209214
     
    216221
    217222    public static Interval SquareRoot(Interval a) {
    218       return Root(a, new Interval(2, 2));
     223      if (a.LowerBound < 0) return new Interval(double.NaN, double.NaN);
     224      return new Interval(Math.Sqrt(a.LowerBound), Math.Sqrt(a.UpperBound));
    219225    }
    220226
    221227    public static Interval CubicRoot(Interval a) {
    222       return Root(a, new Interval(3, 3));
     228      if (a.LowerBound < 0) return new Interval(double.NaN, double.NaN);
     229      return new Interval(Math.Pow(a.LowerBound, 1.0/3), Math.Pow(a.UpperBound, 1.0/3));
    223230    }
    224231    #endregion
Note: See TracChangeset for help on using the changeset viewer.