OASIS
Open Algebra Software
Loading...
Searching...
No Matches
Subtract.hpp
Go to the documentation of this file.
1//
2// Created by Matthew McCall on 8/10/23.
3//
4
5#ifndef OASIS_SUBTRACT_HPP
6#define OASIS_SUBTRACT_HPP
7
9#include "Real.hpp"
10
11namespace Oasis {
12
13template <IExpression MinuendT, IExpression SubtrahendT>
14class Subtract;
15
17template <>
18class Subtract<Expression, Expression> : public BinaryExpression<Subtract> {
19public:
20 Subtract() = default;
21 Subtract(const Subtract<Expression, Expression>& other) = default;
22
23 Subtract(const Expression& minuend, const Expression& subtrahend);
24
25 [[nodiscard]] auto Simplify() const -> std::unique_ptr<Expression> final;
26
27 [[nodiscard]] auto Differentiate(const Expression& differentiationVariable) const -> std::unique_ptr<Expression> final;
28
29 [[nodiscard]] auto Integrate(const Expression& integrationVariable) const -> std::unique_ptr<Expression> final;
30
33};
35
42template <IExpression MinuendT = Expression, IExpression SubtrahendT = MinuendT>
43class Subtract : public BinaryExpression<Subtract, MinuendT, SubtrahendT> {
44public:
45 Subtract() = default;
47 : BinaryExpression<Subtract, MinuendT, SubtrahendT>(other)
48 {
49 }
50
51 Subtract(const MinuendT& addend1, const SubtrahendT& addend2)
52 : BinaryExpression<Subtract, MinuendT, SubtrahendT>(addend1, addend2)
53 {
54 }
55
56 auto operator=(const Subtract& other) -> Subtract& = default;
57
60};
61
62} // Oasis
63
64#endif // OASIS_SUBTRACT_HPP
#define EXPRESSION_CATEGORY(category)
Definition Expression.hpp:192
#define EXPRESSION_TYPE(type)
Definition Expression.hpp:181
A binary expression.
Definition BinaryExpression.hpp:79
auto Simplify() const -> std::unique_ptr< Expression > override
Simplifies this expression.
Definition BinaryExpression.hpp:200
auto Differentiate(const Expression &differentiationVariable) const -> std::unique_ptr< Expression > override
Tries to differentiate this function.
Definition BinaryExpression.hpp:128
auto Integrate(const Expression &integrationVariable) const -> std::unique_ptr< Expression > override
Attempts to integrate this expression using integration rules.
Definition BinaryExpression.hpp:205
The Subtract expression subtracts two expressions.
Definition Subtract.hpp:43
Subtract()=default
Subtract(const Subtract< MinuendT, SubtrahendT > &other)
Definition Subtract.hpp:46
Subtract(const MinuendT &addend1, const SubtrahendT &addend2)
Definition Subtract.hpp:51
auto operator=(const Subtract &other) -> Subtract &=default
Definition Add.hpp:11
@ BinExp
Definition Expression.hpp:45