Exemple #1
0
def oderhs(t,z, args = (9.81, 628.32, 1000.)):
	g,w0,F_a = args
	n = int((len(z)-4)/5)
	dz = array(zeros(len(z)))
	ind = Index(n)
	ring_state = r_[z[ind.x():ind.y()+1], z[ind.xdot():ind.ydot()+1]]
	F_x = 0
	F_y = F_a

	for j in xrange(0,n):
		rhs, F_xj, F_yj = rhs_ball(r_[z[ind.r(j):ind.theta(j)+1], z[ind.rdot(j):ind.phidot(j)+1]], ring_state, args = (g,w0))
		F_x += F_xj
		F_y += F_yj
		dz[ind.r(j)] = z[ind.rdot(j)]
		dz[ind.theta(j)] = z[ind.thetadot(j)]
		dz[ind.rdot(j):ind.phidot(j)+1] = rhs

	dz[ind.x():ind.y()+1] = z[ind.xdot():ind.ydot()+1]
	dz[ind.xdot()] = F_x/m0
	dz[ind.ydot()] = F_y/m0
	return dz
    subplot(n+1,5,5*i+2) # th
    plot(t, Y[:,ind.theta(i)])

    subplot(n+1,5,5*i+3) # rdot
    plot(t, Y[:,ind.rdot(i)])

    subplot(n+1,5,5*i+4) # thetadot
    plot(t, Y[:,ind.thetadot(i)])

    subplot(n+1,5,5*i+5) # phidot
    plot(t, Y[:,ind.phidot(i)])

subplot(n+1,5,5*n+1)
plot(t, Y[:,ind.x()])
subplot(n+1,5,5*n+2)
plot(t, Y[:,ind.xdot()])
subplot(n+1,5,5*n+3)
plot(t, Y[:,ind.y()])
subplot(n+1,5,5*n+4)
plot(t, Y[:,ind.ydot()])

show()
#
#len0 = len(cv.ts)
#
#t1 = 2*t0
#
#ex_time1 = time.clock()
#cv(t1,numsteps)
#ex_time1 = time.clock() - ex_time1
#