Skip to content

Instantly share code, notes, and snippets.

@MilkClouds
Created October 18, 2021 11:58
Show Gist options
  • Save MilkClouds/6eda6b86e1c62008195f7b337fa591fb to your computer and use it in GitHub Desktop.
Save MilkClouds/6eda6b86e1c62008195f7b337fa591fb to your computer and use it in GitHub Desktop.
from math import *
N = 6
mu0 = 4 * pi * 1e-7 # ๐œ‡0 = 4๐œ‹ ร— 10โˆ’7 T โˆ™ m/A
w = 2.9e-2 # 2.9cm
d = 11.6e-2 # 11.6cm
n = 550 / (12e-2) # ๊ฐ์€์ˆ˜ 550, ๊ธธ์ด 12cm
l = 12
R = 4.15
M = 20e-3 # 20g, ์กฐ์ •๋‚˜์‚ฌ ์—†์Œ
L = 100 # 100mm
def calc(I, I_sol, y):
return N * mu0 * w * d * n * I * I_sol / sqrt(1 + 4 * (R / l) ** 2) * L / y
D = ["""0 0
0.25 1
0.5 1
0.75 2
1 3
1.25 4
1.5 6
1.75 7
2 9
""", """0 0
0.25 2
0.5 4
0.75 6
1 7
1.25 8
1.5 11
1.75 12
2 14
""", """0 0
0.25 1
0.5 3
0.75 5
1 8
1.25 12
""", """0 0
0.25 2
0.5 5
0.75 10
1 16
""", """0 0
0.25 8
0.5 10
0.75 13
1 22
"""]
FACTOR = 1e5
for i in range(5):
I_sol = 0.2 * (i + 1)
for j in D[i].split('\n'):
if not j: continue
I, y = map(float, j.split())
if y == 0: continue
print(I, calc(I, I_sol, y) * FACTOR)
print()
print(M * 9.80 * 0.0045 * FACTOR)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment