scbt

Untitled

Sep 21st, 2021
659
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from tkinter import Tk, Canvas
  2. from math import pi, cos, sin, sqrt
  3. import numpy as np
  4. a = float(input('Введите a'))
  5. root = Tk()
  6. width = 500
  7. height = 500
  8. canvas = Canvas(root, width=500, height=500)
  9. for t in np.arange(0, 2*pi, 0.01):
  10.     x = (a*sqrt(2)*cos(t) / 2) / (1 + (sin(t))**2)
  11.     y = (a*sqrt(2)*cos(t)*sin(t) / 2) / (1 + (sin(t))**2)
  12.     new_x = x * width / 3
  13.     new_y = y * width / 3
  14.     canvas.create_oval(width / 2 + new_x, width / 2 + new_y,
  15.                       width / 2 + new_x, width / 2 + new_y,
  16.                       width=2)
  17. canvas.pack()
  18. root.mainloop()
RAW Paste Data