[SciPy-User] Sequence not work
El suisse
elsuizo37 at gmail.com
Tue Mar 26 23:11:32 EDT 2013
Hi
I have to represent the following sequence:
[image: z[2]=2]
[image: z[n+1]=2^{n-1/2}\sqrt{1-\sqrt{1-4^{1-n}z[n]^{2}}] [image:
n=2,3,4....]
and my code is as follows:
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
num_muestras = 100
z = np.zeros(num_muestras)
z[2] = 2.0 #En Python se cuenta desde el cero
for n in range(2,num_muestras-1):
z[n+1] = np.power(2,n-(1/2)) * (np.sqrt(1- np.sqrt(1-np.power(4,1-n) *
np.power(z[n],2))) )
fig1 = plt.figure()
ax = plt.gca()
plt.ylabel('$z[n+1]=2^{n-1/2}\sqrt{1-\sqrt{1-4^{1-n}z[n]^{2}}}$')
plt.xlabel('$n$')
plt.grid()
ax.plot(z)
plt.show()
but does not work, z should tend to pi. might be wrong?
thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20130327/e89ca9a4/attachment.html>
More information about the SciPy-User
mailing list