atan.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ACADO Toolkit.
3  *
4  * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
5  * Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
6  * Milan Vukov, Rien Quirynen, KU Leuven.
7  * Developed within the Optimization in Engineering Center (OPTEC)
8  * under supervision of Moritz Diehl. All rights reserved.
9  *
10  * ACADO Toolkit is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 3 of the License, or (at your option) any later version.
14  *
15  * ACADO Toolkit is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with ACADO Toolkit; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
26 
27 
37 
38 
39 double dAtan(double x){
40  return 1/(1+x*x);
41 }
42 
43 
44 double ddAtan(double x){
45  double v1 = 1+x*x;
46  return -2*x/v1/v1;
47 }
48 
50 
51 
53  cName = "atan";
54 
55  fcn = &atan;
56  dfcn = &dAtan;
57  ddfcn = &ddAtan;
58 
60 
61 }
62 
63 Atan::Atan( Operator *_argument ):UnaryOperator(_argument){
64  cName = "atan";
65 
66  fcn = &atan;
67  dfcn = &dAtan;
68  ddfcn = &ddAtan;
69 
71 }
72 
73 
74 Atan::Atan( const Atan &arg ):UnaryOperator(arg){
75  cName = "atan";
76 
77  fcn = &atan;
78  dfcn = &dAtan;
79  ddfcn = &ddAtan;
80 
82 }
83 
84 
86 
87 }
88 
89 
90 Atan& Atan::operator=( const Atan &arg ){
91 
93 
94  return *this;
95 }
96 
97 
99 
100  x->Atan(*argument);
101  return SUCCESSFUL_RETURN;
102 }
103 
104 
105 Operator* Atan::substitute( int index, const Operator *sub ){
106 
107  return new Atan( argument->substitute( index , sub ) );
108 
109 }
110 
112 
113  return new Atan(*this);
114 }
115 
117 
118  if( initialized ) return SUCCESSFUL_RETURN;
120 
122  new Quotient(
123  new DoubleConstant( 1.0 , NE_ONE ),
124  new Addition(
125  new DoubleConstant( 1.0 , NE_ONE ),
126  new Power_Int(
127  argument->clone(),
128  2
129  )
130  )
131  ));
134  new Product(
135  new Power(
136  new Addition(
137  new DoubleConstant(1.0 , NE_ONE),
138  new Power_Int(
139  argument->clone(),
140  2
141  )
142  ),
144  ),
145  argument->clone()
146  )
147  ));
148 
149  return argument->initDerivative();
150 }
151 
152 
154 
155 // end of file.
Operator * derivative2
IntermediateState atan(const Expression &arg)
Atan()
Definition: atan.cpp:52
virtual void Atan(Operator &arg)=0
Abstract base class for all scalar-valued symbolic operators.
Definition: operator.hpp:60
virtual Operator * clone() const
Definition: atan.cpp:111
double(* ddfcn)(double)
Operator * derivative
Abstract base class for all scalar-valued unary operators within the symbolic operators family...
Allows to pass back messages to the calling function.
double dAtan(double x)
Definition: atan.cpp:39
Implements the scalar power operator within the symbolic operators family.
Definition: power.hpp:56
virtual Operator * clone() const =0
virtual returnValue evaluate(EvaluationBase *x)
Definition: atan.cpp:98
virtual Operator * substitute(int index, const Operator *sub)=0
Atan & operator=(const Atan &arg)
Definition: atan.cpp:90
#define CLOSE_NAMESPACE_ACADO
Implements the scalar inverse tangens operator (arctan) within the symbolic operators family...
Definition: atan.hpp:55
Operator * argument
BooleanType initialized
Definition: operator.hpp:642
double(* dfcn)(double)
UnaryOperator & operator=(const UnaryOperator &arg)
double ddAtan(double x)
Definition: atan.cpp:44
Implements the scalar power operator with integer exponent within the symbolic operators family...
Definition: powerint.hpp:55
virtual returnValue initDerivative()
Definition: operator.cpp:519
Implements the scalar addition operator within the symbolic expressions family.
Definition: addition.hpp:54
#define BT_TRUE
Definition: acado_types.hpp:47
Implements the scalar quotient operator within the symbolic operators family.
Definition: quotient.hpp:55
std::string cName
OperatorName operatorName
virtual TreeProjection * convert2TreeProjection(Operator *a) const
Definition: operator.cpp:312
#define BEGIN_NAMESPACE_ACADO
Abstract base class for templated evaluation of operators.
virtual returnValue initDerivative()
Definition: atan.cpp:116
double(* fcn)(double)
virtual Operator * substitute(int index, const Operator *sub)
Definition: atan.cpp:105
~Atan()
Definition: atan.cpp:85
Implements a scalar constant within the symbolic operators family.
Implements the scalar product operator within the symbolic operators family.
Definition: product.hpp:55


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:28