Skip to content

Commit

Permalink
牛顿迭代法
Browse files Browse the repository at this point in the history
  • Loading branch information
shataowei committed Nov 26, 2019
1 parent adb0f47 commit 5d21306
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 24 deletions.
81 changes: 57 additions & 24 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
- [辗转相除法](数学/最大公约数问题/gcd.md#L1)
- [其他方法](数学/最大公约数问题/gcd.md#L1)
- 牛顿法
- [迭代公式推导](数学/牛顿法/牛顿迭代法求平方根.md#L1)
- [实现它](数学/牛顿法/牛顿迭代法求平方根.md#L1)
- 拟牛顿法
- 概率密度分布
- [均匀分布](数学/概率密度分布/概率密度分布.md#L1)
Expand Down
17 changes: 17 additions & 0 deletions 数学/牛顿法/牛顿迭代法求平方根.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 迭代公式推导
- ![](https://tva1.sinaimg.cn/large/006y8mN6gy1g9bfple4x4j303x00i742.jpg)
- ![](https://tva1.sinaimg.cn/large/006y8mN6gy1g9bfr2t8flj306l00mmwz.jpg)
- ![](https://tva1.sinaimg.cn/large/006y8mN6gy1g9bfruh1klj3043015wea.jpg)

# 实现它
```
def get_ans(nums,count=10000):
ans = nums
if not ans:
return ans
Times = 0
while Times<count:
ans = 0.5*(ans+nums/ans)
Times+=1
return ans
```

0 comments on commit 5d21306

Please sign in to comment.