Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/07/19 14:20:33 (6 years ago)
Author:
gkronber
Message:

#2915: Corrected calculation of cuberoot function in all interpreters and updated all formatters.
I tested a run with all interpreters and got the same results with all of them.

Location:
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/DerivativeCalculator.cs

    r16737 r16905  
    143143        var f = (ISymbolicExpressionTreeNode)branch.Clone();
    144144        var u = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
    145         return Product(Div(CreateConstant(1.0), Product(CreateConstant(3.0), Square(f))), Derive(u, variableName));
     145        return Product(Div(CreateConstant(1.0), Product(CreateConstant(3.0), Square(f))), Derive(u, variableName));  // 1/3 1/cbrt(f(x))^2 d/dx f(x)
    146146      }
    147147      if (branch.Symbol is Cube) {
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs

    r16656 r16905  
    9292      );
    9393
     94    private static readonly Func<Term, UnaryFunc> cbrt = UnaryFunc.Factory(
     95      eval: x => x < 0 ? -Math.Pow(-x, 1.0 / 3) : Math.Pow(x, 1.0 / 3),
     96      diff: x => { var cbrt_x = x < 0 ? -Math.Pow(-x, 1.0 / 3) : Math.Pow(x, 1.0 / 3); return 1.0 / (3 * cbrt_x * cbrt_x); }
     97      );
     98
     99
     100
    94101    #endregion
    95102
     
    250257      }
    251258      if (node.Symbol is CubeRoot) {
    252         return AutoDiff.TermBuilder.Power(
    253           ConvertToAutoDiff(node.GetSubtree(0)), 1.0/3.0);
     259        return cbrt(ConvertToAutoDiff(node.GetSubtree(0)));
    254260      }
    255261      if (node.Symbol is Sine) {
Note: See TracChangeset for help on using the changeset viewer.