Issue
I am trying to display a 2D numpy array of floats but whenever I print, the array is only printed as whole numbers. Is there any way I can display the full float?
I know I can get rid of np.array but I want the array to be displayed vertically.
import numpy as np
MPass = 100
MPL = 25
ME = 120
Mwob = ME + MPL + MPass
rho = 1.225
g = 9.8
R = 0.3
pi = 3.14159
A = pi * R** 2
Aduct = 1.5 * A
Wwob = Mwob * g
Mb = 300
e = 400
Nfan = 12
w, h = 4, 101
X = np.array([[0 for x in range(w)] for y in range(h)])
x = 0
while Mb < 401:
Wb = Mb * g
Wt = Wb + Wwob
Mt = Mb + Mwob
Pav = e * Mb
Pav_fan = Pav/Nfan
vi = (Pav_fan/(2*rho*Aduct))**(1/3)
Tmax_fan = 2 * rho * Aduct * vi**2
Ttmax = Tmax_fan * Nfan
Fnet = Ttmax - Wt
X[x][0] = Mb
X[x][1] = Fnet
X[x][2] = Mt
a = Fnet/Mt
if a < 0:
t = 0
else:
t = ((2*762)/a)**0.5
X[x][3] = t
x = x + 1
Mb = Mb + 1
print(X)
Solution
Change the
X = np.array([[0 for x in range(w)] for y in range(h)])
to
X = np.array([[0 for x in range(w)] for y in range(h)], dtype=float)
Hope this is helpful! :D
Answered By - PumpkinQ
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.