其他分享
首页 > 其他分享> > 梯度下降法求平方根

梯度下降法求平方根

作者:互联网

class Solution:
    def mySqrt(self, x: int) -> int:
        lr = 0.001
        value = 1
        while(abs(value*value - x) > 0.001):
            value = value - 4*value*lr*(value*value - x)
        return round(value)

https://blog.csdn.net/weixin_39244297/article/details/108772358

https://blog.csdn.net/songyunli1111/article/details/90474836

http://www.sofasofa.io/forum_main_post.php?postid=1004185

http://wenda.chinahadoop.cn/question/5882

标签:http,int,梯度,value,blog,csdn,lr,平方根,法求
来源: https://blog.csdn.net/qq_35985044/article/details/118653952