Help with plotting of iterative function

Hi!

I’m very new to Python and I’m trying to plot this graph. For some reason if n > 2 in the function approx_ln(x,n) the y-axis gets too big and the graph starts looking like an up side down L. Does anyone have an idea about what’s going on here?

All help is very much appreciated!

Here’s my code:

from numpy import *
from matplotlib.pyplot import *

x_axis2=linspace(0,4,200)
y_axis2=[]
def approx_ln(x,n): 
    a0=(1+x)/2
    g0=sqrt(x) 
    for i in range(n): 
        a0=(a0+g0)/2   
        g0=sqrt(a0*g0)
    return (x-1)/a0 
for i in x_axis2:
    y_axis2.append(approx_ln(i,10))

I think I fixed it. I just needed to set x_axis2=linspace(0.1,4,200), so that the function for 0 doesn’t go towards - inf.