The R expression

exp(1)

represents e, and

exp(2)

represents e^2.

This works because exp is the exponentiation function with base e.

Answer from Adam Mihalcin on Stack Overflow
🌐
CRAN
cran.r-project.org › web › packages › eulerr › vignettes › introduction.html
Introducing eulerr
April 20, 2026 - That is, depending on input, eulerr will sometimes produce Venn diagrams but sometimes not. R features several packages that produce Euler diagrams; some of the more prominent ones (on CRAN) are
🌐
Eunoia
eunoia.bz
Eunoia
R users can use eulerr, which is now backed by the same Rust core as Eunoia; docs at jolars.github.io/eulerr.
🌐
CRAN
cran.r-project.org › package=eulerr
eulerr: Area-Proportional Euler and Venn Diagrams with Ellipses
April 21, 2026 - An Euler diagram is a generalization of a Venn diagram, relaxing the criterion that all interactions need to be represented. Diagrams may be fit with ellipses and circles via a wide range of inputs and can be visualized in numerous ways.
🌐
Jolars
jolars.github.io › eulerr › reference › plot.euler.html
Plot Euler and Venn diagrams — plot.euler • eulerr
Defaults for these values, as well as other parameters of the plots, can be set globally using eulerr_options(). If the diagram has been fit using the data.frame or matrix methods and using the by argument, the plot area will be split into panels for each combination of the one to two factors. For users who are looking to plot their diagram using another package, all the necessary parameters can be collected if the result of this function is assigned to a variable (rather than printed to screen).
🌐
RDocumentation
rdocumentation.org › packages › eulerr › versions › 7.0.2 › topics › euler
euler function - RDocumentation
The function minimizes the residual sums of squares, $$ \sum_{i=1}^n (A_i - \omega_i)^2, $$ by default, where \(\omega_i\) the size of the ith disjoint subset, and \(A_i\) the corresponding area in the diagram, that is, the unique contribution to the total area from this overlap. The loss function can, however, be controlled via the loss argument. euler() also returns stress (from venneuler), as well as diagError, and regionError from eulerAPE.
🌐
CRAN
cran.r-project.org › web › packages › eulerr › eulerr.pdf pdf
Area-Proportional Euler and Venn Diagrams with Ellipses
May 8, 2026 - Defaults for these values, as well as other parameters of the plots, can be set globally using eulerr_options(). If the diagram has been fit using the data.frame or matrix methods and using the by argument, the plot area will be split into panels for each combination of the one to two factors. For users who are looking to plot their diagram using another package, all the necessary parameters · can be collected if the result of this function is assigned to a variable (rather than printed to screen).
🌐
Jolars
jolars.github.io › eulerr
Area-Proportional Euler and Venn Diagrams with Ellipses • eulerr
eulerr generates area-proportional Euler diagrams that display set relationships (intersections, unions, and disjoints) with circles or ellipses.
Find elsewhere
🌐
GitHub
github.com › jolars › eulerr
GitHub - jolars/eulerr: Area-Proportional Euler and Venn Diagrams with Ellipses · GitHub
eulerr generates area-proportional Euler diagrams that display set relationships (intersections, unions, and disjoints) with circles or ellipses.
Starred by 143 users
Forked by 20 users
Languages   R 83.5% | Rust 14.3% | TeX 1.8%
🌐
GitHub
github.com › jolars › eulerr › blob › main › R › euler.R
eulerr/R/euler.R at main · jolars/eulerr
Area-Proportional Euler and Venn Diagrams with Ellipses - eulerr/R/euler.R at main · jolars/eulerr
Author   jolars
🌐
CRAN
cran.r-project.org › web › packages › eulerr › vignettes › gallery.html
A Gallery of Euler and Venn Diagrams
This set relationship is taken from Wilkinson et al. It works best with ellipses. wilkinson <- euler( c( A = 4, B = 6, C = 3, D = 2, E = 7, F = 3, "A&B" = 2, "A&F" = 2, "B&C" = 2, "B&D" = 1, "B&F" = 2, "C&D" = 1, "D&E" = 1, "E&F" = 1, "A&B&F" = 1, "B&C&D" = 1 ), shape = "ellipse" ) plot( wilkinson, labels = list(fontfamily = "serif"), edges = list(lty = 3), quantities = list(type = "percent", font = 3) )
🌐
Statistics Globe
statisticsglobe.com › home › learn r programming (tutorial & examples) | free introduction › how to compute euler’s number in r (example)
Compute Euler's Number in R (Example) | Get Mathematical Constant e
March 17, 2022 - The following code illustrates how to get Euler’s number (e) using the exp() function provided by the basic installation of the R programming language.
🌐
CRAN
cran.r-project.org › web › packages › eulerr › refman › eulerr.html
Help for package eulerr
April 21, 2026 - The function minimizes the residual sums of squares, ... by default, where \omega_i the size of the ith disjoint subset, and A_i the corresponding area in the diagram, that is, the unique contribution to the total area from this overlap. The loss function can, however, be controlled via the loss argument. euler() also returns stress (from venneuler), as well as diagError, and regionError from eulerAPE.
🌐
GitHub
github.com › jolars › eulerr › blob › main › R › plot.euler.R
eulerr/R/plot.euler.R at main · jolars/eulerr
Area-Proportional Euler and Venn Diagrams with Ellipses - jolars/eulerr
Author   jolars
🌐
Rdrr.io
rdrr.io › cran › eulerr › src › R › euler.R
eulerr source: R/euler.R
rdrr.io Find an R package R language docs Run R in your browser ... Browse all... ... #' Area-proportional Euler diagrams #' #' Fit Euler diagrams (a generalization of Venn diagrams) using numerical #' optimization to find exact or approximate solutions to a specification of set #' relationships.
🌐
R-bloggers
r-bloggers.com › r bloggers › euler coding challenge: build maths’ most beautiful formula in r
Euler Coding Challenge: Build Maths’ Most Beautiful Formula in R | R-bloggers
July 14, 2021 - In this post, we will first give some intuition for and then demonstrate what is often called the most beautiful formula in mathematics, Euler’s identity, in R – first numerically with base R and then also symbolically, so read on! Euler’s identity (also known as Euler’s equation) is ...
🌐
Quora
quora.com › How-is-Eulers-number-represented-in-R
How is Euler's number represented in R? - Quora
Answer (1 of 3): If you are asking how to represent Euler’s number (e) onto the R console, write : exp(1) and enter! It will show you the value, 2.718282. The exp(n) function returns the value e^n! I hope this is the answer you were looking for!
Top answer
1 of 2
1

