def mete_upscale_iterative_alt(S, N, doublings):
<EOL>n_arr = np.empty(doublings+<NUM_LIT:1>)<EOL>s_arr = np.empty(doublings+<NUM_LIT:1>)<EOL>for i in range(doublings+<NUM_LIT:1>):<EOL><INDENT>if i == <NUM_LIT:0>:<EOL><INDENT>n_arr[i] = N<EOL>s_arr[i] = S<EOL><DEDENT>else:<EOL><INDENT>SA = s_arr[i-<NUM_LIT:1>]<EOL>n_arr[i] = <NUM_LIT:2> * n_arr[i-<NUM_LIT:1>]<EOL>N2A = n_arr[i]<EOL>def S2A_calc(x, SA, N2A):<EOL><INDENT>return ((SA +<EOL>N2A *<EOL>(<NUM_LIT:1>-x)/(x-x**(N2A+<NUM_LIT:1>)) *<EOL>(<NUM_LIT:1> - (x**N2A)/(N2A+<NUM_LIT:1>))) /<EOL>x**-<NUM_LIT:1>)<EOL><DEDENT>def x_calc(x, SA, N2A):<EOL><INDENT>return (S2A_calc(x,SA,N2A) /<EOL>N2A *<EOL>x*(x**N2A-<NUM_LIT:1>)/(x-<NUM_LIT:1>) -<EOL>(x**N2A * (-lerchphi(x,<NUM_LIT:1>,N2A+<NUM_LIT:1>))-np.log(<NUM_LIT:1>-x)) ) - <NUM_LIT><EOL><DEDENT>x = (optimize.brentq(x_calc, <NUM_LIT>, <NUM_LIT:1>-<NUM_LIT>, args=(SA,N2A),<EOL>xtol=<NUM_LIT>, maxiter=<NUM_LIT:1000>, disp=True) + <NUM_LIT>)<EOL>s_arr[i] = S2A_calc(x,SA,N2A)<EOL><DEDENT><DEDENT>return s_arr<EOL>
This function is used to upscale from the anchor area.

Parameters
----------
S : int or float
    Number of species at anchor scale
N : int or float
    Number of individuals at anchor scale
doublings : int
    Number of doublings of A. Result vector will be length doublings + 1.

Returns
-------
result : ndarray
    1D array of number of species at each doubling