This code comes from my last posting.
Can anyone let me please know if there is anything
that is not too clear and how to change it?
In case you are wondering about xx=a0
is because if I write directly cc.append(a0)
I get the following error:
TypeError: 'float' object is not subscriptable.
The way the code looks now,
I get :
cc[1][1]=((cc[0][1] - 4 ** (-k) * cc[0][0])/(1 - 4 ** (-k)))
IndexError: invalid index to scalar variable.
I am trying to plot the results for different values of n and x.
Some help would really be beneficial.
Thank you.
Can anyone let me please know if there is anything
that is not too clear and how to change it?
In case you are wondering about xx=a0
is because if I write directly cc.append(a0)
I get the following error:
TypeError: 'float' object is not subscriptable.
The way the code looks now,
I get :
cc[1][1]=((cc[0][1] - 4 ** (-k) * cc[0][0])/(1 - 4 ** (-k)))
IndexError: invalid index to scalar variable.
I am trying to plot the results for different values of n and x.
Some help would really be beneficial.
Thank you.
def fastln(n, x): a0 =(1 + x) / 2 b0 =x ** (1 / 2) for i in range(n): a0=(a0 + b0) / 2 b0=((a0 * b0) ** (1 / 2)) for i in range(1,n): for k in range(1,n): a0=xx cc=[] cc.append(xx) cc[1][1]=((cc[0][1] - 4 ** (-k) * cc[0][0])/(1 - 4 ** (-k))) return (x - 1)/cc[-1][-1] print(fastln(4,4)) #print(fastln(3,3)) for x in range(1,10): for n in range(1,10): plt.plot((fastln(n,x)))