Python Forum
define certain array elements+display with digits
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
define certain array elements+display with digits
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Formula with elements of list - If-condition regarding the lists elements lewielewis 2 2,702 May-08-2020, 01:41 PM
Last Post: nnk
  How to prepare a NumPy array which include float type array elements subhash 0 1,884 Mar-02-2020, 06:46 AM
Last Post: subhash
  Checking the elements of a matrix with an elements of a list juniorcoder 11 5,752 Sep-17-2018, 03:02 PM
Last Post: gruntfutuk
  How do you change specific elements in a char array of string? JoeB 4 6,472 Oct-31-2017, 09:50 AM
Last Post: JoeB
  How can i convert a string to an array with elements type float 64 zoya2385 3 6,081 May-11-2017, 03:57 PM
Last Post: nilamo
  How to sum elements of same position in n dimensional array Felipe 2 4,066 May-11-2017, 10:33 AM
Last Post: Felipe

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020