Sharedworking / academic / research / ovals / ovals.sagewsOpen in CoCalc
Authors: Paul Bryan, William A. Stein
Views : 13
t, u = var('t, u') assume(t>0) avals = [1, 5, 10, 100] gamma_plots = [] eigenfunction_plots = [] orbits = [] gammas = [] eigenfunctions = [] curvatures = [] tangents = [] normals = [] kfs = [] ksqfs = [] kfsqs = [] konfs = [] for a in avals: x(t) = cos(t)/(sin(t)^2 + a^2 * cos(t)^2)^(1/2) y(t) = sin(t)/(sin(t)^2 + a^2 * cos(t)^2)^(1/2) x(t) = a * cos(t) y(t) = sin(t) z = vector([x, y]) f(t) = z.norm() T = (1/f) * z R = matrix([[0, -1], [1,0]]) N = R * T k = ((vector(T.diff())) * N).full_simplify() X(t) = integrate(x(u)/f(u), (u, 0, t)) Y(t) = integrate(y(u)/f(u), (u, 0, t)) Z = vector([X, Y]) orbits += [z] gammas += [Z] tangents += [T] normals += [N] eigenfunctions += [vector([t, f])] curvatures += [vector([t, k])] kfs += [vector([t, (k*f).full_simplify()])] ksqfs += [vector([t, (k^2*f).full_simplify()])] kfsqs += [vector([t, (k*f^2).full_simplify()])] konfs += [vector([t, (k/f).full_simplify()])]
def make_plots(array, thetext, pos, size): P = [parametric_plot(p, (t, 0, 2*pi)) for p in array] #for p in P: p.ticks(ticks=[[0, 2*pi], [p.ymin(), p.ymax()]], tick_formatter=[pi,None]) T = text(thetext, pos, fontsize=size) T.axes(False) return P + [T]
gamma_plots = make_plots(gammas, r"$\gamma$", (1,1), 20) orbit_plots = make_plots(orbits, r"$X$", (1,1), 20) eigenfunction_plots = make_plots(eigenfunctions, r"$f$", (1,1), 20) curvature_plots = make_plots(curvatures, r"$\kappa$", (1,1), 20) kf_plots = make_plots(kfs, r"$\kappa f$", (1,1), 20) ksqf_plots = make_plots(ksqfs, r"$\kappa^2 f$", (1,1), 20) kfsq_plots = make_plots(kfsqs, r"$\kappa f^2$", (1,1), 20) konf_plots = make_plots(konfs, r"$\kappa/f$", (1,1), 20) alabels = [text(r"e = $" + str(a) + "$", (1,1), fontsize=20) for a in avals] + [text(r"", (1,1), fontsize=20)] for a in alabels: a.axes(False)
g = graphics_array([alabels, gamma_plots]) g.show(aspect_ratio=1, axes=False) g.save('ovals_gamma.png', aspect_ratio=1, axes=False)
g = graphics_array([alabels, orbit_plots]) g.show(aspect_ratio=1, axes=False) g.save('ovals_orbit.png', aspect_ratio=1, axes=False)
g = graphics_array([alabels, eigenfunction_plots]) g.show(aspect_ratio=1, axes=False) g.save('ovals_eigenfunctions.png', aspect_ratio=1, axes=False)
g = graphics_array([alabels, curvature_plots]) g.show(aspect_ratio=1, axes=False) g.save('ovals_curvatures.png', aspect_ratio=1, axes=False)
g = graphics_array([alabels, gamma_plots, orbit_plots, eigenfunction_plots, curvature_plots]) g.show(axes=False) g.save("ovals.png", axes=False)
g = graphics_array([alabels, curvature_plots, eigenfunction_plots, kf_plots, ksqf_plots, kfsq_plots, konf_plots]) g.show(ticks=[[], None]) g.save("ovals_curvature_eigenfunction.png", ticks=[[], None])
u = var('u') array = [vector([u, cos(i*u)]) for i in range(0, 3)] P = [parametric_plot(p, (u, 0, 2*pi), ticks = [[0,i], [0,i]]) for p in array] P[1].axes(False) g = graphics_array(P)
g.show()
# Angenent x, y = var('x, y') F(x, y) = cos(y)/cosh(x) angenents = [] for g in gammas: angenents += [vector([t, F(x = g[0], y = g[1]).simplify_full()])] angenent_plots = make_plots(angenents, r"$" + latex(F) + r"$", (1,1), 20)
# Ovals and CSF a = var('a') t = var('s') u = var('u') assume(s>0) x(t) = a * cos(s) y(t) = sin(s) z = vector([x, y]) f(t) = z.norm() T = (1/f) * z R = matrix([[0, -1], [1,0]]) N = R * T k = ((vector(T.diff())) * N).full_simplify() X(t) = integrate(x(u)/f(u), (u, 0, s)) Y(t) = integrate(y(u)/f(u), (u, 0, s)) W = vector([x(s)/f(s), y(s)/f(s)]) Wa = W.diff(a) Za = integrate(Wa(s=u), (u, 0, s)) ZNa = Za * N Z = vector([X, Y])
show(ZNa) show(k)
t  a2cos(s)0scos(u)2sin(u)(a2cos(u)2+sin(u)2)32duacos(t)2+sin(t)20sa2cos(u)3(a2cos(s)2+sin(s)2)32+cos(u)a2cos(u)2+sin(u)2dusin(s)acos(s)2+sin(s)2\displaystyle t \ {\mapsto}\ -\frac{a^{2} \cos\left(s\right) \int_{0}^{s} \frac{\cos\left(u\right)^{2} \sin\left(u\right)}{{\left({\left| a \right|}^{2} {\left| \cos\left(u\right) \right|}^{2} + \sin\left(u\right)^{2}\right)}^{\frac{3}{2}}}\,{d u}}{\sqrt{{\left| a \cos\left(t\right) \right|}^{2} + \sin\left(t\right)^{2}}} - \frac{\int_{0}^{s} -\frac{a^{2} \cos\left(u\right)^{3}}{{\left({\left| a \right|}^{2} {\left| \cos\left(s\right) \right|}^{2} + \sin\left(s\right)^{2}\right)}^{\frac{3}{2}}} + \frac{\cos\left(u\right)}{\sqrt{{\left| a \right|}^{2} {\left| \cos\left(u\right) \right|}^{2} + \sin\left(u\right)^{2}}}\,{d u} \sin\left(s\right)}{\sqrt{{\left| a \cos\left(s\right) \right|}^{2} + \sin\left(s\right)^{2}}}
0\displaystyle 0
1\displaystyle 1