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 3.1.3/Kotlyarov_M/Graphics/M_vs_n.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 3.1.3/Kotlyarov_M/Graphics/T_vs_n.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions 3.1.3/Kotlyarov_M/data/M_vs_n.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import matplotlib.pyplot as plt
import numpy as np

# Ваши данные
n_data = np.array([12, 10, 8, 6, 4])
M_data = np.array([285.45589086, 227.01610218, 214.091918145, 191.0531553, 179.252813355])

# Аппроксимация M = k * n (линейная регрессия без intercept)
k = np.sum(n_data * M_data) / np.sum(n_data**2)
print(f"k = {k:.3f}")

# Погрешность k
N = len(n_data)
residuals = M_data - k * n_data
chi2 = np.sum(residuals**2)
sigma_k = np.sqrt(chi2 / (np.sum(n_data**2) * (N - 1)))

print(f"σ_k = {sigma_k:.3f}")
print(f"k ± σ_k = {k:.3f} ± {sigma_k:.3f}")

# Диапазон для прямой: от 0 до чуть больше максимального n
n_line = np.linspace(0, max(n_data) * 1.1, 100)
M_line = k * n_line

# Построение графика
plt.figure(figsize=(8, 6))
plt.plot(n_line, M_line, label=f'M = ({k:.3f} ± {sigma_k:.3f}) * n', color='red', linestyle='-', linewidth=1.5)
plt.scatter(n_data, M_data, color='blue', s=30, label='Экспериментальные точки', zorder=5)

# Настройки графика
plt.xlabel('n')
plt.ylabel('M, дин*см')
plt.title('Зависимость момента сил от количества шариков')
plt.legend()
plt.grid(True, linestyle='--', alpha=0.6)
plt.xlim(left=0)
plt.ylim(bottom=0)

# Показать график
plt.tight_layout()
plt.savefig('M_vs_n.png', dpi=300)
plt.show()
42 changes: 42 additions & 0 deletions 3.1.3/Kotlyarov_M/data/T_vs_n.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import matplotlib.pyplot as plt
import numpy as np

# Ваши данные
n_data = np.array([12, 10, 8, 6, 4, 3])
T_data = np.array([3.748, 3.158, 2.696, 1.99, 1.35, 1.059])

# Аппроксимация T = k * n (линейная регрессия без intercept)
k = np.sum(n_data * T_data) / np.sum(n_data**2)
print(f"k = {k:.3f}")

# Погрешность k
N = len(n_data)
residuals = T_data - k * n_data
chi2 = np.sum(residuals**2)
sigma_k = np.sqrt(chi2 / (np.sum(n_data**2) * (N - 1)))

print(f"σ_k = {sigma_k:.3f}")
print(f"k ± σ_k = {k:.3f} ± {sigma_k:.3f}")

# Диапазон для прямой: от 0 до чуть больше максимального n
n_line = np.linspace(0, max(n_data) * 1.1, 100)
T_line = k * n_line

# Построение графика
plt.figure(figsize=(8, 6))
plt.plot(n_line, T_line, label=f'T = ({k:.3f} ± {sigma_k:.3f}) * n', color='red', linestyle='-', linewidth=1.5)
plt.scatter(n_data, T_data, color='blue', s=30, label='Экспериментальные точки', zorder=5)

# Настройки графика
plt.xlabel('n')
plt.ylabel('T, с')
plt.title('Зависимость периода крутильных колебаний от количества шариков')
plt.legend()
plt.grid(True, linestyle='--', alpha=0.6)
plt.xlim(left=0)
plt.ylim(bottom=0)

# Показать график
plt.tight_layout()
plt.savefig('T_vs_n.png', dpi=300)
plt.show()
Binary file added 3.1.3/Kotlyarov_M/data/data.xlsx
Binary file not shown.
Binary file added 3.1.3/Kotlyarov_M/main.pdf
Binary file not shown.
326 changes: 326 additions & 0 deletions 3.1.3/Kotlyarov_M/main.tex

Large diffs are not rendered by default.

