GeoModel - GeoModelCore
Tan.cpp
1 //==========================================================================//
2 // Imported from the QAT library (qat.pitt.edu) by the copyright holder //
3 // Joe Boudreau. Software licensed under the terms and conditions of the //
4 // GNU Lesser Public License v3. //
5 //==========================================================================//
6 #include "GeoGenericFunctions/Tan.h"
7 #include "GeoGenericFunctions/Cos.h"
8 #include <stdexcept>
9 #include <cmath>
10 
11 namespace GeoGenfun {
12 FUNCTION_OBJECT_IMP(Tan)
13 
14 Tan::Tan()
15 {}
16 
17 Tan::~Tan() {
18 }
19 
20 Tan::Tan(const Tan & right) : AbsFunction(right)
21 { }
22 
23 
24 double Tan::operator() (double x) const {
25  return tan(x);
26 }
27 
28 
29 
30 Derivative Tan::partial(unsigned int index) const {
31 
32  if (index!=0) throw std::range_error("Tan: partial derivative index out of range");
33 
34  const AbsFunction & fPrime = 1.0/Cos()/Cos();
35  return Derivative(& fPrime);
36 }
37 
38 } // namespace GeoGenfun
Definition: Abs.h:15