public ProductExpressionList Divide(AlgebraExpression expression) { return(expression is ProductExpressionList ? ExpressionFactory.Product(this, ExpressionFactory.Reciprocal(expression)) : ExpressionFactory.Divide(this, expression) ); }
public ProductExpressionList Multiply(AlgebraExpression expression) { return(expression is ProductExpressionList ? ExpressionFactory.Product(this.Terms.Concat((expression as ProductExpressionList).Terms).ToImmutableList()) : ExpressionFactory.Multiply(this, expression) ); }
public AlgebraExpression Simplify(DifferentiationExpression expression, CancellationToken cancellationToken) { if (expression.Expression is ProductExpressionList product) { return(Sum( product.Terms .Select(t => ExpressionFactory.Product( new[] { t.Differentiate(expression.RespectTo) } .Concat(product.Terms.Except(new[] { t })) .ToImmutableList() ) ) .ToImmutableList() )); } return(expression); }
public ProductExpressionList WithTerms(IImmutableList <AlgebraExpression> newTerms) { return(ExpressionFactory.Product(newTerms)); }