Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/04/19 10:40:51 (5 years ago)
Author:
gkronber
Message:

#2994: fix bug in calculation of cos() and sin()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/AlgebraicInterval.cs

    r17303 r17314  
    99  [DebuggerDisplay("[{low.Value}..{high.Value}]")]
    1010  public class AlgebraicInterval : IAlgebraicType<AlgebraicInterval> {
     11
     12    // turn a double into an interval (of size 0)
     13    public static implicit operator AlgebraicInterval(double value) { return new AlgebraicInterval(value, value); }
     14
    1115    [DebuggerBrowsable(DebuggerBrowsableState.Never)]
    1216    private MultivariateDual<AlgebraicDouble> low;
     
    193197    }
    194198
     199
     200    // TODO: move to constants
     201    private const double pi_2 = Math.PI / 2.0;
     202    private static readonly double[] maxima = new double[] { -3 * pi_2, pi_2, 5 * pi_2 };
     203    private static readonly double[] minima = new double[] { -5 * pi_2, -pi_2, 3 * pi_2 };
     204
    195205    public AlgebraicInterval AssignSin(AlgebraicInterval a) {
    196206      var lower = a.LowerBound.Value.Value;
     
    213223
    214224      // handle min = -1 and max = 1 cases explicitly
    215       var pi_2 = Math.PI / 2.0;
    216       var maxima = new double[] { -3 * pi_2, pi_2 };
    217       var minima = new double[] { -pi_2, 3 * pi_2 };
    218225
    219226      // override min and max if necessary
     
    294301      if (xs.Length <= 2) throw new ArgumentException("need at least 3 arguments");
    295302      AssignLowAndHigh(xs[0], xs[1]);
    296       for(int i=2;i<xs.Length;i++) {
     303      for (int i = 2; i < xs.Length; i++) {
    297304        // we must make sure that low and high are different objects when a == b
    298305        if (low.Value.CompareTo(xs[i].Value) > 0) low.Assign(xs[i]);
Note: See TracChangeset for help on using the changeset viewer.