点击查看代码
<?php
header('Content-Type: text/html; charset=utf-8');
define ('ROOT', $_SERVER['DOCUMENT_ROOT']);
include ROOT.'/assets/php/head.php';
$tit= '求平方根近似值已知任意一个正数';
//正数:17
$val='17';
$img='';
//调用方法
mill($val,$img,$tit);
//mill 是磨粉机的方法
function mill($val,$img,$tit){
//初始化
include ROOT.'/assets/php/init.php';
imgt($img,$tit);
//设置小数点保留位数
bcscale (2);
//$pi = round(pi(),2);
//以空格分割成数值
$vals = expl($val);
$n = evev($vals[0]);
//已知条件
$know = array();
array_push($know, $val);
$v0 = eveq($vals[0]);
array_push($know, "正数:$v0");
//计算步骤
$step = array();
array_push($step, "拆分{$n}:");
$a = bcsqrt($n,0);
$aa = $a*$a;
$b = $n-$aa;
array_push($step, "{$math['eq']} $aa{$math['add']}$b");
array_push($step, "{$math['eq']} $a{$math['sup2']}{$math['add']}$b");
array_push($step, "求{$n}平方根近似值:");
array_push($step, "{$math['eq']} $a{$math['add']}{$math['lsqb']}$b{$math['div']}{$math['lpar']}2{$math['mul']}$a{$math['rpar']}{$math['rsqb']}");
$a2 = 2*$a;
array_push($step, "{$math['eq']} $a{$math['add']}{$math['lpar']}$b{$math['div']}$a2{$math['rpar']}");
$ba2 = $b/$a2;
array_push($step, "{$math['eq']} $a{$math['add']}$ba2");
$m = $a+$ba2;
array_push($step, "{$math['eq']} $m");
array_push($step, "验算:");
array_push($step, "{$math['eq']} {$math['root2']}$n");
$sqrtn = bcsqrt($n,12);
array_push($step, "{$math['eq']} $sqrtn");
//算出结果
$ends = array();
array_push($ends, "拆分任意一个正数:$a{$math['sup2']}{$math['add']}$b");
$roundm = round($m,3);
array_push($ends, "平方根近似值:$roundm");
$roundsqrtn = round($sqrtn,5);
array_push($ends, "验算:$roundsqrtn");
//公式表示
$home = array();
array_push($home, "拆分任意一个正数:n{$math['eq']}a{$math['sup2']}{$math['add']}b");
array_push($home, "平方根近似值:{$math['root2']}n{$math['eq']}a{$math['add']}{$math['lpar']}b{$math['sol']}2a{$math['rpar']}");
//解释说明
$info = array();
array_push($info, "求平方根近似值公式只适用于正数。");
array_push($info, "正数的解释:数学上称凡大于零的数为正数。");
know($know);
ends($ends);
home($home);
step($step);
info($info);
}
?>
<?php include ROOT.'/assets/php/foot.php';
//写下笔记
$note = array();
note($note);
?>
☁参考上图[22-12-12 chaoyi]
☀求平方根近似值已知任意一个正数
17
正数:17
♠算出结果
拆分任意一个正数:4²+1
平方根近似值:4.125
验算:4.12311
♥公式表示
拆分任意一个正数:n=a²+b
平方根近似值:√n=a+(b/2a)
♣计算步骤
拆分17:
= 16+1
= 4²+1
求17平方根近似值:
= 4+[1÷(2×4)]
= 4+(1÷8)
= 4+0.125
= 4.125
验算:
= √17
= 4.123105625617
♦公式说明
求平方根近似值公式只适用于正数。
正数的解释:数学上称凡大于零的数为正数。
标签:17,190001,近似值,拆分,平方根,正数,任意
From: https://www.cnblogs.com/onestopweb/p/16977206.html