Binary file added 3.1.3/pdf/Kotlyarov_M.pdf
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 3.2.4+3.2.5/Kotlyarov_M/Pictures/ustanovka1.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 3.2.4+3.2.5/Kotlyarov_M/Pictures/ustanovka2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
512 changes: 512 additions & 0 deletions 3.2.4+3.2.5/Kotlyarov_M/data/ACH_FCH.py

Large diffs are not rendered by default.

Binary file added 3.2.4+3.2.5/Kotlyarov_M/data/C_T.xlsx
Binary file not shown.
Binary file added 3.2.4+3.2.5/Kotlyarov_M/data/Decr_R_1.xlsx
Binary file not shown.
128 changes: 128 additions & 0 deletions 3.2.4+3.2.5/Kotlyarov_M/data/Decr_vs_RSigma.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# script2_Decr_vs_RSigma_with_errors.py
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from scipy import stats
import os

# Создаем папку для графиков, если её нет
graphics_folder = "../Graphics"
os.makedirs(graphics_folder, exist_ok=True)

# --- 1. Чтение данных из Decr_R_1.xlsx ---
try:
df = pd.read_excel('Decr_R_1.xlsx', sheet_name='Sheet1', header=None)
if len(df) < 4:
print("Ошибка: Не хватает данных в Decr_R_1.xlsx (нужны 4 строки).")
exit()

# Пропускаем первую ячейку в каждой строке (текстовый заголовок)
R_sigma_series = df.iloc[0, 1:].dropna() # R_Sigma, Ом
dR_sigma_series = df.iloc[1, 1:].dropna() # погрешность R_Sigma
Theta_series = df.iloc[2, 1:].dropna() # Theta
dTheta_series = df.iloc[3, 1:].dropna() # погрешность Theta

R_sigma_data = R_sigma_series.astype(float).to_numpy()
dR_sigma_data = dR_sigma_series.astype(float).to_numpy()
Theta_data = Theta_series.astype(float).to_numpy()
dTheta_data = dTheta_series.astype(float).to_numpy()

print("Данные успешно загружены из Decr_R_1.xlsx:")
print(f"R_Sigma (Ом): {R_sigma_data}")
print(f"ΔR_Sigma (Ом): {dR_sigma_data}")
print(f"Theta: {Theta_data}")
print(f"ΔTheta: {dTheta_data}")

except FileNotFoundError:
print("Ошибка: Файл 'Decr_R_1.xlsx' не найден.")
exit()
except Exception as e:
print(f"Ошибка при чтении файла Decr_R_1.xlsx: {e}")
import traceback
traceback.print_exc()
exit()

# --- 2. Подготовка данных для графика 1/Theta^2 vs 1/R_Sigma^2 ---
X_data = 1.0 / (R_sigma_data ** 2) # X = 1/R_Sigma^2
Y_data = 1.0 / (Theta_data ** 2) # Y = 1/Theta^2

# Погрешности для X и Y (по правилу дифференцирования)
dX = 2 * dR_sigma_data / (R_sigma_data ** 3) # d(1/R^2)/dR = -2/R^3 → |dX| = 2*dR/R^3
dY = 2 * dTheta_data / (Theta_data ** 3) # d(1/Θ^2)/dΘ = -2/Θ^3 → |dY| = 2*dΘ/Θ^3

print(f"\nВычисленные значения для графика:")
print(f"X = 1/R_Sigma^2: {X_data}")
print(f"Y = 1/Theta^2: {Y_data}")
print(f"Погрешность X: {dX}")
print(f"Погрешность Y: {dY}")

# --- 3. МНК (линейная регрессия y = k*x, через (0,0)) ---
x_data = X_data # X = 1/R_Sigma^2 — ось X
y_data = Y_data # Y = 1/Theta^2 — ось Y

# Наклон k = (sum(x*y)) / (sum(x^2))
k = np.sum(x_data * y_data) / np.sum(x_data * x_data)

# Оценка погрешности наклона
residuals = y_data - k * x_data
ss_res = np.sum(residuals**2)
n = len(x_data)
if n > 1 and np.sum(x_data**2) > 0:
std_err_k = np.sqrt(ss_res / (n - 1)) / np.sqrt(np.sum(x_data**2))
else:
std_err_k = np.nan

