Python | sympy.sqrt() method

With the help of sympy.sqrt() method, we can find the square root of any value in terms of values and also in terms of symbolically simplified mathematical expression.

Syntax: sqrt(val)

Parameters:
val – It is the value on which square root operation is to be performed.



Returns: Returns square root in terms of values and symbolically simplified mathematical expression corresponding to the input expression.

Example #1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# import sympy 
from sympy import * 
  
val = 256
    
print("Value : {}".format(val)) 
      
# Use sympy.sqrt() method 
sqrt_val = sqrt(val)  
      
print("Square root of value : {}".format(sqrt_val))  

chevron_right


Output:

Value : 256
Square root of value : 16

Example #2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# import sympy 
from sympy import * 
  
val = 8
    
print("Value : {}".format(val)) 
      
# Use sympy.sqrt() method 
sqrt_val = sqrt(val)  
      
print("Square root of value : {}".format(sqrt_val))  

chevron_right


Output:

Value : 8
Square root of value : 2*sqrt(2)


My Personal Notes arrow_drop_up

Coder Machine Learner Social Activist Vocalist

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.