0
$\begingroup$

The incomplete elliptic integral of 1st kind is: $$F(\varphi,k)=\int_{0}^{\varphi} \frac{1}{\sqrt{1 - k^2 \sin^2(x)}} \mathrm{d}x$$ I wanted to set a small dataframe in order to plot myself some points of $F(\varphi,k)$ for different $\varphi$ and $k$. Here is the code I imagined:

v.phi <- seq(0, 2*pi, 1)
n.phi <- length(v.phi)
v.k <- seq(-1, +1, 0.5)
n.k <- length(v.k)
k <- rep(v.k, each = n.phi, times = 1)
phi <- rep(v.phi, each = 1, times = n.k)
df <- data.frame(k, phi)
func <- function(x, k) 1/sqrt(1 - (k*sin(x))^2)
df$area <- integrate(func,lower=0, upper=df$phi, k=df$k)

But this generates errors and I am obviously mistaking in constructing the new variable df$area... Could someone put me in the right way?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.