|
Size: 430
Comment:
|
← Revision 3 as of 2010-12-17 12:53:44 ⇥
Size: 831
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 8: | Line 8: |
| A=matrix([[3,1],[2,4]]) D = A[0,0]*A[1,1]-A[0,1]*A[1,0] A=matrix([[A[1,1],-A[0,1]],[-A[1,0],A[0,0]]]) D=1.0/D B=D*A print(B) |
clf() data=array([[0,0],[-1.5,0]]) phi=0 R=array([[cos(phi),-sin(phi)],[sin(phi),cos(phi)]]) data=dot(R, data) axis([-2,2,-2,3]) #print data[0,:], data[1,:] plot(data[0,:],data[1,:]) plot(0,0,'o') theta=pi-pi/1000 thetadot=0 t=0 dt=.2 tfinal=50 while(t<tfinal): t=t+dt theta=theta+thetadot*dt thetadot=thetadot-sin(theta)*dt R=[[cos(theta),-sin(theta)],[sin(theta),cos(theta)]] datanew=dot(R,data) plot(datanew[0,0],datanew[1,0]) #print datanew[0,0],datanew[1,0] plot(datanew[0,:],datanew[1,:]) ylim(-1.5,1.5) show() |
| Line 20: | Line 39: |
| * <Anvesh>, <Student>, <sreenidhi institute of science and technology> * <Your Name>, <Profession>, <Organization> |
* <Anvesh>,<student>,<Sreenidhi Institute of Science and Technology> |
Book
Linear Algebra
Author
Gilbert Strang
Edition
clf()
data=array([[0,0],[-1.5,0]])
phi=0
R=array([[cos(phi),-sin(phi)],[sin(phi),cos(phi)]])
data=dot(R, data)
axis([-2,2,-2,3])
#print data[0,:], data[1,:]
plot(data[0,:],data[1,:])
plot(0,0,'o')
theta=pi-pi/1000
thetadot=0
t=0
dt=.2
tfinal=50
while(t<tfinal):
t=t+dt
theta=theta+thetadot*dt
thetadot=thetadot-sin(theta)*dt
R=[[cos(theta),-sin(theta)],[sin(theta),cos(theta)]]
datanew=dot(R,data)
plot(datanew[0,0],datanew[1,0])
#print datanew[0,0],datanew[1,0]
plot(datanew[0,:],datanew[1,:])
ylim(-1.5,1.5)
show()
Solution by:
<Anvesh>,<student>,<Sreenidhi Institute of Science and Technology>
