File:The function sin(1 over x) with 2epsilon-2delta-rectangle.svg

Summary

Description
English: The function with together with a rectangle around with width and height for and .
Date
Source Own work
Author Stephan Kulla (User:Stephan Kulla)
Other versions
SVG development
InfoField
Source code
InfoField

Python code

import matplotlib.pyplot as plt
import numpy as np

from matplotlib.patches import Rectangle
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes, mark_inset

blue="#007ec1"
eps = 0.5
delta = 0.2

def rec():
    return Rectangle(
        (-delta,-eps), 2*delta, 2*eps, edgecolor="black",
        linestyle="solid", facecolor="#dddddd", lw=1.5
    )

xs1 = np.linspace(-3, 3, 10001)
xs2=1/(np.arange(1.,1001,1.)*np.pi/2)

xs = np.union1d(np.union1d(xs1,xs2),-xs2)
ys = np.sin(1/xs)

f, ax = plt.subplots()

ax.plot(xs,ys, color=blue)
ax.set_xlim(-2.5,2.5)
ax.set_ylim(-2,2)

axins = zoomed_inset_axes(ax,1.7,loc=4)
axins.plot(xs,ys)
axins.set_xlim(-0.3,0.3)
axins.set_ylim(-1.1,1.1)
axins.add_patch(rec())

mark_inset(ax, axins, loc1=3, loc2=2, fc="0.95", ec="0.7")
ax.add_patch(rec())

plt.xticks(visible=False)
plt.yticks(visible=False)

plt.savefig("The function sin(1 over x) with 2epsilon-2delta-rectangle.svg")

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#The%20function%20sin(1%20over%20x)%20with%202epsilon-2delta-rectangle.svg
Category:Self-published work Category:Topologist's sine curve Category:SVG trigonometric functions
Category:CC-Zero Category:SVG trigonometric functions Category:Self-published work Category:Topologist's sine curve Category:Valid SVG created with Matplotlib code