def injectB(x, dx, dt, yA, phi, thetaB):
    """
    Injection new derived mutations B onto background of A/a
    x - 1D grid
    dx - 1D grid spacing
    dt - integration time step
    yB - biallelic frequency spectrum integrated by dadi
    phi - density function
    thetaB - scaled mutation rate
    """
    phi[(0), 1:-1, (1)] += dt / dx[1] / x[1] ** 2 * yA[1:-1] * (1 - x[1:-1]
        ) * thetaB / 2.0
    phi[(1), 1:-1, (0)] += dt / dx[1] / x[1] ** 2 * yA[1:-1] * x[1:-1
        ] * thetaB / 2.0
    phi[1, 0, 0] += dt / dx[1] * 2 / x[1] ** 2 * yA[1] * x[1] * thetaB / 2.0
    return phi
