Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/15/21 11:36:06 (3 years ago)
Author:
gkronber
Message:

#3140 fixed a problem in the DerivativeCalculator for powers with constant exponents

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/DerivativeCalculator.cs

    r18114 r18130  
    156156          var newPower = (ISymbolicExpressionTreeNode)branch.Clone();
    157157          var f = (ISymbolicExpressionTreeNode)newPower.GetSubtree(0).Clone();
    158           var newExponent = (INumericTreeNode)newPower.GetSubtree(1);
    159           newExponent.Value -= 1;
     158          var newExponent = (INumericTreeNode)numberSy.CreateTreeNode();
     159          newExponent.Value = ((INumericTreeNode)newPower.GetSubtree(1)).Value - 1;
    160160          return Product(Product(CreateNumber(exponent.Value), newPower), Derive(f, variableName));
    161161        } else throw new NotSupportedException("Cannot derive non-integer powers");
Note: See TracChangeset for help on using the changeset viewer.