Changeset 16757
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval.cs
r16646 r16757 167 167 } 168 168 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))); 170 170 } 171 171 public static Interval Tangens(Interval a) { -
trunk/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/IntervalInterpreterTest.cs
r16743 r16757 79 79 EvaluateTest("sin(x1+x2)", new Interval(-1, 1), variableRanges); 80 80 EvaluateTest("sin(1+2)", new Interval(Math.Sin(3), Math.Sin(3))); 81 82 var localVarRanges = new Dictionary<string, Interval>(); 83 localVarRanges.Add("x1", new Interval(-1, 1)); 84 localVarRanges.Add("x2", new Interval(-(Math.PI / 2), 0)); 85 localVarRanges.Add("x3", new Interval(0, Math.PI / 2)); 86 localVarRanges.Add("x4", new Interval(-Math.PI, Math.PI)); 87 localVarRanges.Add("x5", new Interval(Math.PI/4, Math.PI*3.0/4)); 88 89 EvaluateTest("sin(x1)", new Interval(Math.Sin(-1), Math.Sin(1)), localVarRanges); 90 EvaluateTest("sin(x2)", new Interval(-1, 0), localVarRanges); 91 EvaluateTest("sin(x3)", new Interval(0, 1), localVarRanges); 92 EvaluateTest("sin(x4)", new Interval(-1, 1), localVarRanges); 93 EvaluateTest("sin(x5)", new Interval(Math.Sin(Math.PI/4), 1), localVarRanges); 81 94 } 82 95 … … 87 100 EvaluateTest("cos(x1+x2)", new Interval(-1, 1)); 88 101 EvaluateTest("cos(x1+x2)", new Interval(-1, 1), variableRanges); 89 EvaluateTest("cos(1+2)", new Interval(Math.Sin(3 - Math.PI / 2), Math.Sin(3 - Math.PI / 2))); 102 EvaluateTest("cos(1+2)", new Interval(Math.Sin(3 + Math.PI / 2), Math.Sin(3 + Math.PI / 2))); 103 104 var localVarRanges = new Dictionary<string, Interval>(); 105 localVarRanges.Add("x1", new Interval(-1, 1)); 106 localVarRanges.Add("x2", new Interval(-(Math.PI / 2), 0)); 107 localVarRanges.Add("x3", new Interval(0, Math.PI / 2)); 108 localVarRanges.Add("x4", new Interval(-Math.PI, Math.PI)); 109 localVarRanges.Add("x5", new Interval(Math.PI / 4, Math.PI * 3.0 / 4)); 110 111 EvaluateTest("cos(x1)", new Interval(Math.Cos(-1), 1), localVarRanges); 112 EvaluateTest("cos(x2)", new Interval(0, 1), localVarRanges); 113 EvaluateTest("cos(x3)", new Interval(0, 1), localVarRanges); 114 EvaluateTest("cos(x4)", new Interval(-1, 1), localVarRanges); 115 EvaluateTest("cos(x5)", new Interval(Math.Cos(Math.PI *3.0/ 4), Math.Cos(Math.PI/ 4)), localVarRanges); 116 90 117 } 91 118
Note: See TracChangeset
for help on using the changeset viewer.