GiNaC  1.8.0
numeric.h
Go to the documentation of this file.
1 
5 /*
6  * GiNaC Copyright (C) 1999-2020 Johannes Gutenberg University Mainz, Germany
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef GINAC_NUMERIC_H
24 #define GINAC_NUMERIC_H
25 
26 #include "basic.h"
27 #include "ex.h"
28 #include "archive.h"
29 
30 #include <cln/complex.h>
31 #include <stdexcept>
32 #include <vector>
33 
34 namespace GiNaC {
35 
40 typedef void (* digits_changed_callback)(long);
41 
52 {
53 // member functions
54 public:
56  _numeric_digits& operator=(long prec);
57  operator long();
58  void print(std::ostream& os) const;
60 // member variables
61 private:
62  long digits;
63  static bool too_late;
64  // Holds a list of functions that get called when digits is changed.
65  std::vector<digits_changed_callback> callbacklist;
66 };
67 
68 
70 class pole_error : public std::domain_error {
71 public:
72  explicit pole_error(const std::string& what_arg, int degree);
73  int degree() const;
74 private:
75  int deg;
76 };
77 
78 
81 class numeric : public basic
82 {
84 
85 // member functions
86 
87  // other constructors
88 public:
89  numeric(int i);
90  numeric(unsigned int i);
91  numeric(long i);
92  numeric(unsigned long i);
93  numeric(long long i);
94  numeric(unsigned long long i);
95  numeric(long numer, long denom);
96  numeric(double d);
97  numeric(const char *);
98 
99  // functions overriding virtual functions from base classes
100 public:
101  unsigned precedence() const override {return 30;}
102  bool info(unsigned inf) const override;
103  bool is_polynomial(const ex & var) const override;
104  int degree(const ex & s) const override;
105  int ldegree(const ex & s) const override;
106  ex coeff(const ex & s, int n = 1) const override;
107  bool has(const ex &other, unsigned options = 0) const override;
108  ex eval() const override;
109  ex evalf() const override;
110  ex subs(const exmap & m, unsigned options = 0) const override { return subs_one_level(m, options); } // overwrites basic::subs() for performance reasons
111  ex normal(exmap & repl, exmap & rev_lookup, lst & modifier) const override;
112  ex to_rational(exmap & repl) const override;
113  ex to_polynomial(exmap & repl) const override;
114  numeric integer_content() const override;
115  ex smod(const numeric &xi) const override;
116  numeric max_coefficient() const override;
117  ex conjugate() const override;
118  ex real_part() const override;
119  ex imag_part() const override;
121  void archive(archive_node& n) const override;
123  void read_archive(const archive_node& n, lst& syms) override;
124 protected:
127  ex derivative(const symbol &s) const override { return 0; }
128  bool is_equal_same_type(const basic &other) const override;
129  unsigned calchash() const override;
130 
131  // new virtual functions which can be overridden by derived classes
132  // (none)
133 
134  // non-virtual functions in this class
135 public:
136  const numeric add(const numeric &other) const;
137  const numeric sub(const numeric &other) const;
138  const numeric mul(const numeric &other) const;
139  const numeric div(const numeric &other) const;
140  const numeric power(const numeric &other) const;
141  const numeric & add_dyn(const numeric &other) const;
142  const numeric & sub_dyn(const numeric &other) const;
143  const numeric & mul_dyn(const numeric &other) const;
144  const numeric & div_dyn(const numeric &other) const;
145  const numeric & power_dyn(const numeric &other) const;
146  const numeric & operator=(int i);
147  const numeric & operator=(unsigned int i);
148  const numeric & operator=(long i);
149  const numeric & operator=(unsigned long i);
150  const numeric & operator=(double d);
151  const numeric & operator=(const char *s);
152  const numeric inverse() const;
153  numeric step() const;
154  int csgn() const;
155  int compare(const numeric &other) const;
156  bool is_equal(const numeric &other) const;
157  bool is_zero() const;
158  bool is_positive() const;
159  bool is_negative() const;
160  bool is_integer() const;
161  bool is_pos_integer() const;
162  bool is_nonneg_integer() const;
163  bool is_even() const;
164  bool is_odd() const;
165  bool is_prime() const;
166  bool is_rational() const;
167  bool is_real() const;
168  bool is_cinteger() const;
169  bool is_crational() const;
170  bool operator==(const numeric &other) const;
171  bool operator!=(const numeric &other) const;
172  bool operator<(const numeric &other) const;
173  bool operator<=(const numeric &other) const;
174  bool operator>(const numeric &other) const;
175  bool operator>=(const numeric &other) const;
176  int to_int() const;
177  long to_long() const;
178  double to_double() const;
179  cln::cl_N to_cl_N() const;
180  const numeric real() const;
181  const numeric imag() const;
182  const numeric numer() const;
183  const numeric denom() const;
184  int int_length() const;
185  // converting routines for interfacing with CLN:
186  explicit numeric(const cln::cl_N &z);
187 
188 protected:
189  void print_numeric(const print_context & c, const char *par_open, const char *par_close, const char *imag_sym, const char *mul_sym, unsigned level) const;
190  void do_print(const print_context & c, unsigned level) const;
191  void do_print_latex(const print_latex & c, unsigned level) const;
192  void do_print_csrc(const print_csrc & c, unsigned level) const;
193  void do_print_csrc_cl_N(const print_csrc_cl_N & c, unsigned level) const;
194  void do_print_tree(const print_tree & c, unsigned level) const;
195  void do_print_python_repr(const print_python_repr & c, unsigned level) const;
196 
197 // member variables
198 
199 protected:
200  cln::cl_N value;
201 };
203 
204 
205 // global constants
206 
207 extern const numeric I;
208 extern _numeric_digits Digits;
209 
210 // global functions
211 
212 const numeric exp(const numeric &x);
213 const numeric log(const numeric &x);
214 const numeric sin(const numeric &x);
215 const numeric cos(const numeric &x);
216 const numeric tan(const numeric &x);
217 const numeric asin(const numeric &x);
218 const numeric acos(const numeric &x);
219 const numeric atan(const numeric &x);
220 const numeric atan(const numeric &y, const numeric &x);
221 const numeric sinh(const numeric &x);
222 const numeric cosh(const numeric &x);
223 const numeric tanh(const numeric &x);
224 const numeric asinh(const numeric &x);
225 const numeric acosh(const numeric &x);
226 const numeric atanh(const numeric &x);
227 const numeric Li2(const numeric &x);
228 const numeric zeta(const numeric &x);
229 const numeric lgamma(const numeric &x);
230 const numeric tgamma(const numeric &x);
231 const numeric psi(const numeric &x);
232 const numeric psi(const numeric &n, const numeric &x);
233 const numeric factorial(const numeric &n);
234 const numeric doublefactorial(const numeric &n);
235 const numeric binomial(const numeric &n, const numeric &k);
236 const numeric bernoulli(const numeric &n);
237 const numeric fibonacci(const numeric &n);
238 const numeric isqrt(const numeric &x);
239 const numeric sqrt(const numeric &x);
240 const numeric abs(const numeric &x);
241 const numeric mod(const numeric &a, const numeric &b);
242 const numeric smod(const numeric &a, const numeric &b);
243 const numeric irem(const numeric &a, const numeric &b);
244 const numeric irem(const numeric &a, const numeric &b, numeric &q);
245 const numeric iquo(const numeric &a, const numeric &b);
246 const numeric iquo(const numeric &a, const numeric &b, numeric &r);
247 const numeric gcd(const numeric &a, const numeric &b);
248 const numeric lcm(const numeric &a, const numeric &b);
249 
250 // wrapper functions around member functions
251 inline const numeric pow(const numeric &x, const numeric &y)
252 { return x.power(y); }
253 
254 inline const numeric inverse(const numeric &x)
255 { return x.inverse(); }
256 
257 inline numeric step(const numeric &x)
258 { return x.step(); }
259 
260 inline int csgn(const numeric &x)
261 { return x.csgn(); }
262 
263 inline bool is_zero(const numeric &x)
264 { return x.is_zero(); }
265 
266 inline bool is_positive(const numeric &x)
267 { return x.is_positive(); }
268 
269 inline bool is_negative(const numeric &x)
270 { return x.is_negative(); }
271 
272 inline bool is_integer(const numeric &x)
273 { return x.is_integer(); }
274 
275 inline bool is_pos_integer(const numeric &x)
276 { return x.is_pos_integer(); }
277 
278 inline bool is_nonneg_integer(const numeric &x)
279 { return x.is_nonneg_integer(); }
280 
281 inline bool is_even(const numeric &x)
282 { return x.is_even(); }
283 
284 inline bool is_odd(const numeric &x)
285 { return x.is_odd(); }
286 
287 inline bool is_prime(const numeric &x)
288 { return x.is_prime(); }
289 
290 inline bool is_rational(const numeric &x)
291 { return x.is_rational(); }
292 
293 inline bool is_real(const numeric &x)
294 { return x.is_real(); }
295 
296 inline bool is_cinteger(const numeric &x)
297 { return x.is_cinteger(); }
298 
299 inline bool is_crational(const numeric &x)
300 { return x.is_crational(); }
301 
302 inline int to_int(const numeric &x)
303 { return x.to_int(); }
304 
305 inline long to_long(const numeric &x)
306 { return x.to_long(); }
307 
308 inline double to_double(const numeric &x)
309 { return x.to_double(); }
310 
311 inline const numeric real(const numeric &x)
312 { return x.real(); }
313 
314 inline const numeric imag(const numeric &x)
315 { return x.imag(); }
316 
317 inline const numeric numer(const numeric &x)
318 { return x.numer(); }
319 
320 inline const numeric denom(const numeric &x)
321 { return x.denom(); }
322 
323 // numeric evaluation functions for class constant objects:
324 
325 ex PiEvalf();
326 ex EulerEvalf();
327 ex CatalanEvalf();
328 
329 
330 } // namespace GiNaC
331 
332 #endif // ndef GINAC_NUMERIC_H
GiNaC::digits_changed_callback
void(* digits_changed_callback)(long)
Function pointer to implement callbacks in the case 'Digits' gets changed.
Definition: numeric.h:40
GiNaC::print_python_repr
Context for python-parsable output.
Definition: print.h:139
GiNaC::is_cinteger
bool is_cinteger(const numeric &x)
Definition: numeric.h:296
GiNaC::numeric::to_int
int to_int() const
Converts numeric types to machine's int.
Definition: numeric.cpp:1303
GiNaC::numeric::evalf
ex evalf() const override
Cast numeric into a floating-point object.
Definition: numeric.cpp:795
GiNaC::atan
const numeric atan(const numeric &x)
Numeric arcustangent.
Definition: numeric.cpp:1508
GiNaC::is_odd
bool is_odd(const numeric &x)
Definition: numeric.h:284
GiNaC::numeric::is_integer
bool is_integer() const
True if object is a non-complex integer.
Definition: numeric.cpp:1154
GiNaC::numeric::mul
const numeric mul(const numeric &other) const
Numerical multiplication method.
Definition: numeric.cpp:880
r
size_t r
Definition: factor.cpp:770
GiNaC::numeric::info
bool info(unsigned inf) const override
Information about the object.
Definition: numeric.cpp:684
GiNaC::numeric::operator<=
bool operator<=(const numeric &other) const
Numerical comparison: less or equal.
Definition: numeric.cpp:1270
GiNaC::_numeric_digits::print
void print(std::ostream &os) const
Append global Digits object to ostream.
Definition: numeric.cpp:2556
GiNaC::numeric::do_print_python_repr
void do_print_python_repr(const print_python_repr &c, unsigned level) const
Definition: numeric.cpp:677
GiNaC::numeric::to_cl_N
cln::cl_N to_cl_N() const
Returns a new CLN object of type cl_N, representing the value of *this.
Definition: numeric.cpp:1332
GiNaC::numeric::conjugate
ex conjugate() const override
Definition: numeric.cpp:800
GiNaC::numeric::eval
ex eval() const override
Evaluation of numbers doesn't do anything at all.
Definition: numeric.cpp:783
GiNaC::to_double
double to_double(const numeric &x)
Definition: numeric.h:308
GiNaC::iquo
const numeric iquo(const numeric &a, const numeric &b)
Numeric integer quotient.
Definition: numeric.cpp:2404
GiNaC::_numeric_digits::too_late
static bool too_late
Already one object present.
Definition: numeric.h:63
GiNaC::numeric::to_rational
ex to_rational(exmap &repl) const override
Implementation of ex::to_rational() for a numeric.
Definition: normal.cpp:2638
GiNaC::Digits
_numeric_digits Digits
Accuracy in decimal digits.
Definition: numeric.cpp:2586
GiNaC::fibonacci
const numeric fibonacci(const numeric &n)
Fibonacci number.
Definition: numeric.cpp:2258
GiNaC::is_pos_integer
bool is_pos_integer(const numeric &x)
Definition: numeric.h:275
GiNaC::print_context
Base class for print_contexts.
Definition: print.h:103
GiNaC::numeric::is_rational
bool is_rational() const
True if object is an exact rational number, may even be complex (denominator may be unity).
Definition: numeric.cpp:1201
k
vector< int > k
Definition: factor.cpp:1466
GiNaC::numeric::add_dyn
const numeric & add_dyn(const numeric &other) const
Numerical addition method.
Definition: numeric.cpp:925
GiNaC::to_long
long to_long(const numeric &x)
Definition: numeric.h:305
GiNaC::psi
function psi(const T1 &p1)
Definition: inifcns.h:165
GiNaC::print_csrc
Base context for C source output.
Definition: print.h:158
GiNaC::numeric::imag
const numeric imag() const
Imaginary part of a number.
Definition: numeric.cpp:1346
GiNaC::ex::denom
ex denom() const
Get denominator of an expression.
Definition: normal.cpp:2539
GiNaC::asin
const numeric asin(const numeric &x)
Numeric inverse sine (trigonometric function).
Definition: numeric.cpp:1488
GiNaC::numeric::operator!=
bool operator!=(const numeric &other) const
Definition: numeric.cpp:1220
GiNaC::_numeric_digits::operator=
_numeric_digits & operator=(long prec)
Assign a native long to global Digits object.
Definition: numeric.cpp:2532
GiNaC::is_rational
bool is_rational(const numeric &x)
Definition: numeric.h:290
GiNaC::numeric::is_real
bool is_real() const
True if object is a real integer, rational or float (but not complex).
Definition: numeric.cpp:1208
GiNaC::numeric::to_long
long to_long() const
Converts numeric types to machine's long.
Definition: numeric.cpp:1313
GiNaC::numeric::operator>=
bool operator>=(const numeric &other) const
Numerical comparison: greater or equal.
Definition: numeric.cpp:1292
GiNaC::doublefactorial
const numeric doublefactorial(const numeric &n)
The double factorial combinatorial function.
Definition: numeric.cpp:2127
GiNaC::archive_node
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
Definition: archive.h:49
GiNaC::numeric::is_odd
bool is_odd() const
True if object is an exact odd integer.
Definition: numeric.cpp:1182
GiNaC::numeric::has
bool has(const ex &other, unsigned options=0) const override
Disassemble real part and imaginary part to scan for the occurrence of a single number.
Definition: numeric.cpp:754
GiNaC::numeric::smod
ex smod(const numeric &xi) const override
Apply symmetric modular homomorphism to an expanded multivariate polynomial.
Definition: normal.cpp:1208
options
unsigned options
Definition: factor.cpp:2480
GiNaC::GINAC_DECLARE_UNARCHIVER
GINAC_DECLARE_UNARCHIVER(add)
GiNaC::numeric::calchash
unsigned calchash() const override
Compute the hash value of an object and if it makes sense to store it in the objects status_flags,...
Definition: numeric.cpp:838
m
mvec m
Definition: factor.cpp:771
GiNaC::factorial
const numeric factorial(const numeric &n)
Factorial combinatorial function.
Definition: numeric.cpp:2113
GiNaC::sqrt
const numeric sqrt(const numeric &x)
Numeric square root.
Definition: numeric.cpp:2475
GiNaC::Li2
const numeric Li2(const numeric &x)
Definition: numeric.cpp:1705
GiNaC::acosh
const numeric acosh(const numeric &x)
Numeric inverse hyperbolic cosine (trigonometric function).
Definition: numeric.cpp:1590
GiNaC
Definition: add.cpp:38
syms
exset syms
Definition: factor.cpp:2434
GiNaC::is_crational
bool is_crational(const numeric &x)
Definition: numeric.h:299
GiNaC::is_real
bool is_real(const numeric &x)
Definition: numeric.h:293
GiNaC::numeric::operator>
bool operator>(const numeric &other) const
Numerical comparison: greater.
Definition: numeric.cpp:1281
GiNaC::tanh
const numeric tanh(const numeric &x)
Numeric hyperbolic tangent (trigonometric function).
Definition: numeric.cpp:1572
GiNaC::pole_error::degree
int degree() const
Return the degree of the pole_error exception class.
Definition: utils.cpp:42
GiNaC::numeric::is_negative
bool is_negative() const
True if object is not complex and less than zero.
Definition: numeric.cpp:1145
GiNaC::asinh
const numeric asinh(const numeric &x)
Numeric inverse hyperbolic sine (trigonometric function).
Definition: numeric.cpp:1581
x
ex x
Definition: factor.cpp:1641
GiNaC::zeta
function zeta(const T1 &p1)
Definition: inifcns.h:111
GINAC_DECLARE_REGISTERED_CLASS
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the declaration of each registered class.
Definition: registrar.h:153
GiNaC::_numeric_digits
This class is used to instantiate a global singleton object Digits which behaves just like Maple's Di...
Definition: numeric.h:52
GiNaC::_numeric_digits::callbacklist
std::vector< digits_changed_callback > callbacklist
Definition: numeric.h:65
GiNaC::numeric::normal
ex normal(exmap &repl, exmap &rev_lookup, lst &modifier) const override
Implementation of ex::normal() for a numeric.
Definition: normal.cpp:2222
GiNaC::pole_error::deg
int deg
Definition: numeric.h:75
GiNaC::numeric::subs
ex subs(const exmap &m, unsigned options=0) const override
Substitute a set of objects by arbitrary expressions.
Definition: numeric.h:110
GiNaC::numeric::operator<
bool operator<(const numeric &other) const
Numerical comparison: less.
Definition: numeric.cpp:1259
GiNaC::sin
const numeric sin(const numeric &x)
Numeric sine (trigonometric function).
Definition: numeric.cpp:1461
GiNaC::numeric::derivative
ex derivative(const symbol &s) const override
Implementation of ex::diff for a numeric always returns 0.
Definition: numeric.h:127
GiNaC::gcd
ex gcd(const ex &a, const ex &b, ex *ca, ex *cb, bool check_args, unsigned options)
Compute GCD (Greatest Common Divisor) of multivariate polynomials a(X) and b(X) in Z[X].
Definition: normal.cpp:1432
GiNaC::ex
Lightweight wrapper for GiNaC's symbolic objects.
Definition: ex.h:72
GiNaC::is_even
bool is_even(const numeric &x)
Definition: numeric.h:281
GiNaC::numeric::do_print_latex
void do_print_latex(const print_latex &c, unsigned level) const
Definition: numeric.cpp:610
GiNaC::numeric::is_zero
bool is_zero() const
True if object is zero.
Definition: numeric.cpp:1129
GiNaC::csgn
int csgn(const numeric &x)
Definition: numeric.h:260
GiNaC::isqrt
const numeric isqrt(const numeric &x)
Integer numeric square root.
Definition: numeric.cpp:2482
GiNaC::numeric::do_print_csrc
void do_print_csrc(const print_csrc &c, unsigned level) const
Definition: numeric.cpp:615
GiNaC::numeric::integer_content
numeric integer_content() const override
Definition: normal.cpp:328
GiNaC::numeric::imag_part
ex imag_part() const override
Definition: numeric.cpp:813
GiNaC::numeric::sub_dyn
const numeric & sub_dyn(const numeric &other) const
Numerical subtraction method.
Definition: numeric.cpp:942
GiNaC::cosh
const numeric cosh(const numeric &x)
Numeric hyperbolic cosine (trigonometric function).
Definition: numeric.cpp:1563
GiNaC::numeric::is_pos_integer
bool is_pos_integer() const
True if object is an exact integer greater than zero.
Definition: numeric.cpp:1161
GiNaC::numer
ex numer(const ex &thisex)
Definition: ex.h:745
GiNaC::exp
const numeric exp(const numeric &x)
Exponential function.
Definition: numeric.cpp:1439
GiNaC::_numeric_digits::add_callback
void add_callback(digits_changed_callback callback)
Add a new callback function.
Definition: numeric.cpp:2563
GiNaC::numeric::do_print_csrc_cl_N
void do_print_csrc_cl_N(const print_csrc_cl_N &c, unsigned level) const
Definition: numeric.cpp:651
GiNaC::cos
const numeric cos(const numeric &x)
Numeric cosine (trigonometric function).
Definition: numeric.cpp:1470
GiNaC::numeric::do_print_tree
void do_print_tree(const print_tree &c, unsigned level) const
Definition: numeric.cpp:669
GiNaC::numeric::inverse
const numeric inverse() const
Inverse of a number.
Definition: numeric.cpp:1053
ex.h
Interface to GiNaC's light-weight expression handles.
GiNaC::PiEvalf
ex PiEvalf()
Floating point evaluation of Archimedes' constant Pi.
Definition: numeric.cpp:2494
GiNaC::numeric::sub
const numeric sub(const numeric &other) const
Numerical subtraction method.
Definition: numeric.cpp:872
GiNaC::I
const numeric I
Imaginary unit.
Definition: numeric.cpp:1433
GiNaC::print_latex
Context for latex-parsable output.
Definition: print.h:123
GiNaC::step
numeric step(const numeric &x)
Definition: numeric.h:257
GiNaC::numeric::is_nonneg_integer
bool is_nonneg_integer() const
True if object is an exact integer greater or equal zero.
Definition: numeric.cpp:1168
GiNaC::basic::subs_one_level
ex subs_one_level(const exmap &m, unsigned options) const
Helper function for subs().
Definition: basic.cpp:585
GiNaC::numeric::numeric
numeric(int i)
Definition: numeric.cpp:85
GiNaC::CatalanEvalf
ex CatalanEvalf()
Floating point evaluation of Catalan's constant.
Definition: numeric.cpp:2508
GiNaC::numeric::do_print
void do_print(const print_context &c, unsigned level) const
Definition: numeric.cpp:605
GiNaC::acos
const numeric acos(const numeric &x)
Numeric inverse cosine (trigonometric function).
Definition: numeric.cpp:1497
GiNaC::numeric::to_double
double to_double() const
Converts numeric types to machine's double.
Definition: numeric.cpp:1322
GiNaC::print_tree
Context for tree-like output for debugging.
Definition: print.h:147
GiNaC::inverse
matrix inverse(const matrix &m)
Definition: matrix.h:150
GiNaC::numeric::precedence
unsigned precedence() const override
Return relative operator precedence (for parenthezing output).
Definition: numeric.h:101
GiNaC::denom
ex denom(const ex &thisex)
Definition: ex.h:748
GiNaC::is_nonneg_integer
bool is_nonneg_integer(const numeric &x)
Definition: numeric.h:278
GiNaC::numeric::int_length
int int_length() const
Size in binary notation.
Definition: numeric.cpp:1418
GiNaC::_numeric_digits::_numeric_digits
_numeric_digits()
_numeric_digits default ctor, checking for singleton invariance.
Definition: numeric.cpp:2515
GiNaC::numeric::is_crational
bool is_crational() const
True if object is an exact rational number, may even be complex (denominator may be unity).
Definition: numeric.cpp:1243
GiNaC::container
Wrapper template for making GiNaC classes out of STL containers.
Definition: container.h:73
GiNaC::bernoulli
const numeric bernoulli(const numeric &nn)
Bernoulli number.
Definition: numeric.cpp:2166
GiNaC::irem
const numeric irem(const numeric &a, const numeric &b)
Numeric integer remainder.
Definition: numeric.cpp:2363
GiNaC::numeric::is_equal_same_type
bool is_equal_same_type(const basic &other) const override
Returns true if two objects of same type are equal.
Definition: numeric.cpp:829
GiNaC::EulerEvalf
ex EulerEvalf()
Floating point evaluation of Euler's constant gamma.
Definition: numeric.cpp:2501
GiNaC::sinh
const numeric sinh(const numeric &x)
Numeric hyperbolic sine (trigonometric function).
Definition: numeric.cpp:1554
GiNaC::pole_error
Exception class thrown when a singularity is encountered.
Definition: numeric.h:70
c
size_t c
Definition: factor.cpp:770
GiNaC::numeric::add
const numeric add(const numeric &other) const
Numerical addition method.
Definition: numeric.cpp:864
GiNaC::exmap
std::map< ex, ex, ex_is_less > exmap
Definition: basic.h:50
GiNaC::real
const numeric real(const numeric &x)
Definition: numeric.h:311
GiNaC::numeric::is_equal
bool is_equal(const numeric &other) const
Definition: numeric.cpp:1122
GiNaC::mod
const numeric mod(const numeric &a, const numeric &b)
Modulus (in positive representation).
Definition: numeric.cpp:2328
GiNaC::numeric::is_positive
bool is_positive() const
True if object is not complex and greater than zero.
Definition: numeric.cpp:1136
GiNaC::imag
const numeric imag(const numeric &x)
Definition: numeric.h:314
archive.h
Archiving of GiNaC expressions.
basic.h
Interface to GiNaC's ABC.
GiNaC::numeric::degree
int degree(const ex &s) const override
Return degree of highest power in object s.
Definition: numeric.cpp:733
GiNaC::numeric::is_cinteger
bool is_cinteger() const
True if object is element of the domain of integers extended by I, i.e.
Definition: numeric.cpp:1228
GiNaC::symbol
Basic CAS symbol.
Definition: symbol.h:39
n
size_t n
Definition: factor.cpp:1463
GiNaC::pow
const numeric pow(const numeric &x, const numeric &y)
Definition: numeric.h:251
GiNaC::numeric::power_dyn
const numeric & power_dyn(const numeric &other) const
Numerical exponentiation.
Definition: numeric.cpp:993
GiNaC::to_int
int to_int(const numeric &x)
Definition: numeric.h:302
GiNaC::numeric::csgn
int csgn() const
Return the complex half-plane (left or right) in which the number lies.
Definition: numeric.cpp:1078
GiNaC::binomial
const numeric binomial(const numeric &n, const numeric &k)
The Binomial coefficients.
Definition: numeric.cpp:2143
GiNaC::numeric::max_coefficient
numeric max_coefficient() const override
Implementation ex::max_coefficient().
Definition: normal.cpp:1166
GiNaC::is_zero
bool is_zero(const ex &thisex)
Definition: ex.h:820
GiNaC::basic
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
Definition: basic.h:105
GiNaC::numeric::to_polynomial
ex to_polynomial(exmap &repl) const override
Implementation of ex::to_polynomial() for a numeric.
Definition: normal.cpp:2656
GiNaC::is_negative
bool is_negative(const numeric &x)
Definition: numeric.h:269
GiNaC::numeric::div
const numeric div(const numeric &other) const
Numerical division method.
Definition: numeric.cpp:890
GiNaC::ex::is_zero
bool is_zero() const
Definition: ex.h:213
GiNaC::numeric::is_even
bool is_even() const
True if object is an exact even integer.
Definition: numeric.cpp:1175
GiNaC::numeric::read_archive
void read_archive(const archive_node &n, lst &syms) override
Read (a.k.a.
Definition: numeric.cpp:289
GiNaC::log
const numeric log(const numeric &x)
Natural logarithm.
Definition: numeric.cpp:1450
GiNaC::lcm
ex lcm(const ex &a, const ex &b, bool check_args)
Compute LCM (Least Common Multiple) of multivariate polynomials in Z[X].
Definition: normal.cpp:1774
GiNaC::print_csrc_cl_N
Context for C source output using CLN numbers.
Definition: print.h:182
GiNaC::lgamma
const cln::cl_N lgamma(const cln::cl_N &x)
The Gamma function.
Definition: numeric.cpp:2039
GiNaC::ex::numer
ex numer() const
Get numerator of an expression.
Definition: normal.cpp:2514
GiNaC::tan
const numeric tan(const numeric &x)
Numeric tangent (trigonometric function).
Definition: numeric.cpp:1479
GiNaC::numeric::step
numeric step() const
Return the step function of a numeric.
Definition: numeric.cpp:1064
GiNaC::abs
const numeric abs(const numeric &x)
Absolute value.
Definition: numeric.cpp:2315
GiNaC::smod
const numeric smod(const numeric &a_, const numeric &b_)
Modulus (in symmetric representation).
Definition: numeric.cpp:2341
GiNaC::numeric::real
const numeric real() const
Real part of a number.
Definition: numeric.cpp:1339
GiNaC::is_integer
bool is_integer(const numeric &x)
Definition: numeric.h:272
GiNaC::numeric::coeff
ex coeff(const ex &s, int n=1) const override
Return coefficient of degree n in object s.
Definition: numeric.cpp:743
GiNaC::is_positive
bool is_positive(const numeric &x)
Definition: numeric.h:266
GiNaC::numeric::operator==
bool operator==(const numeric &other) const
Definition: numeric.cpp:1214
GiNaC::numeric::value
cln::cl_N value
Definition: numeric.h:200
GiNaC::pole_error::pole_error
pole_error(const std::string &what_arg, int degree)
ctor for pole_error exception class.
Definition: utils.cpp:38
GiNaC::numeric::denom
const numeric denom() const
Denominator.
Definition: numeric.cpp:1387
GiNaC::numeric::numer
const numeric numer() const
Numerator.
Definition: numeric.cpp:1356
GiNaC::numeric::print_numeric
void print_numeric(const print_context &c, const char *par_open, const char *par_close, const char *imag_sym, const char *mul_sym, unsigned level) const
Definition: numeric.cpp:542
GiNaC::numeric::archive
void archive(archive_node &n) const override
Save (a.k.a.
Definition: numeric.cpp:344
GiNaC::numeric::ldegree
int ldegree(const ex &s) const override
Return degree of lowest power in object s.
Definition: numeric.cpp:738
GiNaC::numeric
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
Definition: numeric.h:82
GiNaC::numeric::operator=
const numeric & operator=(int i)
Definition: numeric.cpp:1016
GiNaC::_numeric_digits::digits
long digits
Number of decimal digits.
Definition: numeric.h:62
GiNaC::is_prime
bool is_prime(const numeric &x)
Definition: numeric.h:287
GiNaC::numeric::is_polynomial
bool is_polynomial(const ex &var) const override
Check whether this is a polynomial in the given variables.
Definition: numeric.cpp:728
GiNaC::tgamma
const cln::cl_N tgamma(const cln::cl_N &x)
Definition: numeric.cpp:2067
GiNaC::numeric::mul_dyn
const numeric & mul_dyn(const numeric &other) const
Numerical multiplication method.
Definition: numeric.cpp:957
GiNaC::atanh
const numeric atanh(const numeric &x)
Numeric inverse hyperbolic tangent (trigonometric function).
Definition: numeric.cpp:1599
GiNaC::numeric::is_prime
bool is_prime() const
Probabilistic primality test.
Definition: numeric.cpp:1191
GiNaC::numeric::div_dyn
const numeric & div_dyn(const numeric &other) const
Numerical division method.
Definition: numeric.cpp:976
GiNaC::numeric::power
const numeric power(const numeric &other) const
Numerical exponentiation.
Definition: numeric.cpp:900
GiNaC::numeric::real_part
ex real_part() const override
Definition: numeric.cpp:808
GiNaC::numeric::compare
int compare(const numeric &other) const
This method establishes a canonical order on all numbers.
Definition: numeric.cpp:1104

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.