Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/08/19 00:03:06 (5 years ago)
Author:
mkommend
Message:

#2948: Merged 16358, 16494, 16543, 16737 into stable.

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Tests

  • stable/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/DeriveTest.cs

    r17097 r17102  
    6060      Assert.AreEqual("(1 / (SQR(COS((3*'x'))) * 0.333333333333333))", Derive("tan(3*x)", "x")); // diff(tan(f(x)), x) = 1.0 / cos²(f(x)), simplifier puts constant factor into the denominator
    6161
     62      Assert.AreEqual("((9*'x') / ABS((3*'x')))", Derive("abs(3*x)", "x"));
     63      Assert.AreEqual("(SQR('x') * 3)", Derive("cube(x)", "x"));
     64      Assert.AreEqual("(1 / (SQR(CUBEROOT('x')) * 3))", Derive("cuberoot(x)", "x"));
     65
     66      Assert.AreEqual("0", Derive("(a+b)/(x+SQR(x))", "y")); // df(a,b,x) / dy = 0
     67
     68
     69      Assert.AreEqual("('a' * 'b' * 'c')", Derive("a*b*c*d", "d"));
     70      Assert.AreEqual("('a' / ('b' * 'c' * SQR('d') * (-1)))", Derive("a/b/c/d", "d"));
     71
    6272      {
    6373        // special case: Inv(x) using only one argument to the division symbol
     
    113123        var t = new SymbolicExpressionTree(root);
    114124
    115         Assert.AreEqual("(('y' * 'z' * 60) / SQR(('y' * 'z' * 20)))", // actually 3 / (4y  5z) but simplifier is not smart enough to cancel numerator and denominator
    116                                                                       // 60 y z / y² z² 20² == 6 / y z 40 == 3 / y z 20
     125        Assert.AreEqual("(('y' * 'z' * 60) / (SQR('y') * SQR('z') * 400))", // actually 3 / (4y  5z) but simplifier is not smart enough to cancel numerator and denominator
     126                                                                            // 60 y z / y² z² 20² == 6 / y z 40 == 3 / y z 20
    117127          formatter.Format(DerivativeCalculator.Derive(t, "x")));
    118         Assert.AreEqual("(('x' * 'z' * (-60)) / SQR(('y' * 'z' * 20)))", // actually 3x * -(4 5 z) / (4y 5z)² = -3x / (20 y² z)
    119                                                                          // -3 4 5 x z / 4² y² 5² z² = -60 x z / 20² z² y² ==    -60 x z / y² z² 20²
     128        Assert.AreEqual("(('x' * 'z' * (-60)) / (SQR('y') * SQR('z') * 400))", // actually 3x * -(4 5 z) / (4y 5z)² = -3x / (20 y² z)
     129                                                                               // -3 4 5 x z / 4² y² 5² z² = -60 x z / 20² z² y² ==    -60 x z / y² z² 20²
    120130          formatter.Format(DerivativeCalculator.Derive(t, "y")));
    121         Assert.AreEqual("(('x' * 'y' * (-60)) / SQR(('y' * 'z' * 20)))",
     131        Assert.AreEqual("(('x' * 'y' * (-60)) / (SQR('y') * SQR('z') * 400))",
    122132          formatter.Format(DerivativeCalculator.Derive(t, "z")));
    123133      }
Note: See TracChangeset for help on using the changeset viewer.