python二分法求立方根_用二分法求3的立方根的近似值(精确度为0.1)

展开全部

二分法:

1.4*1.4*1.4<3      1.5*1.5*1.5>3     取[1.4,1.5]

(1.4+1.5)/2=1.45    1.45^3=3.048625>3     取1.4            1.45

=1.425            =2.89…    <3      取1.425        1.45

=1.4375          =2.97…    <3      取1.4375      1.45

=1.44375        =3.0093.. >3      取1.4375      1.44375

=1.440625      =2.989…  <3      取1.440625  1.44375

=1.4421875    =2.9996.. <3      取1.4421875     1.44375

excel实现:取[0,2]区间初值为1,公式为(3-x^3)/|(3-x^3)|*(1/n)+x其中e68a8462616964757a686964616f31333332643234n=2^(序号),1/n为区间宽度

或简单点取1.4或1.5为n初值,(3-n*n*n)/10+n慢慢接近3√3(3^1/3)

取初值2,利用EXCEL下拉计算得:(=(3-B:B*B:B*B:B)/10+B:B)

2.0000000000000000

1.5000000000000000

1.4625000000000000

1.4496849609375000

1.4450211286557200

1.4432882808137900

1.4426396324040100

1.4423961580101300

1.4423046742997900

1.4422702867090400

1.4422573589677800

1.4422524986216000

1.4422506712762000

1.4422499842434600

1.4422497259368800

1.4422496288201700

1.4422495923067300

1.4422495785786000

1.4422495734171700

1.4422495714766000

1.4422495707470000

1.4422495704726800

1.4422495703695500

1.4422495703307700

1.4422495703161900

1.4422495703107100

1.4422495703086500

1.4422495703078800

1.4422495703075800

1.4422495703074700

1.4422495703074300

1.4422495703074200

1.4422495703074100

1.4422495703074100

1.4422495703074100

1.4422495703074100

1.4422495703074100

1.4422495703074100

1.4422495703074100

1.4422495703074100

1.4422495703074100

1.4422495703074100

1.4422495703074100

1.4422495703074100

1.4422495703074100

1.4422495703074100

1.4422495703074100