#include <cassert>
#include <cmath>
#include <iostream>
#include <openGPMP/calculus.hpp>
#include <stdio.h>
#include <string>
#include <vector>
Go to the source code of this file.
◆ main()
- Examples
- deriv.cpp.
Definition at line 15 of file deriv.cpp.
16 std::cout <<
"DERIVATIVE EXAMPLE\n\n";
24 std::cout <<
"Original Polynomial 1: \n";
29 std::cout <<
"Derivative 1: \n";
41 std::cout <<
"Original Polynomial 2: \n";
46 std::cout <<
"Derivative 2: \n";
51 std::cout <<
"<------------>\n";
54 double result = derivative2.
eval(x_value);
55 std::cout <<
"Derivative2 at x = " << x_value <<
": " << result
64 std::cout <<
"Original Polynomial 3: \n";
68 std::cout <<
"Second derivative of Polynomial 3: \n";
73 std::cout <<
"<------------>\n";
81 std::cout <<
"Original Polynomial 4: \n";
84 double limitAtX = poly4->
limit_at(2);
85 std::cout <<
"Limit at x = 2: " << limitAtX << std::endl;
88 std::cout <<
"Limit as x approaches infinity: " << limitAtInfinity
92 std::cout <<
"Second derivative of Polynomial 4: \n";
97 std::cout <<
"<------------>\n";
111 std::cout <<
"Derivative of (4x^2 + 1)^5 is: ";
Calculus Class with methods pertaining to basic operations.
double limit_at_infinity() const
Calculate the limit of the polynomial as x approaches infinity.
Differential power_rule() const
Computes the derivative using the power rule.
double limit_at(double x) const
Calculate the limit of the polynomial at a specific point.
void add_term(double coefficient, int exponent)
Adds a term to the Differential object.
Differential chain_rule(const Differential &inner) const
Computes the derivative using the chain rule.
void display() const
Displays the polynomial in a readable format.
double eval(double x) const
Evaluates the polynomial for a given value of x.
References gpmp::Differential::add_term(), gpmp::Differential::chain_rule(), gpmp::Differential::display(), gpmp::Differential::eval(), gpmp::Differential::limit_at(), gpmp::Differential::limit_at_infinity(), and gpmp::Differential::power_rule().