Jump to content

File:Pendulum rel error.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 659 × 509 pixels, file size: 72 KB)

Summary

Description
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
 
The SVG code is valid.
 
This plot was created with Matplotlib.
Source code
InfoField

Python code

from __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:
w:en:Creative Commons
attribution
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.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current17:23, 4 July 2016Thumbnail for version as of 17:23, 4 July 2016659 × 509 (72 KB)NicoguaroUser created page with UploadWizard

The following 2 pages use this file:

Global file usage

The following other wikis use this file:

Metadata