Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6f3190c
Documentation for Add
dcarbonell08 Dec 9, 2025
d8bf48c
Documentation for Bounded Expressions
dcarbonell08 Dec 9, 2025
2f2cf72
Merge pull request #1 from dcarbonell08/documentations
dcarbonell08 Dec 9, 2025
8751494
Extra example for Add, minor clarification on Bounded Expression clas…
dcarbonell08 Dec 10, 2025
9c94e45
Merge pull request #2 from dcarbonell08/documentations
dcarbonell08 Dec 10, 2025
719edef
EulerNumber Documentation
dcarbonell08 Dec 10, 2025
2fdb2cb
Fix formatting error on Doxygen documentation
dcarbonell08 Dec 10, 2025
d210a5b
Derivative documentation. Minor EulerNumber documentation fix.
dcarbonell08 Dec 10, 2025
0c41855
Subtract documentation and bug discovery in Subtract method.
dcarbonell08 Dec 10, 2025
59e3798
Minor documentation on Variable
dcarbonell08 Dec 11, 2025
ffc2753
Documentation for end users and how to convert strings into Oasis obj…
dcarbonell08 Dec 11, 2025
008cbe3
Additional example for addition
dcarbonell08 Dec 12, 2025
3e644c8
Documentation with examples for Multiply and Divide
dcarbonell08 Dec 12, 2025
81744a2
Minor formatting fixes
dcarbonell08 Dec 12, 2025
38d9582
Merge pull request #3 from dcarbonell08/documentations
dcarbonell08 Dec 12, 2025
3b8a35c
clang-format fixes for GitHub pipelines. Pipeline failure due to trai…
dcarbonell08 Dec 12, 2025
28d65e5
Integral and Exponent Documentation with Examples
dcarbonell08 Dec 12, 2025
3b4a16a
Some further fixes to clang-errors
dcarbonell08 Dec 12, 2025
a737de5
Further fix to clang-format
dcarbonell08 Dec 12, 2025
6047a13
Minor fix for clang-format
dcarbonell08 Dec 12, 2025
522bfda
Merge pull request #4 from dcarbonell08/documentations
dcarbonell08 Dec 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions include/Oasis/Add.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,113 @@ class Add<

