Solution integral $\;\displaystyle \iint \sqrt{\cos^2(x \pi)+\sin^2(y \pi)} \ dx\,dy$ Working on a hobby project: "Circle from (2D) random walk" [SE] and came across this integral:
$$\bar{R}=\int_0^1 \int_0^1 \sqrt{\cos^2(X  \pi)+\sin^2(Y  \pi)} \ dX\,dY$$
My intention is to have the mean vector length of every vector (starting in origin) in a square: $x \in [0,1]$ and $y \in [0,1]$ where: $x=\cos(X  \pi)$ and $y=\sin(Y  \pi)$.
Initial I solved numerical with Python (taking sample of vectors):
import numpy as np

x=np.linspace(-np.pi/2,0,1001)
y=np.linspace(0,np.pi/2,1001)

X,Y =np.meshgrid(x,y)

def radius(x,y):
    return np.sqrt((np.cos(x))**2+(np.sin(y))**2)

z=np.array([radius(x,y) for (x,y) in zip(np.ravel(X), np.ravel(Y))])

print(np.mean(z))

Giving:
$$\bar{R}=0.95802...$$
Solving integral with Wolfram Alpha (online) gives:
integral \sqrt(cos^2(x*pi)+sin^2(y*pi)) dxdy from x=0 to 1 and y=0 to 1

$$\bar{R}=0.958091\ldots$$
Values seems to match and looks like I am taking the mean vector length within square. $X$ and $Y$ are random values between $[0,2]$ in original problem.
Is this integral known? And how to solve for it? I noticed that I can replace $sin^{2}$ for $cos^{2}$ giving:
$$\bar{R}=\int_0^1 \int_0^1 \sqrt{\cos^2(X\pi) + \cos^2(Y\pi)} \ dX\,dY$$
or:
$$\bar{R}=\int_0^1 \int_0^1 \sqrt{\sin^2(X\pi) + \sin^2(Y\pi)} \ dX\,dY$$
Does not help me gain more feeling. I would like to learn more about this integral where to start? And how do solutions (without intervals) look like?

EDIT: original formula without $\cos$ and $\sin$ looks like: $\;\displaystyle \bar{R}=\frac{1}{a^2} \int_0^a \int_0^a \sqrt{x^2+y^2} \ dx\,dy$. Here Wolfram Alpha (online) gives complicated overwhelming formula. Not sure if nice compact solution exists.


The partial answer I posted showed the $pdf$ (probability density function) of $R^{2}-1$ is equal to:
$$R^2-1 \overset{\mathrm{d}}{=} \left\lvert  \dfrac{2}{\pi^{2} R} \cdot K \left( 1- \dfrac{1}{R^{2}}   \right) \right\rvert $$
With $\overset{\mathrm{d}}{=}$ denoting equality in distribution, $K$ the complete elliptic integral and $R$ the vector length.
This distribution can be transformed from $R^{2}-1$ to the distribution of $R$, see: MSE. I have little experience in transformation of $pdf$'s. My level is amateur/hobby and do not know the formal notation first, define: $Y=R^{2}-1$ and $dY/dR=2R$.
$$G(Y)=\int_{-1}^{1} \left\lvert  \dfrac{2}{\pi^{2} Y} \cdot K \left( 1- \dfrac{1}{Y^{2}}   \right) \right\rvert  dY =1 $$
$$G(R)=\int_{0}^{\sqrt{2}} \left\lvert  \dfrac{4R}{\pi^{2} (R^{2}-1 )} \cdot K \left( 1- \dfrac{1}{(R^{2}-1)^{2}}   \right) \right\rvert  dR =1  $$

The function within the integral $g(R)$ is plotted and corresponds to observed data.
The question asks the mean vector length $\bar{R}$, the solution to the integral:
$$\bar{R}=\int_{0}^{1} \int_{0}^{1} \sqrt{\cos^2(X  \pi)+\sin^2(Y  \pi)} \ dX \,dY$$
The $pdf$ of the radius $R$ is found as:
$$g(R)= \left\lvert  \dfrac{4R}{\pi^{2} (R^{2}-1 )} \cdot K \left( 1- \dfrac{1}{(R^{2}-1)^{2}}   \right) \right\rvert  $$
The mean value $\bar{R}$ of this $pdf$ is the solution to the following integral (multiply $pdf$ with $R$ and integrate), see Wiki.
$$\boxed{\bar{R}= \int_{0}^{\sqrt{2}} \left\lvert  \dfrac{4R^{2}}{\pi^{2} (R^{2}-1 )} \cdot K \left( 1- \dfrac{1}{(R^{2}-1)^{2}}   \right) \right\rvert  dR                     }$$
With my available tools I cannot find a nice simple solution. Though integrating $G(R)$ gives a Meijer g function just like mentioned in comments.
When assuming the the red and blue squares (see plot) have the same area I calculated the mean value from both.
$R \in [0,1]$: with mean value $\bar{R}_1=\int_{0}^{1} \left\lvert 2  R \cdot   g(R) \right\rvert \ dR$, note: multiply by $2$ to set half area to $1$. Solution with Wolfram alpha online:
integrate 2*4R^2/(pi^2*(R^2-1))*K(1-1/(R^2-1)^2) dR from R=0 to 1

$$\bar{R}_1=0.737076...$$
$R \in [1,\sqrt{2}]$: with mean value $\bar{R}_2=\int_{1}^{\sqrt{2}} 2  R \cdot   g(R) \ dR$:
integrate 2*4R^2/(pi^2*(R^2-1))*K(1-1/(R^2-1)^2) dR from R=1 to sqrt(2)

$$\bar{R}_2=1.179107...$$
The mean value:
$$\bar{R}=\frac{0.737076...+1.179107...}{2}=0.958092...$$
With this method the same solution is found as the question. So my question is (partial) answered and gained more insight about this integral.
