Blame view

Giac_maj/epsilon-giac/apps/graph/cartesian_function.cpp 791 Bytes
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
  }
  
  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';
  }
  
  }