/**
* The Add expression adds two expressions together.
* The Add expression takes in two parameters of any Oasis type.
* The Add expression may take in more than two parameters of Real types.
*
*
* @section Parameters
* @tparam AugendT The type of the expression to add be added to.
* @tparam AddendT The type of the expression to add to the augend.
*
* @section Example Usage:
* The Add expression can take in a multitude of Oasis classes.
*
* @subsection val_val Adding two Real values together:
* @code
* Oasis::Add myAdditionSimple {
* Oasis::Real{4},
* Oasis::Real{4},
* };
* Oasis::InFixSerializer result;
*
* auto resultant = myAdditionSimple.Simplify();
*
* std::println("Result of addition: {}", resultant->Accept(result).value());
* // Will print 8
* @endcode
*
* @subsection val_var Adding a Real value and a Variable together:
* @code
* Oasis::Add myAddition {
Oasis::Variable{"x"},
Oasis::Real{4}
};
//Oasis::InFixSerializer result;

resultant = myAddition.Simplify();

std::println("Result of addition: {}", resultant->Accept(result).value());
// Will print x+4
* @endcode
*
* @subsection var_var Adding two Variables together:
* @code
* Oasis::Add myAdditionX {
Oasis::Variable{"x"},
Oasis::Variable{"x"}
};

resultant = myAdditionX.Simplify();

std::println("Result of addition: {}", resultant->Accept(result).value());
// Will print 2*x
* @endcode
*
* @subsection var_var_n if they are not the same variable:
* @code
* Oasis::Add myAdditionXY {
Oasis::Variable{"x"},
Oasis::Variable{"y"}
};

resultant = myAdditionXY.SimplifyVisitor();

std::println("Result of addition: {}", resultant->Accept(result).value());
// Will print x+y
* @endcode
*
* @subsubsection multi Adding more than two values together:
*
* @code
* auto myAdditionSimple = Oasis::Add<> {
Oasis::Real{4},
Oasis::Real{4},
Oasis::Real{4}
};
Oasis::InFixSerializer result;

auto resultant = myAdditionSimple.Simplify();

std::println("Result of addition: {}", resultant->Accept(result).value());
* @endcode
*
* @subsection exprAdd Adding two expressions together:
*
* @code
* std::string expr1 = {"2x+3y+15"};
std::string expr2 = {"5x+9y-10"};

const auto prepoc1 = Oasis::PreProcessInFix(expr1);
const auto prepoc2 = Oasis::PreProcessInFix(expr2);

auto midResult1 = Oasis::FromInFix(prepoc1);
auto midResult2 = Oasis::FromInFix(prepoc2);

const std::unique_ptr<Oasis::Expression> expression1 = std::move(midResult1).value();
const std::unique_ptr<Oasis::Expression> expression2 = std::move(midResult2).value();

Oasis::Add exprAdd {
*expression1,
*expression2
};
Oasis::InFixSerializer result;

auto resultant = exprAdd.Simplify();

std::println("Result: {}", resultant->Accept(result).value());
// Will print (((7*x)+(12*y))+5)
* @endcode
*
*/
template <IExpression AugendT = Expression, IExpression AddendT = AugendT>
class Add : public BinaryExpression<Add, AugendT, AddendT> {
Expand Down
3 changes: 3 additions & 0 deletions include/Oasis/BinaryExpression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
namespace Oasis {
/**
* A concept for an operand of a binary expression.
* @note This class is not intended to be used directly by end users.
*
* @section Parameters
* @tparam MostSigOpT The type of the most significant operand.
* @tparam LeastSigOpT The type of the least significant operand.
* @tparam T The type to check.
Expand Down
10 changes: 10 additions & 0 deletions include/Oasis/BoundedBinaryExpression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
#include "Visit.hpp"

namespace Oasis {
/**
* A concept for an operand of a binary expression with bounds.
* @note This class is not intended to be used directly by end users.
*
* @section Parameters
* @tparam MostSigOpT The type of the most significant operand.
* @tparam LeastSigOpT The type of the least significant operand.
* @tparam LowerBoundT The lower bound of the binary expression.
* @tparam UpperBoundT The upper bound of the binary expression.
*/
template <template <IExpression, IExpression, IExpression, IExpression> class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
class BoundedBinaryExpression : public BoundedExpression<LowerBoundT, UpperBoundT> {

Expand Down
8 changes: 8 additions & 0 deletions include/Oasis/BoundedExpression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@

namespace Oasis {

/**
* A concept base class for both Unary and BoundedBinary expressions.
* @note This class is not intended to be used directly by end users.
*
* @section Parameters
* @tparam LowerBoundT The lower bound of the expression.
* @tparam UpperBoundT The upper bound of the expression.
*/
template <IExpression LowerBoundT = Expression, IExpression UpperBoundT = Expression>
class BoundedExpression : public Expression {
public:
Expand Down
9 changes: 9 additions & 0 deletions include/Oasis/BoundedUnaryExpression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@

namespace Oasis {

/**
* A concept for an operand of a unary expression with bounds.
* @note This class is not intended to be used directly by end users.
*
* @section Parameters
* @tparam MostSigOpT The type of the most significant operand.
* @tparam LeastSigOpT The type of the least significant operand.
* @tparam T The type to check.
*/
template <template <IExpression, IExpression, IExpression> class DerivedT, IExpression OperandT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
class BoundedUnaryExpression : public BoundedExpression<LowerBoundT, UpperBoundT> {

Expand Down
1 change: 1 addition & 0 deletions include/Oasis/Concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum class ExpressionType;

/**
* An expression concept.
* @note This class is not intended to be used directly by end users.
*
* An expression concept is a type that satisfies the following requirements:
* - It is derived from `Expression`.
Expand Down
27 changes: 27 additions & 0 deletions include/Oasis/Derivative.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,36 @@ class Derivative<Expression, Expression> : public BinaryExpression<Derivative> {

/**
* The Derivative class template calculates the derivative of given expressions.
* The Derivative class template can take two and only two parameters.
*
* @section Parameters:
* @tparam DependentT The expression type that the derivative will be calculated of.
* @tparam IndependentT The type of the variable with respect to which the derivative will be calculated.
*
* @section Example Usage:
*
*
* @subsection simple Simple derivative function
* @code
* std::string exp = {"3x^3+x^2+5x+1"};

const auto preproc = Oasis::PreProcessInFix(exp);
auto midResult = Oasis::FromInFix(preproc);

const std::unique_ptr<Oasis::Expression> expression = std::move(midResult).value();

Oasis::Derivative dv {
*expression,
Oasis::Variable{"x"}
};
Oasis::InFixSerializer result;

auto resultant = dv.Simplify();

std::println("Result: {}", resultant->Accept(result).value());
// Will print: (((9*(x^2))+(2*x))+5)
* @endcode
*
*/
template <IExpression DependentT = Expression, IExpression IndependentT = DependentT>
class Derivative : public BinaryExpression<Derivative, DependentT, IndependentT> {
Expand Down
78 changes: 78 additions & 0 deletions include/Oasis/Divide.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,87 @@ class Divide<Expression, Expression> : public BinaryExpression<Divide> {

/**
* The Divide expression divides two expressions.
* The Divide expression takes two and only two expressions.
*
* @section param Parameters:
* @tparam DividendT The expression to be divided into.
* @tparam DivisorT The expression to divide the dividend by.
*
* @note If a 0 is passed into the DivisorT parameter, Oasis will evaluate it as DividendT*inf.
*
* @section examples Example Usage:
*
* @subsection real Dividing two Real values together:
*
* @code
* Oasis::Divide myDiv {
Oasis::Real{50},
Oasis::Real{12}
};
Oasis::InFixSerializer result;

auto resultant = myDiv.Simplify();

std::println("Result: {}", resultant->Accept(result).value());
// Will print: 4.1667
* @endcode
*
* @subsection var Dividing a Variable and Real value together:
* Oasis will convert the expression into a multiplication equivalent instead. See below
* @code
* Oasis::Divide myDiv {
Oasis::Variable{"x"},
Oasis::Real{12}
};
Oasis::InFixSerializer result;

auto resultant = myDiv.Simplify();

std::println("Result: {}", resultant->Accept(result).value());
// Will print: (x*0.083333)
* @endcode
*
* @subsection var_var Dividing a Variable and a Variable value together:
* @code
* Oasis::Divide myDiv {
Oasis::Variable{"x"},
Oasis::Variable{"y"}
};
Oasis::InFixSerializer result;

auto resultant = myDiv.Simplify();

std::println("Result: {}", resultant->Accept(result).value());
// Will print: (x/y)
* @endcode
*
* @subsection expressions Dividing two expressions together:
* Oasis will accept two expressions, but it will not display as its simplest form. See below for example.
* @code
* std::string expr1 = {"2x+3y+15"};
std::string expr2 = {"5x+9y-10"};

const auto prepoc1 = Oasis::PreProcessInFix(expr1);
const auto prepoc2 = Oasis::PreProcessInFix(expr2);

auto midResult1 = Oasis::FromInFix(prepoc1);
auto midResult2 = Oasis::FromInFix(prepoc2);

const std::unique_ptr<Oasis::Expression> expression1 = std::move(midResult1).value();
const std::unique_ptr<Oasis::Expression> expression2 = std::move(midResult2).value();

Oasis::Divide myDiv {
*expression1,
*expression2
};
Oasis::InFixSerializer result;

auto resultant = myDiv.Simplify();

std::println("Result: {}", resultant->Accept(result).value());
// Will print: ((((2*x)+(3*y))+15)/(((5*x)+(9*y))+-10))
* @endcode
*
*/
template <IExpression DividendT = Expression, IExpression DivisorT = DividendT>
class Divide : public BinaryExpression<Divide, DividendT, DivisorT> {
Expand Down
53 changes: 52 additions & 1 deletion include/Oasis/EulerNumber.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,58 @@
namespace Oasis {

/**
* An 'EulerNumber' number.
* The EulerNumber class is a representation of the Euler Number.
* It may be used when the Euler number is desired in computations.
*
* @section Parameters
* No parameters are needed for the EulerNumber class.
*
* @section Examples
*
* @subsection simple Simple usage:
* @code
* auto e = Oasis::EulerNumber{};

Oasis::InFixSerializer result;

auto resultant = e.Simplify();

std::println("Result: {}", resultant->Accept(result).value());
// Will print: e
* @endcode
*
* @subsection comp Usage in other components:
* @code
* Oasis::InFixSerializer result;

Oasis::Add myAddition {
Oasis::EulerNumber{},
Oasis::Variable{"x"}
};

auto resultant = myAddition.Simplify();
std::println("Result: {}", resultant->Accept(result).value());
// Will print: (e+x)
* @endcode
*
* Another example shows its usage inside of the Exponent class before being passed into the Integral class.
* @code
* Oasis::InFixSerializer result;

Oasis::Exponent eul {
Oasis::EulerNumber{},
Oasis::Variable{"x"}
};

Oasis::Integral in {
eul,
Oasis::Variable{"x"}
};

auto resultant = in.Simplify();
std::println("Result: {}", resultant->Accept(result).value());
// Will print: in((e^x),x)
* @endcode
*/
class EulerNumber : public LeafExpression<EulerNumber> {
public:
Expand Down
Loading
Loading