def maclaurin_ln(value, k):
    """
    Compute maclaurin's series approximation for ln(value).
    """
        
    first_value = 0.0
    
    #attempt to Approximate ln(x) for a given value    
    try:
        value_x = (value - 1)/float(value + 1)
        for item in xrange(1,k,2):
            next_value = value_x **item/item
            first_value += next_value
            
        return 2*(first_value)
    
    #Raise TypeError if input is not a number   
    except TypeError:
        print 'Please enter an integer or a float value'

    Compute maclaurin's series approximation for ln(value).
    
recipes/Python/577300_Maclaurinsserieslnx/recipe-577300.py