mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 08:47:28 +01:00
32 lines
791 B
C++
32 lines
791 B
C++
#include "cartesian_function.h"
|
|
|
|
namespace Graph {
|
|
|
|
CartesianFunction::CartesianFunction(const char * text, KDColor color) :
|
|
Shared::Function(text, color),
|
|
m_displayDerivative(false)
|
|
{
|
|
}
|
|
|
|
bool CartesianFunction::displayDerivative() {
|
|
return m_displayDerivative;
|
|
}
|
|
|
|
void CartesianFunction::setDisplayDerivative(bool display) {
|
|
m_displayDerivative = display;
|
|
}
|
|
|
|
double CartesianFunction::approximateDerivative(double x, Poincare::Context * context) const {
|
|
Poincare::Complex<double> abscissa = Poincare::Complex<double>::Float(x);
|
|
Poincare::Expression * args[2] = {expression(), &abscissa};
|
|
Poincare::Derivative derivative;
|
|
derivative.setArgument(args, 2, true);
|
|
return derivative.approximate<double>(*context);
|
|
}
|
|
|
|
char CartesianFunction::symbol() const {
|
|
return 'x';
|
|
}
|
|
|
|
}
|