💻 개발/👾 AI

sympy.Symbol()의 사용 및 의미

olivia_park 2021. 9. 7. 18:36

sympy.Symbol은 sympy에서 대수기호를 사용하기 위해 사용한다.

 

 

❓ 대수기호가 뭔지 모른다면 여기를 참고하면 된다.

https://www.rapidtables.org/ko/math/symbols/Algebra_Symbols.html

 

대수 기호 목록

 

www.rapidtables.org

 

 

w = sympy.symbol('w', real = True)

위의 코드를 참고하여 보자면,

 

1)

대수기호 'w'를 사용하기 위해 변수명을 "w"로 선언한 것을 확인할 수 있다.

이처럼 변수명과 대수기호는 같게 하는 것이 바람직하다.

 

2) 

위 코드의 "real = True" 는 대수 기호의 종류를 지정한 것이다.

다음과 같이 기호의 종류 및 함수 기호를 지정할 수 있다. 

a = symbols("a", integer = True) #정수
b = symbols("b", real = True) #실수
c = symbols("c", complex = True) #복소수
d = symbols("d", positive = True) #양수
f, g = symbols("f g", cls = Function) #함수 기호로 정의

 

 

 

 


 

참고 사이트

- sympy 1.8 documentation

https://docs.sympy.org/latest/tutorial/gotchas.html

 

Gotchas — SymPy 1.8 documentation

Gotchas To begin, we should make something about SymPy clear. SymPy is nothing more than a Python library, like NumPy, Django, or even modules in the Python standard library sys or re. What this means is that SymPy does not add anything to the Python langu

docs.sympy.org

 

https://studymake.tistory.com/31

 

심파이(sympy)의 symbols() 함수 사용법

 심파이에서 대수 기호를 사용하기 위해서는 symbols() 함수를 사용하면 된다. >>> a = symbols(‘a’) 여기서 대입 연산자(=) 왼쪽의 변수명과 symbols()로 생성되어 표기되는 대수기호는 같은 것으로 하

studymake.tistory.com

 

728x90
반응형