# Sex Allocation in Solitary Bees and Wasps

## The Objective Functions to Minimize

To get the equation that Frank cites on page 317, we can minimize either of the following functions:

$F(\lambda)=\int_0^\lambda f(y)h(y)dy\int_\lambda^1 g(y)h(y)dy$

or

$E(\lambda)=\ln(F(\lambda))=\ln\left(\int_0^\lambda f(y)h(y)dy\right)+\ln\left(\int_\lambda^1 g(y)h(y)dy\right)$

F is probably the more intuitive function: we can see that there's a trade-off point, λ, at which we switch from producing males to producing females. If we think of the two function f(x) and g(x) as "value" functions, with $f(x) \ge g(x)$ over the interval $x \in [0,1]$, and h(x) as the probability density of the resources distribution (taken as a beta density by Frank), then we're saying that we want to maximize the product of the value of the males along with the value of the females. If we take λ = 0 or λ = 1, F(0) = F(1) = 0; because $F(x)\ge 0$, we know that there is a maximum on the interior of the interval [0,1].

If we differentiate either expression, we will ultimately obtain the equation that Frank cites in his text:

$\frac{f(\lambda)}{\int_0^\lambda f(y)h(y)dy}=\frac{g(\lambda)}{\int_\lambda^1 g(y)h(y)dy}$

which we can then solve for λ, given the functions f, g, and h.

F(λ) can be normalized without changing the maximizing value of λ: hence we could use instead

$F(\lambda)=\frac{\int_0^\lambda f(y)h(y)dy\int_\lambda^1 g(y)h(y)dy}{\int_0^1 f(y)h(y)dy\int_0^1 g(y)h(y)dy}=\left(\frac{\int_0^\lambda f(y)h(y)dy}{f_T}\right)\left(\frac{\int_\lambda^1 g(y)h(y)dy}{g_T}\right)$;

hence we can think of F(λ) as the product of the fraction of male value achieved by λ and the fraction of female value achieved from λ on out to the total resource allocation.

## The Minimization with Specific f, g, and h

Assume that f(x) = xr, g(x) = x, and h(x) = κxa(1 - x)a.

We expand $I=\int y^s y^a (1-y)^a dy = \int y^s y^a \left(\sum_{n=0}^a {n \choose k} (-1)^n y^{n}\right) dy$

or

$I=\sum_{n=0}^a {n \choose k} (-1)^n \int y^{n+a+s} dy =\sum_{n=0}^a {n \choose k} (-1)^n \frac{y^{n+a+s+1}}{n+a+s+1}|$

Given our choices of f and g, we want to evaluate

$I_f=\sum_{n=0}^a {n \choose k} (-1)^n \frac{y^{n+a+r+1}}{n+a+r+1}|_0^\lambda = \sum_{n=0}^a {n \choose k} (-1)^n \frac{\lambda^{n+a+r+1}}{n+a+r+1}$

and

$I_g=\sum_{n=0}^a {n \choose k} (-1)^n \frac{y^{n+a+2}}{n+a+2}|_\lambda^1=\sum_{n=0}^a {n \choose k} (-1)^n \frac{1-\lambda^{n+a+2}}{n+a+2}$

Now the equation that we're to solve for λ can be written λrIg = λIf which we can reduce by dividing by λr (since λ = 0 is not a maximum); thus our equation becomes Ig - λ1 - rIf = 0, or

$P(\lambda) = \sum_{n=0}^a {n \choose k} (-1)^n \left(\frac{1-\lambda^{n+a+2}}{n+a+2} - \lambda^{1-r}\frac{\lambda^{n+a+r+1}}{n+a+r+1} \right) = 0$

or

$P(\lambda) = \sum_{n=0}^a {n \choose k} (-1)^n \left(\frac{1-\lambda^{n+a+2}}{n+a+2} - \frac{\lambda^{n+a+2}}{n+a+r+1} \right) = 0$

or

$P(\lambda) = \sum_{n=0}^a {n \choose k} (-1)^n \left( \frac{1}{n+a+2} - \lambda^{n+a+2} \left( \frac{1}{n+a+2}+ \frac{1}{n+a+r+1} \right)\right) = 0$

Here's a little script that shows some of those functions P.