# 원형 단면의 관성 모멘트<br>Area Moment of Inertia of a Circular Section




```python
# 그래프, 수학 기능 추가
# Add graph and math features
import pylab as py
import numpy as np
import numpy.linalg as nl
# 기호 연산 기능 추가
# Add symbolic operation capability
import sympy as sy


```

참고문헌 : <br>
* Pytel 외 저, 이주성 외 역, 재료역학, 2판, 한티미디어, 2013.<br>
* 위키백과 기여자, '단면 이차 모멘트', 위키백과, , 2018년 3월 4일, 13:19 UTC, <https://ko.wikipedia.org/wiki/%EB%8B%A8%EB%A9%B4_%EC%9D%B4%EC%B0%A8_%EB%AA%A8%EB%A9%98%ED%8A%B8> [2018년 7월 31일에 접근] <br>

Ref: <br>
* Pytel, Kiusalaas, Sharma, Mechanics of Materials, 2nd Ed., Cengage Learning, 2013.<br>
* Wikipedia contributors, 'Second moment of area', Wikipedia, The Free Encyclopedia, 16 June 2018, 14:15 UTC, <https://en.wikipedia.org/w/index.php?title=Second_moment_of_area&oldid=846126944> [accessed 31 July 2018] 



다음과 같은 원형 단면의 2차 모멘트를 구해 보자.<br>
Let's try to find the second moment of area of following circular section.



반지름 $r=10mm$<br>Radius of the section $r=10mm$




```python
r_mm = 10


```

## 단면 2차 모멘트의 정의<br>Definition of a Second Moment of Area



$$
I_x=\int_A y^2 dA
$$



여기서 $dA$는 다음과 같다. (원점은 원의 중심에 위치)<br>
Here, $dA$ is as follows. (The origin is at the center of the circle)



$$
dA=S_x(y)dy=2\sqrt{r^2-y^2}dy
$$



Python 언어로는 다음과 같이 구현할 수 있다.<br>We can implement in python as follows.




```python
def sx(y_mm):
    if abs(y_mm) <= r_mm :
        result = 2 * (r_mm * r_mm - y_mm * y_mm) ** 0.5
    else:
        result = 0

    return result


```

이 함수의 그래프를 그려 보자<br>Let's plot this.




```python
y_mm_array = py.arange(-r_mm, r_mm+0.05, 0.1)
sx_mm_array = py.array([sx(y_mm) for y_mm in y_mm_array])

py.plot(sx_mm_array * 0.5, y_mm_array)
py.plot(sx_mm_array * (-0.5), y_mm_array)

py.axis('equal')
py.grid(True)

py.xlabel('x(mm)')
py.ylabel('y(mm)')


```

## 정적분 계산<br>Numerical Integration



0차 적분 함수를 이용해 보자<br>Let's use 0'th order numerical integration function.




```python
def get_delta_x(xi, xe, n):
    return (xe - xi) / n


```


```python
def num_int_0(f, xi, xe, n, b_verbose=False):
    x_array = py.linspace(xi, xe, n+1)

    delta_x = x_array[1] - x_array[0]

    assert 1e-3 > (abs(delta_x - get_delta_x(xi, xe, n)) / get_delta_x(xi, xe, n)), f"delta_x = {delta_x}"
    
    integration_result = 0.0
    
    for k in range(n):
        x_k = x_array[k]
        F_k = f(x_k) * delta_x

        if b_verbose: 
            print('k = %2d, F_k = %g' % (k, F_k))

        integration_result += F_k
    
    return integration_result


```

### 단면 2차 모멘트<br>Second moment of area




```python
def y2sx(y_mm):
    return y_mm * y_mm * sx(y_mm)


```


```python
I_y_mm4 = num_int_0(y2sx, -r_mm, r_mm, int(r_mm * 10))


```


```python
I_y_mm4


```

확인해 보자.<br>Let's verify.




```python
I_y_exact_mm4 = np.pi * (r_mm ** 4) * 0.25


```


```python
I_y_exact_mm4


```


```python
abs(I_y_exact_mm4 - I_y_mm4)


```

어떻게 하면 위 오차를 줄일 수 있을 것인가?<br>How can we make the error above smaller?




```python
error = (I_y_exact_mm4 - I_y_mm4)


```


```python
try : 
    assert (1e-6 > abs(error)), "Error too large"
except AssertionError as e:
    print(e)


```

## Final Bell<br>마지막 종




```python
# stackoverfow.com/a/24634221
import os
os.system("printf '\a'");


```


```python

```

b80998a7ab9136807796c7e84cbc2c969ae6db5d
ipynb
Jupyter Notebook
30_num_int/40_circular_section_MOI.ipynb
kangwon-naver/nmisp
141f8148b3ce783d3df27ee0c9986f530cada8fb
BSD-3-Clause
2019-05-14T11:00:53.000Z
2020-08-27T01:04:29.000Z
30_num_int/40_circular_section_MOI.ipynb
kangwon-naver/nmisp
141f8148b3ce783d3df27ee0c9986f530cada8fb
BSD-3-Clause
2018-07-12T06:06:21.000Z
2022-01-28T09:06:55.000Z
30_num_int/40_circular_section_MOI.ipynb
kangwon-naver/nmisp
141f8148b3ce783d3df27ee0c9986f530cada8fb
BSD-3-Clause
2018-08-28T08:38:59.000Z
2020-09-02T03:40:47.000Z
Qwen/Qwen-72B
1. YES
2. YES