Python | sympy.evalf () метод

Опубликовано: 12 Апреля, 2022

With the help of sympy.evalf() method, we are able to evaluate the mathematical expressions.

Syntax : sympy.evalf()
Return : Return the evaluated mathematical expression.

Example #1 :
In this example we can see that by using sympy.evalf() method, we are able to evaluate the mathematical expressions.

# Import sympy
from sympy import *
  
# Use sympy.evalf() method
expn = sqrt(9)
gfg = expn.evalf()
  
print(gfg)

Выход :

3.00000000000000

Example #2 :

# Import sympy
from sympy import *
  
# Use sympy.evalf() method
expn = sqrt(9)*cos(45)
gfg = expn.evalf()
  
print(gfg)

Выход :

1.57596596645319

Внимание компьютерщик! Укрепите свои основы с помощью базового курса программирования Python и изучите основы.

Для начала подготовьтесь к собеседованию. Расширьте свои концепции структур данных с помощью курса Python DS. А чтобы начать свое путешествие по машинному обучению, присоединяйтесь к курсу Машинное обучение - базовый уровень.