我写了一个模拟代码,我想为我的代码插入初始值。类的初始值,python
some def are here,
class multipole:
def q(self, f1,f2,f3):
t=0.
tm=0.
xp = idistribution(j,m) # initial xp values it is a list of particles velocities
while t< k:
rk(t,m,f1,f2,f3,xp) # calculate new xp value
xp.append(xxp[1])
return xp
def h(self, f1,f2,f3):
t=0.
tm=0.
xp = idistribution(j,m) # initial xp values it is a list of particles velocities
while t< k:
rk(t,m,f1,f2,f3,xp) # calculate new xp value
xp.append(xxp[1])
return xp
if __name__ == "__main__":
qp=multipole()
quxp=qp.q(0.,0.,0.)
hxp=qp.h(0.052,0.,0.)
我的问题是,当我打电话XP = IDIST(J,M),它会返回随机分布离子的速度,但我想用两个类的方法(Q和h)我怎么能做到这一点相同的分布?提前致谢。 (我在蟒蛇新,我试图从一些网页了解它)