Go to the documentation of this file.
23 #ifndef GINAC_NUMERIC_H
24 #define GINAC_NUMERIC_H
30 #include <cln/complex.h>
58 void print(std::ostream& os)
const;
102 bool info(
unsigned inf)
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;
186 explicit numeric(
const cln::cl_N &z);
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;
252 {
return x.power(y); }
255 {
return x.inverse(); }
267 {
return x.is_positive(); }
270 {
return x.is_negative(); }
273 {
return x.is_integer(); }
276 {
return x.is_pos_integer(); }
279 {
return x.is_nonneg_integer(); }
282 {
return x.is_even(); }
285 {
return x.is_odd(); }
288 {
return x.is_prime(); }
291 {
return x.is_rational(); }
294 {
return x.is_real(); }
297 {
return x.is_cinteger(); }
300 {
return x.is_crational(); }
303 {
return x.to_int(); }
306 {
return x.to_long(); }
309 {
return x.to_double(); }
332 #endif // ndef GINAC_NUMERIC_H
void(* digits_changed_callback)(long)
Function pointer to implement callbacks in the case 'Digits' gets changed.
Context for python-parsable output.
bool is_cinteger(const numeric &x)
int to_int() const
Converts numeric types to machine's int.
ex evalf() const override
Cast numeric into a floating-point object.
const numeric atan(const numeric &x)
Numeric arcustangent.
bool is_odd(const numeric &x)
bool is_integer() const
True if object is a non-complex integer.
const numeric mul(const numeric &other) const
Numerical multiplication method.
bool info(unsigned inf) const override
Information about the object.
bool operator<=(const numeric &other) const
Numerical comparison: less or equal.
void print(std::ostream &os) const
Append global Digits object to ostream.
void do_print_python_repr(const print_python_repr &c, unsigned level) const
cln::cl_N to_cl_N() const
Returns a new CLN object of type cl_N, representing the value of *this.
ex conjugate() const override
ex eval() const override
Evaluation of numbers doesn't do anything at all.
double to_double(const numeric &x)
const numeric iquo(const numeric &a, const numeric &b)
Numeric integer quotient.
static bool too_late
Already one object present.
ex to_rational(exmap &repl) const override
Implementation of ex::to_rational() for a numeric.
_numeric_digits Digits
Accuracy in decimal digits.
const numeric fibonacci(const numeric &n)
Fibonacci number.
bool is_pos_integer(const numeric &x)
Base class for print_contexts.
bool is_rational() const
True if object is an exact rational number, may even be complex (denominator may be unity).
const numeric & add_dyn(const numeric &other) const
Numerical addition method.
long to_long(const numeric &x)
function psi(const T1 &p1)
Base context for C source output.
const numeric imag() const
Imaginary part of a number.
ex denom() const
Get denominator of an expression.
const numeric asin(const numeric &x)
Numeric inverse sine (trigonometric function).
bool operator!=(const numeric &other) const
_numeric_digits & operator=(long prec)
Assign a native long to global Digits object.
bool is_rational(const numeric &x)
bool is_real() const
True if object is a real integer, rational or float (but not complex).
long to_long() const
Converts numeric types to machine's long.
bool operator>=(const numeric &other) const
Numerical comparison: greater or equal.
const numeric doublefactorial(const numeric &n)
The double factorial combinatorial function.
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
bool is_odd() const
True if object is an exact odd integer.
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.
ex smod(const numeric &xi) const override
Apply symmetric modular homomorphism to an expanded multivariate polynomial.
GINAC_DECLARE_UNARCHIVER(add)
unsigned calchash() const override
Compute the hash value of an object and if it makes sense to store it in the objects status_flags,...
const numeric factorial(const numeric &n)
Factorial combinatorial function.
const numeric sqrt(const numeric &x)
Numeric square root.
const numeric Li2(const numeric &x)
const numeric acosh(const numeric &x)
Numeric inverse hyperbolic cosine (trigonometric function).
bool is_crational(const numeric &x)
bool is_real(const numeric &x)
bool operator>(const numeric &other) const
Numerical comparison: greater.
const numeric tanh(const numeric &x)
Numeric hyperbolic tangent (trigonometric function).
int degree() const
Return the degree of the pole_error exception class.
bool is_negative() const
True if object is not complex and less than zero.
const numeric asinh(const numeric &x)
Numeric inverse hyperbolic sine (trigonometric function).
function zeta(const T1 &p1)
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the declaration of each registered class.
This class is used to instantiate a global singleton object Digits which behaves just like Maple's Di...
std::vector< digits_changed_callback > callbacklist
ex normal(exmap &repl, exmap &rev_lookup, lst &modifier) const override
Implementation of ex::normal() for a numeric.
ex subs(const exmap &m, unsigned options=0) const override
Substitute a set of objects by arbitrary expressions.
bool operator<(const numeric &other) const
Numerical comparison: less.
const numeric sin(const numeric &x)
Numeric sine (trigonometric function).
ex derivative(const symbol &s) const override
Implementation of ex::diff for a numeric always returns 0.
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].
Lightweight wrapper for GiNaC's symbolic objects.
bool is_even(const numeric &x)
void do_print_latex(const print_latex &c, unsigned level) const
bool is_zero() const
True if object is zero.
int csgn(const numeric &x)
const numeric isqrt(const numeric &x)
Integer numeric square root.
void do_print_csrc(const print_csrc &c, unsigned level) const
numeric integer_content() const override
ex imag_part() const override
const numeric & sub_dyn(const numeric &other) const
Numerical subtraction method.
const numeric cosh(const numeric &x)
Numeric hyperbolic cosine (trigonometric function).
bool is_pos_integer() const
True if object is an exact integer greater than zero.
ex numer(const ex &thisex)
const numeric exp(const numeric &x)
Exponential function.
void add_callback(digits_changed_callback callback)
Add a new callback function.
void do_print_csrc_cl_N(const print_csrc_cl_N &c, unsigned level) const
const numeric cos(const numeric &x)
Numeric cosine (trigonometric function).
void do_print_tree(const print_tree &c, unsigned level) const
const numeric inverse() const
Inverse of a number.
Interface to GiNaC's light-weight expression handles.
ex PiEvalf()
Floating point evaluation of Archimedes' constant Pi.
const numeric sub(const numeric &other) const
Numerical subtraction method.
const numeric I
Imaginary unit.
Context for latex-parsable output.
numeric step(const numeric &x)
bool is_nonneg_integer() const
True if object is an exact integer greater or equal zero.
ex subs_one_level(const exmap &m, unsigned options) const
Helper function for subs().
ex CatalanEvalf()
Floating point evaluation of Catalan's constant.
void do_print(const print_context &c, unsigned level) const
const numeric acos(const numeric &x)
Numeric inverse cosine (trigonometric function).
double to_double() const
Converts numeric types to machine's double.
Context for tree-like output for debugging.
matrix inverse(const matrix &m)
unsigned precedence() const override
Return relative operator precedence (for parenthezing output).
ex denom(const ex &thisex)
bool is_nonneg_integer(const numeric &x)
int int_length() const
Size in binary notation.
_numeric_digits()
_numeric_digits default ctor, checking for singleton invariance.
bool is_crational() const
True if object is an exact rational number, may even be complex (denominator may be unity).
Wrapper template for making GiNaC classes out of STL containers.
const numeric bernoulli(const numeric &nn)
Bernoulli number.
const numeric irem(const numeric &a, const numeric &b)
Numeric integer remainder.
bool is_equal_same_type(const basic &other) const override
Returns true if two objects of same type are equal.
ex EulerEvalf()
Floating point evaluation of Euler's constant gamma.
const numeric sinh(const numeric &x)
Numeric hyperbolic sine (trigonometric function).
Exception class thrown when a singularity is encountered.
const numeric add(const numeric &other) const
Numerical addition method.
std::map< ex, ex, ex_is_less > exmap
const numeric real(const numeric &x)
bool is_equal(const numeric &other) const
const numeric mod(const numeric &a, const numeric &b)
Modulus (in positive representation).
bool is_positive() const
True if object is not complex and greater than zero.
const numeric imag(const numeric &x)
Archiving of GiNaC expressions.
Interface to GiNaC's ABC.
int degree(const ex &s) const override
Return degree of highest power in object s.
bool is_cinteger() const
True if object is element of the domain of integers extended by I, i.e.
const numeric pow(const numeric &x, const numeric &y)
const numeric & power_dyn(const numeric &other) const
Numerical exponentiation.
int to_int(const numeric &x)
int csgn() const
Return the complex half-plane (left or right) in which the number lies.
const numeric binomial(const numeric &n, const numeric &k)
The Binomial coefficients.
numeric max_coefficient() const override
Implementation ex::max_coefficient().
bool is_zero(const ex &thisex)
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
ex to_polynomial(exmap &repl) const override
Implementation of ex::to_polynomial() for a numeric.
bool is_negative(const numeric &x)
const numeric div(const numeric &other) const
Numerical division method.
bool is_even() const
True if object is an exact even integer.
void read_archive(const archive_node &n, lst &syms) override
Read (a.k.a.
const numeric log(const numeric &x)
Natural logarithm.
ex lcm(const ex &a, const ex &b, bool check_args)
Compute LCM (Least Common Multiple) of multivariate polynomials in Z[X].
Context for C source output using CLN numbers.
const cln::cl_N lgamma(const cln::cl_N &x)
The Gamma function.
ex numer() const
Get numerator of an expression.
const numeric tan(const numeric &x)
Numeric tangent (trigonometric function).
numeric step() const
Return the step function of a numeric.
const numeric abs(const numeric &x)
Absolute value.
const numeric smod(const numeric &a_, const numeric &b_)
Modulus (in symmetric representation).
const numeric real() const
Real part of a number.
bool is_integer(const numeric &x)
ex coeff(const ex &s, int n=1) const override
Return coefficient of degree n in object s.
bool is_positive(const numeric &x)
bool operator==(const numeric &other) const
pole_error(const std::string &what_arg, int degree)
ctor for pole_error exception class.
const numeric denom() const
Denominator.
const numeric numer() const
Numerator.
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
void archive(archive_node &n) const override
Save (a.k.a.
int ldegree(const ex &s) const override
Return degree of lowest power in object s.
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
const numeric & operator=(int i)
long digits
Number of decimal digits.
bool is_prime(const numeric &x)
bool is_polynomial(const ex &var) const override
Check whether this is a polynomial in the given variables.
const cln::cl_N tgamma(const cln::cl_N &x)
const numeric & mul_dyn(const numeric &other) const
Numerical multiplication method.
const numeric atanh(const numeric &x)
Numeric inverse hyperbolic tangent (trigonometric function).
bool is_prime() const
Probabilistic primality test.
const numeric & div_dyn(const numeric &other) const
Numerical division method.
const numeric power(const numeric &other) const
Numerical exponentiation.
ex real_part() const override
int compare(const numeric &other) const
This method establishes a canonical order on all numbers.
This page is part of the GiNaC
developer's reference. It was generated automatically by doxygen. For
an introduction, see the tutorial.