Python Forum
define certain array elements+display with digits - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: define certain array elements+display with digits (/thread-25750.html)



define certain array elements+display with digits - lukezo - Apr-10-2020

I have a question about Jupyter arrays. I have a zero array A0 and want to replace say (n-2)-th element with a value defined in previous line in equation.

n=10
A0=np.repeat(0,int(n+1))
lambda_iz=0.05
A0[int(n-2)]=np.array([-4*lambda_iz])

#doesn't work here, but in another vector the same method works!
Further more I need your help with displaying decimal digits of array. I am using following approach, but it doesn't work.

print(A0)
np.set_printoptions(precision=5)
print(A0)

lukezo