public override AlgebraExpression Substitute(SymbolExpression variable, AlgebraExpression replacement) { return(this .WithExpression(this.Expression.Substitute(variable, replacement)) .WithTo(this.To.Substitute(variable, replacement)) ); }
public IntegralExpression(AlgebraExpression expression, SymbolExpression respectTo, AlgebraExpression from, AlgebraExpression to) { if (expression == null) { throw new ArgumentNullException(nameof(expression)); } if (respectTo == null) { throw new ArgumentNullException(nameof(respectTo)); } if (from != null && to == null) { throw new ArgumentNullException(nameof(to)); } if (from == null && to != null) { throw new ArgumentNullException(nameof(from)); } this.Expression = expression; this.RespectTo = respectTo; this.From = from; this.To = to; }
public override AlgebraExpression Substitute(SymbolExpression variable, AlgebraExpression replacement) { return(this .WithBase(this.Base.Substitute(variable, replacement)) .WithExponent(this.Exponent.Substitute(variable, replacement)) ); }
public static SumExpressionList Polynomial(SymbolExpression variable, IReadOnlyList <AlgebraExpression> coefficients) { return(Sum( coefficients .Select((c, i) => Multiply(c, Exponentiate(variable, coefficients.Count - i))) .ToImmutableList() )); }
public override AlgebraExpression Substitute(SymbolExpression variable, AlgebraExpression replacement) { return(this.WithTerms( this.Terms .Select(t => t == variable ? replacement : variable) .Select(t => t.Substitute(variable, replacement)) .ToImmutableList() )); }
public DifferentiationExpression(AlgebraExpression expression, SymbolExpression respectTo) { if (expression == null) { throw new ArgumentNullException(nameof(expression)); } if (respectTo == null) { throw new ArgumentNullException(nameof(respectTo)); } this.Expression = expression; this.RespectTo = respectTo; }
public LimitExpression(AlgebraExpression expression, SymbolExpression respectTo, AlgebraExpression to) { if (expression == null) { throw new ArgumentNullException(nameof(expression)); } if (respectTo == null) { throw new ArgumentNullException(nameof(respectTo)); } if (to == null) { throw new ArgumentNullException(nameof(to)); } this.Expression = expression; this.RespectTo = respectTo; this.To = to; }
public override AlgebraExpression Substitute(SymbolExpression variable, AlgebraExpression replacement) { return(this); }
public DifferentiationExpression WithRespectTo(SymbolExpression newVariable) { return(Differentiate(this.Expression, newVariable)); }
public static DifferentiationExpression Differentiate(AlgebraExpression expression, SymbolExpression respectTo) { return(new DifferentiationExpression(expression, respectTo)); }
public static AlgebraExpression TotalDerivative(this AlgebraExpression function, IReadOnlyCollection <SymbolExpression> parameters, SymbolExpression respectTo) { if (!parameters.Contains(respectTo)) { throw new ArgumentException($"Parameter '{nameof(respectTo)}' must be one of the variables provided in parameter '{nameof(parameters)}'.", nameof(respectTo)); } return(Sum( parameters .Select(p => function.PartialDerivative(p) * p.Differentiate(respectTo)) .ToImmutableList() )); }
public IntegralExpression(AlgebraExpression expression, SymbolExpression respectTo) : this(expression, respectTo, null, null) { }
/// <summary> /// Replaces every occurrences of <paramref name="subject"/> to <paramref name="replacement"/>. /// </summary> /// <param name="variable"></param> /// <param name="replacement"></param> /// <returns></returns> public abstract AlgebraExpression Substitute(SymbolExpression variable, AlgebraExpression replacement);
public static SumExpressionList Polynomial(SymbolExpression variable, params AlgebraExpression[] coefficients) { return(Polynomial(variable, coefficients as IReadOnlyList <AlgebraExpression>)); }
public LimitExpression WithRespectTo(SymbolExpression newVariable) { return(Limit(this.Expression, newVariable, this.To)); }
public static IntegralExpression Integrate(this AlgebraExpression expression, SymbolExpression respectTo, AlgebraExpression from, AlgebraExpression to) { return(ExpressionFactory.Integrate(expression, respectTo, from, to)); }
public static LimitExpression Limit(AlgebraExpression expression, SymbolExpression respectTo, AlgebraExpression to) { return(new LimitExpression(expression, respectTo, to)); }
public IntegralExpression WithRespectTo(SymbolExpression newVariable) { return(Integrate(this.Expression, newVariable, this.From, this.To)); }
public static bool IsConstant(this AlgebraExpression expression, SymbolExpression respectTo) { return(!expression.DependsUpon(respectTo)); }
public static DifferentiationExpression Differentiate(this AlgebraExpression expression, SymbolExpression respectTo) { return(ExpressionFactory.Differentiate(expression, respectTo)); }
public static bool DependsUpon(this AlgebraExpression expression, SymbolExpression respectTo) { return(expression.DescendantsAndSelf().Contains(respectTo)); }
public static DifferentiationExpression PartialDerivative(this AlgebraExpression expression, SymbolExpression respectTo) { return(Differentiate(expression, respectTo)); }
public override AlgebraExpression Substitute(SymbolExpression variable, AlgebraExpression replacement) { return(this.WithArguments(this.Arguments.Select(a => a.Substitute(variable, replacement)).ToImmutableList())); }
public static IntegralExpression Integrate(AlgebraExpression expression, SymbolExpression respectTo, AlgebraExpression from, AlgebraExpression to) { return(new IntegralExpression(expression, respectTo, from, to)); }