openGPMP
Open Source Mathematics Package
|
Calculus Class with methods pertaining to basic operations. More...
#include <differential.hpp>
Public Member Functions | |
Differential | operator+ (const Differential &other) const |
Overloaded addition operator for Differential objects. More... | |
Differential | operator* (const Differential &other) const |
Overloaded multiplication operator for Differential objects. More... | |
void | add_term (double coefficient, int exponent) |
Adds a term to the Differential object. More... | |
void | display () const |
Displays the polynomial in a readable format. More... | |
Differential | power_rule () const |
Computes the derivative using the power rule. More... | |
Differential | product_rule (const Differential &other) const |
Computes the derivative using the product rule. More... | |
Differential | quotient_rule (const Differential &other) const |
Computes the derivative using the quotient rule. More... | |
Differential | chain_rule (const Differential &inner) const |
Computes the derivative using the chain rule. More... | |
Differential | nth_derivative (int n) const |
Computes the nth derivative of the current Differential object. More... | |
double | eval (double x) const |
Evaluates the polynomial for a given value of x. More... | |
double | limit_at (double x) const |
Calculate the limit of the polynomial at a specific point. More... | |
double | limit_at_infinity () const |
Calculate the limit of the polynomial as x approaches infinity. More... | |
Public Attributes | |
std::vector< Term > | terms |
Calculus Class with methods pertaining to basic operations.
Definition at line 67 of file differential.hpp.
void gpmp::Differential::add_term | ( | double | coefficient, |
int | exponent | ||
) |
Adds a term to the Differential object.
coefficient | The coefficient of the term to add |
exponent | The exponent of the term to add |
Definition at line 45 of file differential.cpp.
References terms.
Referenced by chain_rule(), main(), and power_rule().
gpmp::Differential gpmp::Differential::chain_rule | ( | const Differential & | inner | ) | const |
Computes the derivative using the chain rule.
inner | The inner function for the chain rule |
Definition at line 80 of file differential.cpp.
References add_term(), power_rule(), and terms.
Referenced by main().
void gpmp::Differential::display | ( | ) | const |
Displays the polynomial in a readable format.
Definition at line 49 of file differential.cpp.
Referenced by main().
double gpmp::Differential::eval | ( | double | x | ) | const |
Evaluates the polynomial for a given value of x.
x | The value at which to evaluate the polynomial |
Definition at line 112 of file differential.cpp.
Referenced by main().
double gpmp::Differential::limit_at | ( | double | x | ) | const |
Calculate the limit of the polynomial at a specific point.
This method calculates the limit of the polynomial at a specific point by evaluating the polynomial at that point The limit is undefined if the polynomial has a term with a positive exponent at the highest degree
x | The point at which to calculate the limit |
Definition at line 120 of file differential.cpp.
Referenced by main().
double gpmp::Differential::limit_at_infinity | ( | ) | const |
Calculate the limit of the polynomial as x approaches infinity.
This method calculates the limit of the polynomial as x approaches infinity by examining the term with the highest exponent The limit is infinity or negative infinity if the highest exponent is greater than zero Otherwise, the limit is the constant term
Definition at line 130 of file differential.cpp.
Referenced by main().
gpmp::Differential gpmp::Differential::nth_derivative | ( | int | n | ) | const |
Computes the nth derivative of the current Differential object.
n | The order of the derivative to compute |
Definition at line 104 of file differential.cpp.
References power_rule().
Differential gpmp::Differential::operator* | ( | const Differential & | other | ) | const |
Overloaded multiplication operator for Differential objects.
other | The Differential object to multiply |
Differential gpmp::Differential::operator+ | ( | const Differential & | other | ) | const |
Overloaded addition operator for Differential objects.
other | The Differential object to add |
gpmp::Differential gpmp::Differential::power_rule | ( | ) | const |
Computes the derivative using the power rule.
Definition at line 67 of file differential.cpp.
References add_term().
Referenced by chain_rule(), main(), and nth_derivative().
Differential gpmp::Differential::product_rule | ( | const Differential & | other | ) | const |
Computes the derivative using the product rule.
other | The other Differential object in the product |
Differential gpmp::Differential::quotient_rule | ( | const Differential & | other | ) | const |
Computes the derivative using the quotient rule.
other | The other Differential object in the quotient |
std::vector<Term> gpmp::Differential::terms |
Vector of terms representing the polynomial
Definition at line 69 of file differential.hpp.
Referenced by add_term(), and chain_rule().