mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-20 14:20:39 +01:00
[apps/graph] Change name: function->cartesian_function
Change-Id: I138bd13fec8514144cfde7164ec9aff081454609
This commit is contained in:
31
apps/graph/cartesian_function.cpp
Normal file
31
apps/graph/cartesian_function.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#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 = Poincare::Derivative();
|
||||
derivative.setArgument(args, 2, true);
|
||||
return derivative.approximate(*context);
|
||||
}
|
||||
|
||||
char CartesianFunction::symbol() const {
|
||||
return 'x';
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user