äx : Returns the actuarial present value of an (immediate) annuity of 1 per time period 
    (whole life annuity-anticipatory). Payable 'm' per year at the beginning of the period
340863
def aax(mt, x, m=1):
    
    return mt.Nx[x] / mt.Dx[x] - (float(m - 1) / float(m * 2))
990844
def _year_from_2digits(short_year, current_year):
        
        if short_year < 100:
            short_year += current_year - (current_year % 100)
            if abs(short_year - current_year) >= 50:
                if short_year < current_year:
                    return short_year + 100
                else:
                    return short_year - 100
        return short_year
1187394
private double phi(long timestampMillis) {
        long timeDiffMillis;
        double meanMillis;
        double stdDeviationMillis;

        synchronized (heartbeatHistory) {
            long lastTimestampMillis = lastHeartbeatMillis;
            if (lastTimestampMillis == NO_HEARTBEAT_TIMESTAMP) {
                return 0.0;
            }

            timeDiffMillis = timestampMillis - lastTimestampMillis;
            meanMillis = heartbeatHistory.mean();
            stdDeviationMillis = ensureValidStdDeviation(heartbeatHistory.stdDeviation());
        }

        return phi(timeDiffMillis, meanMillis + acceptableHeartbeatPauseMillis, stdDeviationMillis);
    }
1051358
def ax(mt, x, m=1):
    
    return (mt.Nx[x] / mt.Dx[x] - 1) + (float(m - 1) / float(m * 2))
1351796
public double getAccruedInterest(LocalDate date, AnalyticModel model) {
		int periodIndex=schedule.getPeriodIndex(date);
		Period period=schedule.getPeriod(periodIndex);
		DayCountConvention dcc= schedule.getDaycountconvention();
		double accruedInterest=getCouponPayment(periodIndex,model)*(dcc.getDaycountFraction(period.getPeriodStart(), date))/schedule.getPeriodLength(periodIndex);
		return accruedInterest;
	}
773042
def average_returns(ts, **kwargs):
    ''' '''
    average_type = kwargs.get('type', 'net')
    if average_type == 'net':
        relative = 0
    else:
        relative = -1  # gross
    #start = kwargs.get('start', ts.index[0])
    #end = kwargs.get('end', ts.index[len(ts.index) - 1])
    #delta = kwargs.get('delta', ts.index[1] - ts.index[0])
    period = kwargs.get('period', None)
    if isinstance(period, int):
        pass
    #else:
        #ts = reIndexDF(ts, start=start, end=end, delta=delta)
        #period = 1
    avg_ret = 1
    for idx in range(len(ts.index)):
        if idx % period == 0:
            avg_ret *= (1 + ts[idx] + relative)
    return avg_ret - 1
873990
long getYearMonthMillis(int year, int month) {
        long millis = getYearMillis(year);
        millis += getTotalMillisByYearMonth(year, month);
        return millis;
    }
508699
def calc_cagr(prices):
    
    start = prices.index[0]
    end = prices.index[-1]
    return (prices.iloc[-1] / prices.iloc[0]) ** (1 / year_frac(start, end)) - 1
1225720
def atan(x, context=None):
    
    return _apply_function_in_current_context(
        BigFloat,
        mpfr.mpfr_atan,
        (BigFloat._implicit_convert(x),),
        context,
    )
855806
int getYear(long instant) {
        long millisIslamic = instant - MILLIS_YEAR_1;
        long cycles = millisIslamic / MILLIS_PER_CYCLE;
        long cycleRemainder = millisIslamic % MILLIS_PER_CYCLE;
        
        int year = (int) ((cycles * CYCLE) + 1L);
        long yearMillis = (isLeapYear(year) ? MILLIS_PER_LONG_YEAR : MILLIS_PER_SHORT_YEAR);
        while (cycleRemainder >= yearMillis) {
            cycleRemainder -= yearMillis;
            yearMillis = (isLeapYear(++year) ? MILLIS_PER_LONG_YEAR : MILLIS_PER_SHORT_YEAR);
        }
        return year;
    }
735116
def period(A,M1,M2):
    

    A *= rsun_cm
    print(A)
    velocity = np.sqrt(grav_const*msun_g*(M1+M2)/A)
    print(old_div(velocity,1.e5))
    
    p = 2.*np.pi * A / velocity

    p  /= (60*60*24.)
    return p
1373591
private static long getPeriodBoundary(long timestamp, RateBucketPeriod period) {
        Calendar lastCal = Calendar.getInstance();
        lastCal.setTimeInMillis(timestamp);
        switch (period) {
        case Second:
            lastCal.set(Calendar.MILLISECOND, 0);
            lastCal.add(Calendar.SECOND, 1);
            return lastCal.getTimeInMillis();
        case Minute:
            lastCal.set(Calendar.MILLISECOND, 0);
            lastCal.set(Calendar.SECOND, 0);
            lastCal.add(Calendar.MINUTE, 1);
            return lastCal.getTimeInMillis();
        case Hour:
            lastCal.set(Calendar.MILLISECOND, 0);
            lastCal.set(Calendar.SECOND, 0);
            lastCal.set(Calendar.MINUTE, 0);
            lastCal.add(Calendar.HOUR_OF_DAY, 1);
            return lastCal.getTimeInMillis();
        case Day:
            lastCal.set(Calendar.MILLISECOND, 0);
            lastCal.set(Calendar.SECOND, 0);
            lastCal.set(Calendar.MINUTE, 0);
            lastCal.set(Calendar.HOUR_OF_DAY, 0);
            lastCal.add(Calendar.DAY_OF_YEAR, 1);
            return lastCal.getTimeInMillis();
        case Month:
            lastCal.set(Calendar.MILLISECOND, 0);
            lastCal.set(Calendar.SECOND, 0);
            lastCal.set(Calendar.MINUTE, 0);
            lastCal.set(Calendar.HOUR_OF_DAY, 0);
            lastCal.set(Calendar.DAY_OF_MONTH, 1);
            lastCal.add(Calendar.MONTH, 1);
            return lastCal.getTimeInMillis();
        case Year:
            lastCal.set(Calendar.MILLISECOND, 0);
            lastCal.set(Calendar.SECOND, 0);
            lastCal.set(Calendar.MINUTE, 0);
            lastCal.set(Calendar.HOUR_OF_DAY, 0);
            lastCal.set(Calendar.DAY_OF_YEAR, 1);
            lastCal.add(Calendar.YEAR, 1);
            return lastCal.getTimeInMillis();
        }
        return Long.MAX_VALUE;
    }
864540
def sec(x, context=None):
    
    return _apply_function_in_current_context(
        BigFloat,
        mpfr.mpfr_sec,
        (BigFloat._implicit_convert(x),),
        context,
    )
457512
long getTotalMillisByYearMonth(int year, int month) {
        if (--month % 2 == 1) {
            month /= 2;
            return month * MILLIS_PER_MONTH_PAIR + MILLIS_PER_LONG_MONTH;
        } else {
            month /= 2;
            return month * MILLIS_PER_MONTH_PAIR;
        }
    }
1008217
def daily_returns(ts, **kwargs):
    '''  '''
    relative = kwargs.get('relative', 0)
    return returns(ts, delta=BDay(), relative=relative)
1153747
def Itaax(mt, x, t):
    
    return (Sx(mt, x) - Sx(mt, x + t)) / Dx(mt, x)
832780
def get_total_paid_for_remaining_stock(self) -> Decimal:
        
        paid = Decimal(0)

        accounts = self.get_holding_accounts()
        for acc in accounts:
            splits = self.get_available_splits_for_account(acc)
            paid += sum(split.value for split in splits)
        return paid