Changeset 17780
 Timestamp:
 11/02/20 16:27:25 (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/DerivativeCalculator.cs
r17650 r17780 149 149 return Product(Product(CreateConstant(3.0), Square(f)), Derive(f, variableName)); 150 150 } 151 if (branch.Symbol is Power) { 152 // HL evaluators handle power strangely (exponent is rounded to an integer) 153 // here we only support the case when the exponent is a constant integer and 154 var exponent = branch.GetSubtree(1) as ConstantTreeNode; 155 if (exponent != null && Math.Truncate(exponent.Value) == exponent.Value) { 156 var newPower = (ISymbolicExpressionTreeNode)branch.Clone(); 157 var newExponent = (ConstantTreeNode)newPower.GetSubtree(1); 158 newExponent.Value = 1; 159 return Product(CreateConstant(exponent.Value), newPower); 160 } else throw new NotSupportedException("Cannot derive noninteger powers"); 161 } 151 162 if (branch.Symbol is Absolute) { 152 163 var f = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone(); … … 263 274 !(n.Symbol is Cube) && 264 275 !(n.Symbol is CubeRoot) && 276 !(n.Symbol is Power) && 265 277 !(n.Symbol is Absolute) && 266 278 !(n.Symbol is AnalyticQuotient) &&
Note: See TracChangeset
for help on using the changeset viewer.