@355073677
2016-04-17T10:45:14.000000Z
字数 5044
阅读 1388
计算物理
Name: 陈锋
Student Number: 2013301020145
April 16, 2016
This page is to solve the general form harmonic equation with and analyze the relationship between the initial value of x and the period.
The general form for the equation of motion for harmonic motion is:
For the equation:
Seting the initial value , time step = 0.04s
Figure 1: In this case, the Euler-Cromer method is as precise as Second-order Runge-Kutta method and Forth-order Runge-Kutta method.
Setting time step = 0.04s, and the initial value change from 0.2 to 1.0:
Figure 2: As the figure showed above, the period becomes longer as the amplitude is decreased and I will give a detail discussion in the next section.
This section is about how to find the period in the numerical results. Firstly, we have set the inital phase as zero, so the initial value became the ampilitude. Secondly, we should make a pragramme which can read all the datum and find out the first point except the initial point where the value is near the ampilitude. The corresponding time is the period we need to find. Generally, we might find two or even more points satisfying the former requirements, then we should make an average over these points in order to get a precise period. As a matter of fact, when the precision is high enough, which means the time step and the difference between the displacement and the ampilitude is sufficiently small, there are a little difference among these points. Thus, I only select the first two points and make an average over them.
The code are as follows:
def find_period(self):
t_period = []
for i in range(len(self.x)):
if abs(self.x[i] - self.x_0) < 0.000001 and self.t[i] > 20*self.dt:
t_period.append(self.t[i])
else:
pass
s = 0
for j in range (2):
s = s + t_period[j]
print "the period is:%f" %(s/2)
return s/2
Result:
Setting the time step = 0.001s
It seems that there is a relationship between the amplitude and the period and I try to figure out such relation via fitting in the next subsection.
General model:
f(x) = a/x
Coefficients (with 95% confidence bounds):
a = 7.415 (7.413, 7.416)
For the equation of angular velocity (x is smaller than 1):
For the equation:
1.Giodano, N.J., Nakanishi, H. Computational Physics. Tsinghua University Press, December 2007.
2.Wikipedia contributors. "Pendulum (mathematics)." Wikipedia, The Free Encyclopedia. Wikipedia, The Free Encyclopedia, 7 Apr. 2016. Web. 16 Apr. 2016.