Numworks Epsilon  1.4.1
Graphing Calculator Operating System
hyperbolic_sine.cpp
Go to the documentation of this file.
2 #include <poincare/complex.h>
3 #include <poincare/subtraction.h>
4 #include <poincare/power.h>
5 #include <poincare/division.h>
6 #include <poincare/opposite.h>
8 extern "C" {
9 #include <assert.h>
10 }
11 #include <cmath>
12 
13 namespace Poincare {
14 
16  return Type::HyperbolicSine;
17 }
18 
20  HyperbolicSine * a = new HyperbolicSine(m_operands, true);
21  return a;
22 }
23 
24 Expression * HyperbolicSine::shallowReduce(Context& context, AngleUnit angleUnit) {
25  Expression * e = Expression::shallowReduce(context, angleUnit);
26  if (e != this) {
27  return e;
28  }
29 #if MATRIX_EXACT_REDUCING
30  Expression * op = editableOperand(0);
31  if (op->type() == Type::Matrix) {
32  return SimplificationEngine::map(this, context, angleUnit);
33  }
34 #endif
35  return this;
36 }
37 
38 template<typename T>
40  if (c.b() == 0) {
41  return Complex<T>::Float(std::sinh(c.a()));
42  }
44  Complex<T> exp1 = Power::compute(e, c);
45  Complex<T> exp2 = Power::compute(e, Complex<T>::Cartesian(-c.a(), -c.b()));
46  Complex<T> sub = Subtraction::compute(exp1, exp2);
47  return Division::compute(sub, Complex<T>::Float(2));
48 }
49 
50 }
friend class HyperbolicSine
Definition: expression.h:50
c(generic_all_nodes)
Expression * editableOperand(int i)
Definition: expression.h:176
#define M_E
Definition: math.h:12
static Complex< T > compute(const Complex< T > c, const Complex< T > d)
Definition: division.cpp:52
static Complex< T > computeOnComplex(const Complex< T > c, AngleUnit angleUnit)
Type type() const override
const Expression * m_operands[T]
#define sinh(x)
Definition: math.h:195
static Complex< T > compute(const Complex< T > c, const Complex< T > d)
Definition: subtraction.cpp:46
static Complex< T > Float(T x)
Definition: complex.cpp:23
static Complex< T > compute(const Complex< T > c, const Complex< T > d)
Definition: power.cpp:84
Expression * clone() const override