Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The mag_t
type holds an unsigned floating-point number with a
fixed-precision mantissa (30 bits) and an arbitrary-precision exponent
(represented as an fmpz_t
), suited for representing magnitude bounds.
The special values zero and positive infinity are supported, but not
NaN.
Operations that involve rounding will always produce a valid upper
bound, or a lower bound if the function name has the suffix lower. For
performance reasons, no attempt is made to compute the best possible
bounds: in general, a bound may be several ulps larger/smaller than the
optimal bound. Some functions such as mag_set
and mag_mul_2exp_si
are always exact and therefore do not require separate lower versions.
--
A common mistake is to forget computing a lower bound for the argument
of a decreasing function that is meant to be bounded from above, or vice
versa. For example, to compute an upper bound for \((x+1)/(y+1)\), the
parameter x should initially be an upper bound while y should be a
lower bound, and one should do:
For a lower bound of the same expression, x should be a lower bound while y should be an upper bound, and one should do:
Applications requiring floating-point arithmetic with more flexibility
(such as correct rounding, or higher precision) should use the arf_t
type instead. For calculations where a complex alternation between upper
and lower bounds is necessary, it may be cleaner to use arb_t
arithmetic and convert to a mag_t
bound only in the end.
Synopsis
- data Mag = Mag !(ForeignPtr CMag)
- data CMag = CMag CFmpz CMpLimb
- newMag :: IO Mag
- withMag :: Mag -> (Ptr CMag -> IO a) -> IO (Mag, a)
- withNewMag :: (Ptr CMag -> IO a) -> IO (Mag, a)
- mag_init :: Ptr CMag -> IO ()
- mag_clear :: Ptr CMag -> IO ()
- mag_swap :: Ptr CMag -> Ptr CMag -> IO ()
- _mag_vec_init :: CLong -> IO (Ptr CMag)
- _mag_vec_clear :: Ptr CMag -> CLong -> IO ()
- mag_allocated_bytes :: Ptr CMag -> IO CLong
- mag_zero :: Ptr CMag -> IO ()
- mag_one :: Ptr CMag -> IO ()
- mag_inf :: Ptr CMag -> IO ()
- mag_is_special :: Ptr CMag -> IO CInt
- mag_is_zero :: Ptr CMag -> IO CInt
- mag_is_inf :: Ptr CMag -> IO CInt
- mag_is_finite :: Ptr CMag -> IO CInt
- mag_d_log_lower_bound :: CDouble -> CDouble
- mag_d_log_upper_bound :: CDouble -> CDouble
- mag_init_set :: Ptr CMag -> Ptr CMag -> IO ()
- mag_set :: Ptr CMag -> Ptr CMag -> IO ()
- mag_set_d :: Ptr CMag -> CDouble -> IO ()
- mag_set_ui :: Ptr CMag -> CULong -> IO ()
- mag_set_fmpz :: Ptr CMag -> Ptr CFmpz -> IO ()
- mag_set_d_lower :: Ptr CMag -> CDouble -> IO ()
- mag_set_ui_lower :: Ptr CMag -> CULong -> IO ()
- mag_set_fmpz_lower :: Ptr CMag -> Ptr CFmpz -> IO ()
- mag_set_d_2exp_fmpz :: Ptr CMag -> CDouble -> Ptr CFmpz -> IO ()
- mag_set_fmpz_2exp_fmpz :: Ptr CMag -> Ptr CFmpz -> Ptr CFmpz -> IO ()
- mag_set_ui_2exp_si :: Ptr CMag -> CULong -> CLong -> IO ()
- mag_set_d_2exp_fmpz_lower :: Ptr CMag -> CDouble -> Ptr CFmpz -> IO ()
- mag_set_fmpz_2exp_fmpz_lower :: Ptr CMag -> Ptr CFmpz -> Ptr CFmpz -> IO ()
- mag_get_d :: Ptr CMag -> IO CDouble
- mag_get_d_log2_approx :: Ptr CMag -> IO CDouble
- mag_get_fmpq :: Ptr CFmpq -> Ptr CMag -> IO ()
- mag_get_fmpz :: Ptr CFmpz -> Ptr CMag -> IO ()
- mag_get_fmpz_lower :: Ptr CFmpz -> Ptr CMag -> IO ()
- mag_equal :: Ptr CMag -> Ptr CMag -> IO CInt
- mag_cmp :: Ptr CMag -> Ptr CMag -> IO CInt
- mag_cmp_2exp_si :: Ptr CMag -> CLong -> IO CInt
- mag_min :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_max :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_get_str :: Ptr CMag -> IO CString
- mag_print :: Ptr CMag -> IO ()
- mag_fprint :: Ptr CFile -> Ptr CMag -> IO ()
- mag_dump_str :: Ptr CMag -> IO CString
- mag_load_str :: Ptr CMag -> CString -> IO CInt
- mag_dump_file :: Ptr CFile -> Ptr CMag -> IO CInt
- mag_load_file :: Ptr CMag -> Ptr CFile -> IO CInt
- mag_randtest :: Ptr CMag -> Ptr CFRandState -> CLong -> IO ()
- mag_randtest_special :: Ptr CMag -> Ptr CFRandState -> CLong -> IO ()
- mag_add :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_add_ui :: Ptr CMag -> Ptr CMag -> CULong -> IO ()
- mag_add_lower :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_add_ui_lower :: Ptr CMag -> Ptr CMag -> CULong -> IO ()
- mag_add_2exp_fmpz :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO ()
- mag_add_ui_2exp_si :: Ptr CMag -> Ptr CMag -> CULong -> CLong -> IO ()
- mag_sub :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_sub_lower :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_mul_2exp_si :: Ptr CMag -> Ptr CMag -> CLong -> IO ()
- mag_mul_2exp_fmpz :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO ()
- mag_mul :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_mul_ui :: Ptr CMag -> Ptr CMag -> CULong -> IO ()
- mag_mul_fmpz :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO ()
- mag_mul_lower :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_mul_ui_lower :: Ptr CMag -> Ptr CMag -> CULong -> IO ()
- mag_mul_fmpz_lower :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO ()
- mag_addmul :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_div :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_div_ui :: Ptr CMag -> Ptr CMag -> CULong -> IO ()
- mag_div_fmpz :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO ()
- mag_div_lower :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_inv :: Ptr CMag -> Ptr CMag -> IO ()
- mag_inv_lower :: Ptr CMag -> Ptr CMag -> IO ()
- mag_fast_init_set :: Ptr CMag -> Ptr CMag -> IO ()
- mag_fast_zero :: Ptr CMag -> IO ()
- mag_fast_is_zero :: Ptr CMag -> IO CInt
- mag_fast_mul :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_fast_addmul :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_fast_add_2exp_si :: Ptr CMag -> Ptr CMag -> CLong -> IO ()
- mag_fast_mul_2exp_si :: Ptr CMag -> Ptr CMag -> CLong -> IO ()
- mag_pow_ui :: Ptr CMag -> Ptr CMag -> CULong -> IO ()
- mag_pow_fmpz :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO ()
- mag_pow_ui_lower :: Ptr CMag -> Ptr CMag -> CULong -> IO ()
- mag_pow_fmpz_lower :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO ()
- mag_sqrt :: Ptr CMag -> Ptr CMag -> IO ()
- mag_sqrt_lower :: Ptr CMag -> Ptr CMag -> IO ()
- mag_rsqrt :: Ptr CMag -> Ptr CMag -> IO ()
- mag_rsqrt_lower :: Ptr CMag -> Ptr CMag -> IO ()
- mag_hypot :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO ()
- mag_root :: Ptr CMag -> Ptr CMag -> CULong -> IO ()
- mag_log :: Ptr CMag -> Ptr CMag -> IO ()
- mag_log_lower :: Ptr CMag -> Ptr CMag -> IO ()
- mag_neg_log :: Ptr CMag -> Ptr CMag -> IO ()
- mag_neg_log_lower :: Ptr CMag -> Ptr CMag -> IO ()
- mag_log_ui :: Ptr CMag -> CULong -> IO ()
- mag_log1p :: Ptr CMag -> Ptr CMag -> IO ()
- mag_exp :: Ptr CMag -> Ptr CMag -> IO ()
- mag_exp_lower :: Ptr CMag -> Ptr CMag -> IO ()
- mag_expinv :: Ptr CMag -> Ptr CMag -> IO ()
- mag_expinv_lower :: Ptr CMag -> Ptr CMag -> IO ()
- mag_expm1 :: Ptr CMag -> Ptr CMag -> IO ()
- mag_exp_tail :: Ptr CMag -> Ptr CMag -> CULong -> IO ()
- mag_binpow_uiui :: Ptr CMag -> CULong -> CULong -> IO ()
- mag_geom_series :: Ptr CMag -> Ptr CMag -> CULong -> IO ()
- mag_const_pi :: Ptr CMag -> IO ()
- mag_const_pi_lower :: Ptr CMag -> IO ()
- mag_atan :: Ptr CMag -> Ptr CMag -> IO ()
- mag_atan_lower :: Ptr CMag -> Ptr CMag -> IO ()
- mag_cosh :: Ptr CMag -> Ptr CMag -> IO ()
- mag_cosh_lower :: Ptr CMag -> Ptr CMag -> IO ()
- mag_sinh :: Ptr CMag -> Ptr CMag -> IO ()
- mag_sinh_lower :: Ptr CMag -> Ptr CMag -> IO ()
- mag_fac_ui :: Ptr CMag -> CULong -> IO ()
- mag_rfac_ui :: Ptr CMag -> CULong -> IO ()
- mag_bin_uiui :: Ptr CMag -> CULong -> CULong -> IO ()
- mag_bernoulli_div_fac_ui :: Ptr CMag -> CULong -> IO ()
- mag_polylog_tail :: Ptr CMag -> Ptr CMag -> CLong -> CULong -> CULong -> IO ()
- mag_hurwitz_zeta_uiui :: Ptr CMag -> CULong -> CULong -> IO ()
Fixed-precision unsigned floating-point numbers for bounds
Types
Data structure containing the CMag pointer
Mag !(ForeignPtr CMag) |
Instances
Storable CMag Source # | |
Defined in Data.Number.Flint.Arb.Types.FFI |
Memory management
mag_init :: Ptr CMag -> IO () Source #
mag_init x
Initializes the variable x for use. Its value is set to zero.
mag_clear :: Ptr CMag -> IO () Source #
mag_clear x
Clears the variable x, freeing or recycling its allocated memory.
_mag_vec_init :: CLong -> IO (Ptr CMag) Source #
_mag_vec_init n
Allocates a vector of length n. All entries are set to zero.
_mag_vec_clear :: Ptr CMag -> CLong -> IO () Source #
_mag_vec_clear v n
Clears a vector of length n.
mag_allocated_bytes :: Ptr CMag -> IO CLong Source #
mag_allocated_bytes x
Returns the total number of bytes heap-allocated internally by this
object. The count excludes the size of the structure itself. Add
sizeof(mag_struct)
to get the size of the object as a whole.
Special values
mag_is_special :: Ptr CMag -> IO CInt Source #
mag_is_special x
Returns nonzero iff x is zero or positive infinity.
mag_is_finite :: Ptr CMag -> IO CInt Source #
mag_is_finite x
Returns nonzero iff x is not positive infinity (since there is no NaN
value, this function is exactly the logical negation of mag_is_inf
).
Assignment and conversions
mag_init_set :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_init_set res x
Initializes res and sets it to the value of x. This operation is always exact.
mag_set :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_set res x
Sets res to the value of x. This operation is always exact.
mag_set_fmpz :: Ptr CMag -> Ptr CFmpz -> IO () Source #
mag_set_fmpz res x
Sets res to an upper bound for \(|x|\). The operation may be inexact even if x is exactly representable.
mag_set_fmpz_lower :: Ptr CMag -> Ptr CFmpz -> IO () Source #
mag_set_fmpz_lower res x
Sets res to a lower bound for \(|x|\). The operation may be inexact even if x is exactly representable.
mag_set_ui_2exp_si :: Ptr CMag -> CULong -> CLong -> IO () Source #
mag_set_ui_2exp_si res x y
Sets res to an upper bound for \(|x| \cdot 2^y\).
mag_set_fmpz_2exp_fmpz_lower :: Ptr CMag -> Ptr CFmpz -> Ptr CFmpz -> IO () Source #
mag_set_fmpz_2exp_fmpz_lower res x y
Sets res to a lower bound for \(|x| \cdot 2^y\).
mag_get_d :: Ptr CMag -> IO CDouble Source #
mag_get_d x
Returns a double giving an upper bound for x.
mag_get_d_log2_approx :: Ptr CMag -> IO CDouble Source #
mag_get_d_log2_approx x
Returns a double approximating \(\log_2(x)\), suitable for estimating magnitudes (warning: not a rigorous bound). The value is clamped between COEFF_MIN and COEFF_MAX.
mag_get_fmpz_lower :: Ptr CFmpz -> Ptr CMag -> IO () Source #
mag_get_fmpz_lower res x
Sets res, respectively, to the exact rational number represented by x, the integer exactly representing the ceiling function of x, or the integer exactly representing the floor function of x.
These functions are unsafe: the user must check in advance that x is of reasonable magnitude. If x is infinite or has a bignum exponent, an abort will be raised. If the exponent otherwise is too large or too small, the available memory could be exhausted resulting in undefined behavior.
Comparisons
mag_equal :: Ptr CMag -> Ptr CMag -> IO CInt Source #
mag_equal x y
Returns nonzero iff x and y have the same value.
mag_cmp :: Ptr CMag -> Ptr CMag -> IO CInt Source #
mag_cmp x y
Returns negative, zero, or positive, depending on whether x is smaller, equal, or larger than y.
mag_cmp_2exp_si :: Ptr CMag -> CLong -> IO CInt Source #
mag_cmp_2exp_si x y
Returns negative, zero, or positive, depending on whether x is smaller, equal, or larger than \(2^y\).
mag_max :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO () Source #
mag_max res x y
Sets res respectively to the smaller or the larger of x and y.
Input and output
mag_get_str :: Ptr CMag -> IO CString Source #
mag_get_str x Returns a string representation of x. The memory needs to be deallocated with flint_free
mag_dump_str :: Ptr CMag -> IO CString Source #
mag_dump_str x
Allocates a string and writes a binary representation of x to it that
can be read by mag_load_str
. The returned string needs to be
deallocated with flint_free.
mag_load_str :: Ptr CMag -> CString -> IO CInt Source #
mag_load_str x str
Parses str into x. Returns a nonzero value if str is not formatted correctly.
mag_dump_file :: Ptr CFile -> Ptr CMag -> IO CInt Source #
mag_dump_file stream x
Writes a binary representation of x to stream that can be read by
mag_load_file
. Returns a nonzero value if the data could not be
written.
mag_load_file :: Ptr CMag -> Ptr CFile -> IO CInt Source #
mag_load_file x stream
Reads x from stream. Returns a nonzero value if the data is not
formatted correctly or the read failed. Note that the data is assumed to
be delimited by a whitespace or end-of-file, i.e., when writing multiple
values with mag_dump_file
make sure to insert a whitespace to separate
consecutive values.
Random generation
mag_randtest :: Ptr CMag -> Ptr CFRandState -> CLong -> IO () Source #
mag_randtest res state expbits
Sets res to a random finite value, with an exponent up to expbits bits large.
mag_randtest_special :: Ptr CMag -> Ptr CFRandState -> CLong -> IO () Source #
mag_randtest_special res state expbits
Like mag_randtest
, but also sometimes sets res to infinity.
Arithmetic
mag_add_ui :: Ptr CMag -> Ptr CMag -> CULong -> IO () Source #
mag_add_ui res x y
Sets res to an upper bound for \(x + y\).
mag_add_ui_lower :: Ptr CMag -> Ptr CMag -> CULong -> IO () Source #
mag_add_ui_lower res x y
Sets res to a lower bound for \(x + y\).
mag_add_2exp_fmpz :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO () Source #
mag_add_2exp_fmpz res x e
Sets res to an upper bound for \(x + 2^e\).
mag_add_ui_2exp_si :: Ptr CMag -> Ptr CMag -> CULong -> CLong -> IO () Source #
mag_add_ui_2exp_si res x y e
Sets res to an upper bound for \(x + y 2^e\).
mag_sub :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO () Source #
mag_sub res x y
Sets res to an upper bound for \(\max(x-y, 0)\).
mag_sub_lower :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO () Source #
mag_sub_lower res x y
Sets res to a lower bound for \(\max(x-y, 0)\).
mag_mul_2exp_fmpz :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO () Source #
mag_mul_2exp_fmpz res x y
Sets res to \(x \cdot 2^y\). This operation is exact.
mag_mul_fmpz :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO () Source #
mag_mul_fmpz res x y
Sets res to an upper bound for \(xy\).
mag_mul_fmpz_lower :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO () Source #
mag_mul_fmpz_lower res x y
Sets res to a lower bound for \(xy\).
mag_addmul :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO () Source #
mag_addmul z x y
Sets z to an upper bound for \(z + xy\).
mag_div_fmpz :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO () Source #
mag_div_fmpz res x y
Sets res to an upper bound for \(x / y\).
mag_div_lower :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO () Source #
mag_div_lower res x y
Sets res to a lower bound for \(x / y\).
mag_inv :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_inv res x
Sets res to an upper bound for \(1 / x\).
mag_inv_lower :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_inv_lower res x
Sets res to a lower bound for \(1 / x\).
Fast, unsafe arithmetic
mag_fast_init_set :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_fast_init_set x y
Initialises x and sets it to the value of y.
mag_fast_mul :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO () Source #
mag_fast_mul res x y
Sets res to an upper bound for \(xy\).
mag_fast_addmul :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO () Source #
mag_fast_addmul z x y
Sets z to an upper bound for \(z + xy\).
mag_fast_add_2exp_si :: Ptr CMag -> Ptr CMag -> CLong -> IO () Source #
mag_fast_add_2exp_si res x e
Sets res to an upper bound for \(x + 2^e\).
mag_fast_mul_2exp_si :: Ptr CMag -> Ptr CMag -> CLong -> IO () Source #
mag_fast_mul_2exp_si res x e
Sets res to an upper bound for \(x 2^e\).
Powers and logarithms
mag_pow_fmpz :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO () Source #
mag_pow_fmpz res x e
Sets res to an upper bound for \(x^e\).
mag_pow_fmpz_lower :: Ptr CMag -> Ptr CMag -> Ptr CFmpz -> IO () Source #
mag_pow_fmpz_lower res x e
Sets res to a lower bound for \(x^e\).
mag_sqrt :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_sqrt res x
Sets res to an upper bound for \(\sqrt{x}\).
mag_sqrt_lower :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_sqrt_lower res x
Sets res to a lower bound for \(\sqrt{x}\).
mag_rsqrt :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_rsqrt res x
Sets res to an upper bound for \(1/\sqrt{x}\).
mag_rsqrt_lower :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_rsqrt_lower res x
Sets res to an lower bound for \(1/\sqrt{x}\).
mag_hypot :: Ptr CMag -> Ptr CMag -> Ptr CMag -> IO () Source #
mag_hypot res x y
Sets res to an upper bound for \(\sqrt{x^2 + y^2}\).
mag_root :: Ptr CMag -> Ptr CMag -> CULong -> IO () Source #
mag_root res x n
Sets res to an upper bound for \(x^{1/n}\).
mag_log :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_log res x
Sets res to an upper bound for \(\log(\max(1,x))\).
mag_log_lower :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_log_lower res x
Sets res to a lower bound for \(\log(\max(1,x))\).
mag_neg_log :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_neg_log res x
Sets res to an upper bound for \(-\log(\min(1,x))\), i.e. an upper bound for \(|\log(x)|\) for \(x \le 1\).
mag_neg_log_lower :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_neg_log_lower res x
Sets res to a lower bound for \(-\log(\min(1,x))\), i.e. a lower bound for \(|\log(x)|\) for \(x \le 1\).
mag_log_ui :: Ptr CMag -> CULong -> IO () Source #
mag_log_ui res n
Sets res to an upper bound for \(\log(n)\).
mag_log1p :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_log1p res x
Sets res to an upper bound for \(\log(1+x)\). The bound is computed accurately for small x.
mag_exp :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_exp res x
Sets res to an upper bound for \(\exp(x)\).
mag_exp_lower :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_exp_lower res x
Sets res to a lower bound for \(\exp(x)\).
mag_expinv :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_expinv res x
Sets res to an upper bound for \(\exp(-x)\).
mag_expinv_lower :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_expinv_lower res x
Sets res to a lower bound for \(\exp(-x)\).
mag_expm1 :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_expm1 res x
Sets res to an upper bound for \(\exp(x) - 1\). The bound is computed accurately for small x.
mag_exp_tail :: Ptr CMag -> Ptr CMag -> CULong -> IO () Source #
mag_exp_tail res x N
Sets res to an upper bound for \(\sum_{k=N}^{\infty} x^k / k!\).
mag_binpow_uiui :: Ptr CMag -> CULong -> CULong -> IO () Source #
mag_binpow_uiui res m n
Sets res to an upper bound for \((1 + 1/m)^n\).
mag_geom_series :: Ptr CMag -> Ptr CMag -> CULong -> IO () Source #
mag_geom_series res x N
Sets res to an upper bound for \(\sum_{k=N}^{\infty} x^k\).
Special functions
mag_const_pi_lower :: Ptr CMag -> IO () Source #
mag_const_pi_lower res
Sets res to an upper (respectively lower) bound for \(\pi\).
mag_atan_lower :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_atan_lower res x
Sets res to an upper (respectively lower) bound for \(\operatorname{atan}(x)\).
mag_sinh_lower :: Ptr CMag -> Ptr CMag -> IO () Source #
mag_sinh_lower res x
Sets res to an upper or lower bound for \(\cosh(x)\) or \(\sinh(x)\).
mag_fac_ui :: Ptr CMag -> CULong -> IO () Source #
mag_fac_ui res n
Sets res to an upper bound for \(n!\).
mag_rfac_ui :: Ptr CMag -> CULong -> IO () Source #
mag_rfac_ui res n
Sets res to an upper bound for \(1/n!\).
mag_bin_uiui :: Ptr CMag -> CULong -> CULong -> IO () Source #
mag_bin_uiui res n k
Sets res to an upper bound for the binomial coefficient \({n \choose k}\).
mag_bernoulli_div_fac_ui :: Ptr CMag -> CULong -> IO () Source #
mag_bernoulli_div_fac_ui res n
Sets res to an upper bound for \(|B_n| / n!\) where \(B_n\) denotes a Bernoulli number.
mag_polylog_tail :: Ptr CMag -> Ptr CMag -> CLong -> CULong -> CULong -> IO () Source #
mag_polylog_tail res z s d N
Sets res to an upper bound for
\[`\] \[\sum_{k=N}^{\infty} \frac{z^k \log^d(k)}{k^s}.\]
The bounding strategy is described in algorithms_polylogarithms
. Note:
in applications where \(s\) in this formula may be real or complex, the
user can simply substitute any convenient integer \(s'\) such that
\(s' \le \operatorname{Re}(s)\).
mag_hurwitz_zeta_uiui :: Ptr CMag -> CULong -> CULong -> IO () Source #
mag_hurwitz_zeta_uiui res s a
Sets res to an upper bound for \(\zeta(s,a) = \sum_{k=0}^{\infty} (k+a)^{-s}\). We use the formula
\[`\] \[\zeta(s,a) \le \frac{1}{a^s} + \frac{1}{(s-1) a^{s-1}}\]
which is obtained by estimating the sum by an integral. If \(s \le 1\) or \(a = 0\), the bound is infinite.