# Коэффициент детерминации R^2
ss_tot = np.sum(y_data**2)
r_squared = 1 - (ss_res / ss_tot) if ss_tot > 0 else np.nan

# Расчет R_cr
R_cr_exp = 2 * np.pi * np.sqrt(k) # R_cr = 2π * sqrt(k)
std_err_R_cr = 2 * np.pi * (std_err_k / (2 * np.sqrt(k))) if k > 0 else np.nan

print(f"\nРезультаты МНК (y = k*x, где x=1/R_Sigma^2, y=1/Theta^2):")
print(f"Наклон (k): {k:.6f}")
print(f"Погрешность наклона (σ_k): {std_err_k:.6f}")
print(f"Коэффициент детерминации (R^2): {r_squared:.6f}")
print(f"Экспериментальное R_cr: {R_cr_exp:.2f} Ом")
print(f"Погрешность R_cr: {std_err_R_cr:.2f} Ом")

# --- 4. Построение графика ---
plt.figure(figsize=(10, 6))

# Линия МНК: y = k*x (начинается с (0,0))
x_max_plot = max(x_data) * 1.2
x_fit = np.linspace(0.0, x_max_plot, 100)
y_fit = k * x_fit
legend_text = r'$\frac{1}{\Theta^2} = k \cdot \frac{1}{R_{\Sigma}^2}$'
plt.plot(x_fit, y_fit, 'b-', linewidth=2, label=legend_text)

# Нанесение точек с погрешностями — КРЕСТИКИ!
plt.errorbar(x_data, y_data,
xerr=dX, yerr=dY,
fmt='o', ecolor='red', markersize=6,
capsize=5, capthick=1,
label='Экспериментальные данные')

# Оформление графика
plt.xlabel(r'$\frac{1}{R_{\Sigma}^2}, \text{Ом}^{-2}$')
plt.ylabel(r'$\frac{1}{\Theta^2}$')
plt.title('Зависимость $1/\\Theta^2$ от $1/R_{\\Sigma}^2$ для определения $R_{cr}$')
plt.legend()
plt.grid(True, alpha=0.5)
plt.xlim(0.0, x_max_plot)
plt.ylim(0.0, max(y_data) * 1.2)
plt.tight_layout()

# Сохранение графика
output_filename = 'Decr_vs_RSigma_plot_with_errors.png'
full_output_path = os.path.join(graphics_folder, output_filename)
plt.savefig(full_output_path)
print(f"\nГрафик сохранен в файл: {full_output_path}")

try:
plt.show()
except:
pass
Binary file added 3.2.4+3.2.5/Kotlyarov_M/data/FR_PR.xlsx
Binary file not shown.
123 changes: 123 additions & 0 deletions 3.2.4+3.2.5/Kotlyarov_M/data/Texp_vs_Ttheor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# script2_Texp_vs_Ttheor_manual_cross_v2.py
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from scipy import stats
import os

# Создаем папку для графиков, если её нет
graphics_folder = "../Graphics"
os.makedirs(graphics_folder, exist_ok=True)

# --- 1. Чтение данных из C_T.xlsx ---
try:
df = pd.read_excel('C_T.xlsx', sheet_name='Sheet1', header=None)
if len(df) < 3:
print("Ошибка: Не хватает данных в C_T.xlsx.")
exit()

# Пропускаем первую ячейку в каждой строке (текстовый заголовок)
C_series = df.iloc[0, 1:].dropna()
T_exp_series = df.iloc[1, 1:].dropna() # T_эксп — строка 1
T_theor_series = df.iloc[2, 1:].dropna() # T_теор — строка 2

C_data = C_series.astype(float).to_numpy() # С в нФ
T_exp_data = T_exp_series.astype(float).to_numpy() # T_эксп в мкс
T_theor_data = T_theor_series.astype(float).to_numpy() # T_теор в мкс

print("Данные успешно загружены из C_T.xlsx:")
print(f"C (нФ): {C_data}")
print(f"T_эксп (мкс): {T_exp_data}")
print(f"T_теор (мкс): {T_theor_data}")

