public void ReplaceFunctionDerivative() { var x = new Symbol("x"); var f = new SymbolFunction("f", x); Assert.IsTrue(_.Same(1 + 2 * x, (1 + f.D()._(x)).Replace( new Rule(f._(~x), _.Pow(x, 2))))); Assert.IsTrue(_.Same(4 * x, (f.D()._(2 * x)).Replace( new Rule(f._(~x), _.Pow(x, 2))))); }
public override Expression On(SymbolFunction e) { return(e.Arguments .Select((arg, i) => e.D(i) * _.D(arg, x)) .Aggregate((a, b) => a + b)); }