File:Asymptote02 vectorial.svg
← Older revision
Revision as of 23:13, 20 March 2013
Line 13:
Line 13:
{{self|cc-by-sa-3.0}}
{{self|cc-by-sa-3.0}}
+
==Source code ([[:en:Python_(programming_language)|Python]])==
+
+
# -*- coding: utf-8 -*-
+
#
+
# Script to generate an asymptote curve.
+
#
+
# **************************************************************
+
# Example of a curve with its asymptote
+
# shows that the curve may intersect the asymptote,
+
# in this case an infinite amount of times.
+
# **************************************************************
+
#
+
# Guillaume Jacquenot
+
# 2013 03 20
+
+
import numpy as np
+
import matplotlib
+
from matplotlib.pyplot import figure, show, rc, grid
+
+
def makePlot(outputFilename = r'Asymptote02.svg'):
+
rc('grid', linewidth = 1, linestyle = '-', color = '#a0a0a0')
+
rc('xtick', labelsize = 15)
+
rc('ytick', labelsize = 15)
+
rc('font',**{'family':'serif','serif':['Palatino'],'size':15})
+
rc('text', usetex=True)
+
+
fig = figure()
+
ax = fig.add_axes([0.12, 0.12, 0.76, 0.76])#axisbg='#d5de9c'
+
n = 8
+
t = np.concatenate([np.arange(0.07,2.0,0.01), np.arange(2.0,12.0,0.05)])
+
x = t + np.cos(14*t)/t
+
y = t + np.sin(14*t)/t
+
ax.plot(x, y, color='#ee8d18', lw = 2)
+
ax.plot([-4,12], [-4,12], lw = 1, ls = '--', color = 'k')
+
ax.set_aspect('equal')
+
grid(True)
+
ax.set_xlabel('$x$')
+
ax.set_ylabel('$y$',rotation=0)
+
ax.set_title(r'$x=t+\frac{\cos(nt)}{t}, y=t+\frac{\sin(nt)}{t}, t>0, n = 8$',
+
fontsize=15)
+
fig.savefig(outputFilename)
+
fig.show()
+
+
makePlot()
+
[[Category:Uploaded with UploadWizard]]
[[Category:Uploaded with UploadWizard]]