Changeset 17800
- Timestamp:
- 12/22/20 12:49:01 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/DerivativeCalculator.cs
r17780 r17800 151 151 if (branch.Symbol is Power) { 152 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 and153 // here we only support the case when the exponent is a constant integer 154 154 var exponent = branch.GetSubtree(1) as ConstantTreeNode; 155 155 if (exponent != null && Math.Truncate(exponent.Value) == exponent.Value) { 156 156 var newPower = (ISymbolicExpressionTreeNode)branch.Clone(); 157 var f = (ISymbolicExpressionTreeNode)newPower.GetSubtree(0).Clone(); 157 158 var newExponent = (ConstantTreeNode)newPower.GetSubtree(1); 158 159 newExponent.Value -= 1; 159 return Product( CreateConstant(exponent.Value), newPower);160 return Product(Product(CreateConstant(exponent.Value), newPower), Derive(f, variableName)); 160 161 } else throw new NotSupportedException("Cannot derive non-integer powers"); 161 162 }
Note: See TracChangeset
for help on using the changeset viewer.