Your interest for epedimiological model is a good thing.

To obtain a similar graph as you show, you need to code first the analytical solution of N(t) which is given on the reference web site.

logistic <- function(N0, r, t){
    return(1 / (1 + ((1-N0)/N0) * exp(- r * t)))
}

Moreover you should be careful with absisse informations.

r <- 1
t <- 1:1000
N0 <- 0.03
delta_t <- 0.01
plot(t * delta_t, logistic(N0 = N0, r = r, t = t * delta_t), type = "l",
     ylim = c(0, 1),
     ylab = "N(t)",
     xlab = "times")

lines(t * delta_t, solve_logistic(N0 = N0, times = max(t)),
      col = "red", lty = 2)

It gives you part of the graphic, now you are able to compute error of the method and test with another delta.

The Euler method is a numerical method for EDO resolution based on Taylor expansion like gradient descent algorithm .

solve_logistic <- function(N0, r = 1, delta_t = 0.01, times = 1000) {
  N <- rep(N0, times)
  dN <- function(N) r * N * (1 - N)
  
  for (i in seq(2, times)) {
    # Euler (you follow the deepest slope with a small step delta)
    N[i] <- N[i-1] + delta_t * dN(N[i-1])
  }
  N
}
2 of 2
1

Making the code more generic and modular (separating out the numerical methods), we can plot the solution to the epidemic model initial value problem (differential equation):

Euler_update <- function(xn, delta_t, f) {
  return (xn + delta_t * f(xn))
}

Improved_Euler_update <- function(xn, delta_t, f) {
  k1 <- f(xn) * delta_t
  k2 <- f(xn + k1) * delta_t
  return (xn + 1/2 *  (k1 + k2))
}

Runge_Kutta_4_update <- function(xn, delta_t, f) {
  k1 <- f(xn) * delta_t
  k2 <- f(xn + k1/2) * delta_t
  k3 <- f(xn + k2/2) * delta_t
  k4 <- f(xn + k3) * delta_t
  return (xn + 1/6 * (k1 + 2*k2 + 2*k3 + k4))
}

logistic_function <- function(x, r=1) {
  return (r * x * (1 - x))
}

analytic_solution <- function(x0, ts, r=1) {
  return (1 / (1 + (1-x0)/x0*exp(-r*ts)))  
}

solve_logistic <- function(N0, r = 1, delta_t = 0.01, times = 1000, update_fn=Euler_update) {
  t <- rep(0, times)
  N <- rep(N0, times)
  
  for (i in seq(2, times)) {
    # Euler
    t[i] <- t[i-1] + delta_t
    N[i] <- update_fn(N[i-1], delta_t, logistic_function)
  }
  
  return (list(t, N))
}

solution_df <- NULL
N0 <- 0.1
for (delta_t in c(0.01,0.1,0.5,1,1.25)) {
  sol <- solve_logistic(N0, delta_t=delta_t, times=10/delta_t) #, update_fn = Runge_Kutta_4_update)
  solution_df <- rbind(solution_df, data.frame(delta_t=delta_t, t=sol[[1]], N_t=sol[[2]]))
}
solution_df$delta_t <- as.factor(solution_df$delta_t)
ts <- seq(0,10,0.01)
solution_df <- rbind(solution_df, data.frame(delta_t='analytic', t=ts, N_t=analytic_solution(N0, ts)))

library(dplyr)
library(ggplot2)
solution_df %>% ggplot(aes(t, N_t, col=delta_t)) + geom_line(lwd=1) + theme_bw() + ggtitle('Euler method')

Just by changing the function name for the corresponding algorithm, we can obtain the solution with improved Euler and Runge-Kutta order-4 methods, improving the accuracy (in terms of deviance from the analytic solution) much more and faster convergence,, as shown in the figures below.

🌐
Anaconda.org
anaconda.org › conda-forge › r-eulerr
r-eulerr - conda-forge
April 21, 2026 - View packages from the conda-forge channel on Anaconda.org.
🌐
Rdrr.io
rdrr.io › cran › eulerr › man › plot.euler.html
plot.euler: Plot Euler and Venn diagrams in eulerr: Area-Proportional Euler and Venn Diagrams with Ellipses
May 29, 2024 - Defaults for these values, as well ... using eulerr_options(). If the diagram has been fit using the data.frame or matrix methods and using the by argument, the plot area will be split into panels for each combination of the one to two factors. For users who are looking to plot their diagram using another package, all the necessary parameters can be collected if the result of this function ...