Python中的平方根计算

Python provides different functions and operators in order to calculate the square root of the given number. This number can be positive, negative, zero, real or complex number. There is also the Numpy library which providessqrt() function in order to calculate square root.

Python提供了不同的函数和运算符,以便计算给定数字的平方根。 该数字可以是正数,负数,零,实数或复数。 还有一个Numpy库,它提供sqrt()函数以计算平方根。

数学模块sqrt()函数 (Math Module sqrt() Function)

The most known and popular function is the sqrt() function which is provided by the math module or library. We can just provide the number we want to calculate square root for this function. In the following example, we will import the math module and then use the sqrt() function.

最著名和最受欢迎的函数是math模块或库提供的sqrt()函数。 我们只需要提供要计算该函数平方根的数字即可。 在下面的示例中,我们将导入math模块,然后使用sqrt()函数。

import math

math.sqrt(25)
//Result will be 5.0

math.sqrt(9)
//Result will be 3.0

math.sqrt(90)
//Result will be 9.486832980505138

math.sqrt(900)
//Result will be 30.0

math.sqrt(90000)
//Result will be 300.0
math.sqrt(49)
//Result will be 7.0
Math Module sqrt() Function
Math Module sqrt() Function
数学模块sqrt()函数

零平方根(Square Root of Zero)

Zero is a special number where it can produce different results according to the different operations. When we take the square root of the zero we will get zero as a result.

零是一个

  • 4
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值