except FileNotFoundError:
print("Ошибка: Файл 'C_T.xlsx' не найден.")
exit()
except Exception as e:
print(f"Ошибка при чтении файла C_T.xlsx: {e}")
import traceback
traceback.print_exc()
exit()

# --- 2. Подготовка данных и погрешностей ---
# Погрешности (новые значения)
T_exp_err = 0.01 * T_exp_data # 1% от T_эксп
T_theor_err = 0.0015 * T_theor_data # 0.15% от T_теор

print(f"\nВычисленные значения и погрешности:")
print(f"T_эксп (мкс): {T_exp_data}")
print(f"Погрешность T_эксп (мкс): {T_exp_err}")
print(f"T_теор (мкс): {T_theor_data}")
print(f"Погрешность T_теор (мкс): {T_theor_err}")

# --- 3. МНК (линейная регрессия y = k*x, через (0,0)) ---
x_data = T_theor_data # T_теор — ось X
y_data = T_exp_data # T_эксп — ось Y

# Наклон k = (sum(x*y)) / (sum(x^2))
k = np.sum(x_data * y_data) / np.sum(x_data * x_data)

# Оценка погрешности наклона
residuals = y_data - k * x_data
ss_res = np.sum(residuals**2)
n = len(x_data)
if n > 1 and np.sum(x_data**2) > 0:
std_err_k = np.sqrt(ss_res / (n - 1)) / np.sqrt(np.sum(x_data**2))
else:
std_err_k = np.nan

# Коэффициент детерминации R^2
ss_tot = np.sum(y_data**2)
r_squared = 1 - (ss_res / ss_tot) if ss_tot > 0 else np.nan

print(f"\nРезультаты МНК (y = k*x, где x=T_теор, y=T_эксп):")
print(f"Наклон (k): {k:.6f}")
print(f"Погрешность наклона (σ_k): {std_err_k:.6f}")
print(f"Коэффициент детерминации (R^2): {r_squared:.6f}")

# --- 4. Построение графика ---
plt.figure(figsize=(10, 6))

# Линия МНК: y = k*x (начинается с (0,0))
x_max_plot = max(x_data) * 1.2
x_fit = np.linspace(0.0, x_max_plot, 100)
y_fit = k * x_fit
legend_text = r'$T_{\text{эксп}} = k \cdot T_{\text{теор}}$'
plt.plot(x_fit, y_fit, 'b-', linewidth=2, label=legend_text)

# --- Нанесение точек как крестиков вручную ---
# 1. Рисуем линии погрешностей (как раньше)
# Вертикальные
plt.errorbar(x_data, y_data - T_exp_err, yerr=[T_exp_err, T_exp_err], fmt='none', ecolor='red', linewidth=1.0)
# Горизонтальные
plt.errorbar(x_data - T_theor_err, y_data, xerr=[T_theor_err, T_theor_err], fmt='none', ecolor='red', linewidth=1.0)

# 2. Рисуем чистые крестики (только линии) поверх линий погрешностей
# Используем plt.plot с маркером '+'
# markersize - размер крестика
# markeredgewidth - толщина линии крестика
# color - цвет крестика
plt.plot(x_data, y_data, marker='+', markersize=10, markeredgewidth=2, color='red', linestyle='none', label='Экспериментальные данные')

# Оформление графика
plt.xlabel(r'$T_{\text{теор}}, мкс$')
plt.ylabel(r'$T_{\text{эксп}}, мкс$')
plt.title('Зависимость экспериментального периода от теоретического')
plt.legend()
plt.grid(True, alpha=0.5)
plt.xlim(0.0, x_max_plot)
plt.ylim(0.0, max(y_data) * 1.2)
plt.tight_layout()

# Сохранение графика
output_filename = 'Texp_vs_Ttheor_plot.png'
full_output_path = os.path.join(graphics_folder, output_filename)
plt.savefig(full_output_path)
print(f"\nГрафик сохранен в файл: {full_output_path}")

try:
plt.show()
except:
pass
Binary file added 3.2.4+3.2.5/Kotlyarov_M/data/data.xlsx
Binary file not shown.
Binary file added 3.2.4+3.2.5/Kotlyarov_M/main.pdf
Binary file not shown.
Loading