Bertini 2 - C++ Core
Software for Numerical Algebraic Geometry
Loading...
Searching...
No Matches
special_number.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//special_number.hpp is free software: you can redistribute it and/or modify
4//it under the terms of the GNU General Public License as published by
5//the Free Software Foundation, either version 3 of the License, or
6//(at your option) any later version.
7//
8//special_number.hpp is distributed in the hope that it will be useful,
9//but WITHOUT ANY WARRANTY; without even the implied warranty of
10//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11//GNU General Public License for more details.
12//
13//You should have received a copy of the GNU General Public License
14//along with special_number.hpp. If not, see <http://www.gnu.org/licenses/>.
15//
16// Copyright(C) 2015 - 2023 by Bertini2 Development Team
17//
18// See <http://www.gnu.org/licenses/> for a copy of the license,
19// as well as COPYING. Bertini2 is provided with permitted
20// additional terms in the b2/licenses/ directory.
21
22// individual authors of this file include:
23// James Collins
24// West Texas A&M University
25// Spring, Summer 2015
26//
27//
28// silviana amethyst
29// University of Wisconsin - Eau Claire
30//
31// Created by Collins, James B. on 4/30/15.
32//
33//
34// special_number.hpp: Declares the class SpecialNumber.
35
42
43#ifndef BERTINI_FUNCTION_TREE_SPECIAL_NUMBER_HPP
44#define BERTINI_FUNCTION_TREE_SPECIAL_NUMBER_HPP
45
46
48
49#include <cmath>
50
51
52
53namespace bertini {
54namespace node{
55 using ::acos;
56 using ::exp;
57
58
59 namespace special_number{
60
66 class Pi : public virtual Number, public virtual NamedSymbol, public virtual EnableSharedFromThisVirtual<Pi>
67 {
68 public:
69 BERTINI_DEFAULT_VISITABLE()
70
71 virtual ~Pi() = default;
72
73 template<typename... Ts>
74 static
75 std::shared_ptr<Pi> Make(Ts&& ...ts){
76 return std::shared_ptr<Pi>( new Pi(ts...) );
77 }
78
79
80 private:
81
82 Pi() : NamedSymbol("pi")
83 {}
84
85 // Return value of constant
86 dbl FreshEval_d(std::shared_ptr<Variable> const& diff_variable) const override;
87
88 void FreshEval_d(dbl& evaluation_value, std::shared_ptr<Variable> const& diff_variable) const override;
89
90
91 mpfr_complex FreshEval_mp(std::shared_ptr<Variable> const& diff_variable) const override;
92
93 void FreshEval_mp(mpfr_complex& evaluation_value, std::shared_ptr<Variable> const& diff_variable) const override;
94
95
96 friend class boost::serialization::access;
97
98 template <typename Archive>
99 void serialize(Archive& ar, const unsigned version) {
100 ar & boost::serialization::base_object<Number>(*this);
101 ar & boost::serialization::base_object<NamedSymbol>(*this);
102 }
103 };
104
105
106
112 class E : public virtual Number, public virtual NamedSymbol, public virtual EnableSharedFromThisVirtual<E>
113 {
114 public:
115 BERTINI_DEFAULT_VISITABLE()
116
117
118
119 virtual ~E() = default;
120
121
122 template<typename... Ts>
123 static
124 std::shared_ptr<E> Make(Ts&& ...ts){
125 return std::shared_ptr<E>( new E(ts...) );
126 }
127
128
129 private:
130
131 E() : NamedSymbol("e")
132 {}
133
134
135 // Return value of constant
136 dbl FreshEval_d(std::shared_ptr<Variable> const& diff_variable) const override;
137
138 void FreshEval_d(dbl& evaluation_value, std::shared_ptr<Variable> const& diff_variable) const override;
139
140
141 mpfr_complex FreshEval_mp(std::shared_ptr<Variable> const& diff_variable) const override;
142
143 void FreshEval_mp(mpfr_complex& evaluation_value, std::shared_ptr<Variable> const& diff_variable) const override;
144
145
146 friend class boost::serialization::access;
147
148 template <typename Archive>
149 void serialize(Archive& ar, const unsigned version) {
150 ar & boost::serialization::base_object<Number>(*this);
151 ar & boost::serialization::base_object<NamedSymbol>(*this);
152 }
153
154 };
155
156 } // re: special_number namespace
157
158
162 std::shared_ptr<Node> Pi();
163
167 std::shared_ptr<Node> E();
168
172 std::shared_ptr<Node> I();
173
177 std::shared_ptr<Node> Two();
178
182 std::shared_ptr<Node> One();
183
187 std::shared_ptr<Node> Zero();
188
189
190} // re: namespace node
191} // re: namespace bertini
192
193#endif
194
195
196
197
198
NamedSymbol(const std::string &new_name)
Definition symbol.cpp:54
Abstract Number type from which other Numbers derive.
Definition number.hpp:63
Provides the Number Node types, including Rational, Float, and Integer.
std::shared_ptr< Node > E()
Definition special_number.cpp:37
std::shared_ptr< Node > Two()
Definition special_number.cpp:48
std::shared_ptr< Node > Pi()
Definition special_number.cpp:32
std::shared_ptr< Node > One()
Definition special_number.cpp:53
std::shared_ptr< Node > I()
Definition special_number.cpp:42
std::shared_ptr< Node > Zero()
Definition special_number.cpp:58