二分法求平方根 C语言Approximatesquare root with bisection methodINPUT:Argument x,endpoint values a,b,such that a < bOUTPUT:value which differs from sqrt(x) by less than 1done= 0a= 0b= square root of largest possible argument (e.g.2的16次
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 05:42:11
二分法求平方根 C语言Approximatesquare root with bisection methodINPUT:Argument x,endpoint values a,b,such that a < bOUTPUT:value which differs from sqrt(x) by less than 1done= 0a= 0b= square root of largest possible argument (e.g.2的16次
二分法求平方根 C语言
Approximatesquare root with bisection method
INPUT:Argument x,endpoint values a,b,such that a < b
OUTPUT:value which differs from sqrt(x) by less than 1
done= 0
a= 0
b= square root of largest possible argument (e.g.2的16次方).
c= -1
do{
c_old
二分法求平方根 C语言Approximatesquare root with bisection methodINPUT:Argument x,endpoint values a,b,such that a < bOUTPUT:value which differs from sqrt(x) by less than 1done= 0a= 0b= square root of largest possible argument (e.g.2的16次
在给定的区间单调,对应的函数就可以用二分法计算根.平方根函数符合这个条件,当然可以用二分法求解.
上述程序片段是一段伪代码,