library(caracas)
n_2 <- as_sym("2") n_pi <- as_sym("pi", declare_symbols = FALSE) # pi is a constant in SymPy x <- sqrt(n_2) * n_pi x N(x) N(x, 5) N(x, 50) as.character(N(x, 50))
As SymPy requires mpmath this can be used directly, for example like this (example due to Hans W Borchers, thanks!):
SymPy
mpmath
mpmath <- reticulate::import('mpmath') mpmath$mp$dps <- 30 z <- mpmath$mpc(real = '1.0', imag = '63.453') zeta_z <- mpmath$zeta(z) zeta_z as.character(zeta_z$real) as.character(zeta_z$imag)