I apologize again... I have been confusing about the use of the solar altitude angle $\displaystyle \theta$ vs. the zenith angle $\displaystyle \theta_z$. This changes some $\displaystyle \sin$ into $\displaystyle \cos$ functions (and vice versa) in the functions. See the details and the corrected function in my post above, containing the definition of $\displaystyle f_1(\gamma, \theta_z)$.

The two tests yield:

*Special case 1: *

$\displaystyle \beta = 0$°, $\displaystyle \varphi = 0$°:

In this case, $\displaystyle f_1(\gamma,\theta_z)=\cos \theta_z$, and as $\displaystyle f_1\ge0$ is always true for $\displaystyle \theta_z \in [0,\pi/2]$, the value of the integral is: $\displaystyle g(0,0) = 1$ (checked this by hand).

*Special case 2: *

$\displaystyle \beta = 90$°, $\displaystyle \varphi = 0$°:

In this case, $\displaystyle f_1(\gamma,\theta_z)=\sin \theta_z \cos\gamma$. Here, the condition $\displaystyle f_1(\gamma,\theta_z)\ge0 $ is equivalent to $\displaystyle \gamma \in [-\pi/2,\pi/2]$. Thus, the value of the integral $\displaystyle g(\pi/2,0) = 1/2$ can be easily calculated by hand.

Sorry again for the confusion.

Now the problem should be well-defined...

Jens