Pendulum_rel_error.svg
Size of this PNG preview of this SVG file:
659 × 509 pixels
.
Other resolutions:
311 × 240 pixels
|
622 × 480 pixels
|
994 × 768 pixels
|
1,280 × 989 pixels
|
2,560 × 1,977 pixels
.
Summary
Description Pendulum rel error.svg |
English:
Relative error in the approximation of the period of oscillation of a pendulum using a power series. The error is a function of the initial angle, for small angles the period does not depend on it.
Español:
Error relativo en la aproximación del período de oscilación de un péndulo usando una serie de potencias. El error es una función del ángulo inicial, para ángulos pequeños el período no depende de este parámetro.
|
Date | |
Source | Own work |
Author | Nicoguaro |
SVG development
InfoField
|
This plot was created with
Matplotlib
.
|
Source code
InfoField
|
Python codefrom __future__ import division
from scipy.special import ellipk, factorial
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams
rcParams['font.size'] = 16
palette= ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33"]
def period(angle):
return 4*ellipk(np.sin(angle/2)**2)
def approx_period(angle, num):
return 2*np.pi*sum((factorial(2*n)/(2**n * factorial(n))**2)**2
* np.sin(angle/2)**(2*n) for n in range(0, num + 1))
theta = np.linspace(0, np.pi/2, 100)
for num in range(0, 6):
rel_error = np.abs(approx_period(theta, num) - period(theta))/period(theta)
plt.plot(theta*180/np.pi, 100*rel_error,
label=r"$T_{%i}$"%(2*num), lw=2, color=palette[num])
plt.xlabel(r"Initial angle (degrees): $\theta_0$ ")
plt.ylabel(r"Relative Error (%): $\left\Vert\frac{T - T_k}{T}\right\Vert \times 100$")
plt.ylim(0, 1)
plt.grid(ls="--", alpha=0.4)
plt.legend(loc="best", fontsize=14, framealpha=0.8)
plt.savefig("Pendulum_rel_error.svg", bbox_inches="tight")
plt.show()
|
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the
Creative Commons
Attribution 4.0 International
license.
-
You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
-
Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.