mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
32 lines
765 B
C++
32 lines
765 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;
|
|
}
|
|
|
|
float CartesianFunction::approximateDerivative(float x, Poincare::Context * context) const {
|
|
Poincare::Complex abscissa = Poincare::Complex::Float(x);
|
|
Poincare::Expression * args[2] = {m_expression, &abscissa};
|
|
Poincare::Derivative derivative;
|
|
derivative.setArgument(args, 2, true);
|
|
return derivative.approximate(*context);
|
|
}
|
|
|
|
char CartesianFunction::symbol() const {
|
|
return 'x';
|
|
}
|
|
|
|
}
|