sin.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 ddSin(double x){
40  return -sin(x);
41 }
42 
43 
45 
46 
48  cName = "sin";
49 
50  fcn = &sin;
51  dfcn = &cos;
52  ddfcn = &ddSin;
53 
55 
56 }
57 
58 Sin::Sin( Operator *_argument ):UnaryOperator(_argument){
59  cName = "sin";
60 
61  fcn = &sin;
62  dfcn = &cos;
63  ddfcn = &ddSin;
64 
66 }
67 
68 
69 Sin::Sin( const Sin &arg ):UnaryOperator(arg){
70  cName = "sin";
71 
72  fcn = &sin;
73  dfcn = &cos;
74  ddfcn = &ddSin;
75 
77 }
78 
79 
81 
82 }
83 
84 
85 Sin& Sin::operator=( const Sin &arg ){
86 
88 
89  return *this;
90 }
91 
92 
94 
95  x->Sin(*argument);
96  return SUCCESSFUL_RETURN;
97 }
98 
99 
100 Operator* Sin::substitute( int index, const Operator *sub ){
101 
102  return new Sin( argument->substitute( index , sub ) );
103 
104 }
105 
107 
108  return new Sin(*this);
109 }
110 
112 
113  if( initialized ) return SUCCESSFUL_RETURN;
115 
118 
119  return argument->initDerivative();
120 }
121 
122 
124 
125 // end of file.
Operator * derivative2
USING_NAMESPACE_ACADO IntermediateState sin(const Expression &arg)
Abstract base class for all scalar-valued symbolic operators.
Definition: operator.hpp:60
virtual Operator * substitute(int index, const Operator *sub)
Definition: sin.cpp:100
Implements the scalar sine operator within the symbolic operators family.
Definition: sin.hpp:55
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.
virtual Operator * clone() const =0
virtual Operator * substitute(int index, const Operator *sub)=0
#define CLOSE_NAMESPACE_ACADO
Operator * argument
Sin & operator=(const Sin &arg)
Definition: sin.cpp:85
BooleanType initialized
Definition: operator.hpp:642
IntermediateState cos(const Expression &arg)
double(* dfcn)(double)
UnaryOperator & operator=(const UnaryOperator &arg)
virtual returnValue initDerivative()
Definition: sin.cpp:111
Implements the scalar cosine operator within the symbolic operators family.
Definition: cos.hpp:55
Sin()
Definition: sin.cpp:47
virtual returnValue evaluate(EvaluationBase *x)
Definition: sin.cpp:93
virtual returnValue initDerivative()
Definition: operator.cpp:519
virtual Operator * clone() const
Definition: sin.cpp:106
virtual void Sin(Operator &arg)=0
#define BT_TRUE
Definition: acado_types.hpp:47
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.
double ddSin(double x)
Definition: sin.cpp:39
double(* fcn)(double)
~Sin()
Definition: sin.cpp:80
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:35:06