Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added fig_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fig_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fig_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fig_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fig_task1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fig_task2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fig_task3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fig_task4_spiral.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fig_task4log.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions lab_6_task1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import matplotlib.pyplot as plt

x = [1, 1, 5, 5, 1]
y = [1, 5, 5, 1, 1]

plt.plot(x, y)
plt.axis('equal')
plt.savefig('fig_task1.png')
25 changes: 25 additions & 0 deletions lab_6_task2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import matplotlib.pyplot as plt
import numpy as np

def hyper(minimum, maximum, N):
N = int(N/2)

x = np.linspace(0, maximum, N+1)
x = np.delete(x, 0)
y = 20/x
plt.plot(x, y, color='b', label="my hyperbola")

x = np.linspace(minimum, 0, N+1)
x = np.delete(x, -1)
y = 20/x
plt.plot(x, y, color='b')

plt.xlabel("Coord - x")
plt.ylabel("Coord - y")
plt.title("Parabola")
plt.legend()
plt.grid()

plt.savefig('fig_task2.png')

hyper(int(input("Введите значение минимума х: ")), int(input("Введите значение максимума х: ")), int(input("Введите значение N: ")))
17 changes: 17 additions & 0 deletions lab_6_task3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import matplotlib.pyplot as plt
import numpy as np


def ellipse(a, b, minimum,maximum, N):

x = np.linspace(minimum, maximum, N)
y = np.linspace(minimum, maximum, N)

X, Y = np.meshgrid(x, y)

fxy = (X**2)/(a**2) + (Y**2)/(b**2) - 1

plt.contour(X, Y, fxy, levels=[0])
plt.savefig('fig_task3.png')

ellipse(int(input("Введите значение большой полуоси: ")), int(input("Введите значение малой полуоси: ")), int(input("Введите значение минимального значения Х: ")), int(input("Введите значение максимального значения Х: ")), int(input("Введите значение N: ")))
23 changes: 23 additions & 0 deletions lab_6_task4log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import matplotlib.pyplot as plt
import numpy as np

# Уравнение логарифмической спирали в полярных координатах: ρ = a * exp(b * θ)
a = 1 # Масштабный коэффициент
b = 0.2 # Коэффициент, определяющий крутизну спирали

theta = np.linspace(0, 10*np.pi, 500) # Угол от 0 до 10π
rho = a * np.exp(b * theta)

# Преобразование в декартовы координаты
x = rho * np.cos(theta)
y = rho * np.sin(theta)

# Построение графика
plt.figure(figsize=(8, 8))
plt.plot(x, y)
plt.title('Логарифмическая спираль')
plt.xlabel('x')
plt.ylabel('y')
plt.grid(True)
plt.gca().set_aspect('equal', adjustable='box') # Для правильного отображения
plt.savefig('fig_task4log.png')
20 changes: 20 additions & 0 deletions lab_6_task4spiral.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import matplotlib.pyplot as plt
import numpy as np

def spiral(k):
phi = np.arange(0, 8*(np.pi), 0.1)
r = k * phi
x = r * np.cos(phi)
y = r * np.sin(phi)

plt.plot(x, y, label="Архимедоа спираль")
plt.xlabel("Coord - x")
plt.ylabel("Coord - y")
plt.title("Архимедоа спираль")
plt.legend()
plt.grid()
plt.axis('equal')

plt.savefig('fig_task4_spiral.png')

spiral(float(input("Введите значение k: ")))
6 changes: 6 additions & 0 deletions less_6_matplotlib.pyplot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

import matplotlib.pyplot as plt

# Построение графика по точкам
plt.plot([1, 2, 3], [5, 7, 10])
plt.savefig('fig_1.png') # Сохранение графика
23 changes: 23 additions & 0 deletions less_6_Неявное задание.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

import matplotlib.pyplot as plt
import numpy as np


def circle_plotter(R=10):

x = np.arange(-2*R, 2*R, 0.1)
y = np.arange(-2*R, 2*R, 0.1)

# Переход к неявнозаданным координатам
X, Y = np.meshgrid(x, y)

fxy = X**2 + Y**2 - R**2 # Уравнение окружности

# Команда рисования
plt.contour(X, Y, fxy, levels=[0])

plt.savefig('fig_4.png')


if __name__ == '__main__':
circle_plotter()
15 changes: 15 additions & 0 deletions less_6_Украшательства.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import matplotlib.pyplot as plt

x = [3, 8, 5]
y = [7, 4, 9]

plt.plot(x, y, color='g', label='Graf 1', marker='>', ms=5)
plt.plot(y, x, color='r', label='Graf 2', marker='o', ms=3)

# --- Украшательства ---
plt.xlabel('Coord: x') # Подись оси ОХ
plt.ylabel('Coord: y') # Подпись оси ОУ
plt.legend() # Вызов "легенды"
plt.title('Base') # Общая подпись графика
plt.grid() # Подключение сетки
plt.savefig('fig_2.png')
21 changes: 21 additions & 0 deletions less_6_Явное задание.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

import matplotlib.pyplot as plt
import numpy as np


def parabola_plotter(a=1, b=1, c=0):

x = np.arange(-10, 10, 0.01)
y = a*x**2 + b*x + c

plt.plot(x, y, label='my parabola')
plt.xlabel('coord - x')
plt.ylabel('coord - y')
plt.title('Parabola plotter')
plt.legend()

plt.savefig('fig_3.png')


if __name__ == '__main__':
parabola_plotter()