首页 > 其他分享 >100018 求三角形任意一边已知其他两边长

100018 求三角形任意一边已知其他两边长

时间:2022-11-26 15:22:56浏览次数:48  
标签:1600.00 30 直角 40 900.00 边长 三角形 任意 100018

<?php
header('Content-Type: text/html; charset=utf-8');
define ('ROOT', $_SERVER['DOCUMENT_ROOT']);
include ROOT.'/assets/php/head.php';

$tit= '求三角形任意一边已知其他两边长';
//设 x边=30,y边=40
$val='30 40';
$img='';

//调用方法
mill($val,$img,$tit);

/**
 * mill {$math['eq']}磨粉机的方法
 * $val 传值过来计算,以空格分割成数值
 * $img 自定义图片名,默认以文件名为图片名
 * $tit 标题名
 * */
function mill($val,$img,$tit){
    //初始化
    include ROOT.'/assets/php/init.php';
    imgt($img,$tit);

    //设置小数点保留位数 
    bcscale (2);
    //$pi = round(pi(),2);

     //以空格分割成数值
    $vals = expl($val);
    $x = evev($vals[0]);
    $y = evev($vals[1]);

    //已知条件
    $know = array();
    array_push($know, $val);
    $v0 = eveq($vals[0]);
    array_push($know, "设x的边长:$v0");
    $v1 = eveq($vals[1]);
    array_push($know, "设y的边长:$v1");

    //计算步骤
    $step = array();
    array_push($step, "求弦c的边长,设勾a{$math['eq']}{$x},股b{$math['eq']}{$y}:");
    array_push($step, "{$math['eq']} {$math['root2l']}{$x}{$math['sup2']}{$math['add']}{$y}{$math['sup2']}{$math['root2r']}");
    $aa = bcmul($x, $x);
    $bb = bcmul($y, $y);
    array_push($step, "{$math['eq']} {$math['root2l']}{$aa}{$math['add']}{$bb}{$math['root2r']}");
    $aabb = bcadd($aa, $bb );
    array_push($step, "{$math['eq']} {$math['root2l']}{$aabb}{$math['root2r']}");
    $c = bcsqrt($aabb);
    array_push($step, "{$math['eq']} $c");

    array_push($step, "求股b的边长,设弦c{$math['eq']}{$x},勾a{$math['eq']}{$y}:");
    array_push($step, "{$math['eq']} {$math['root2l']}{$x}{$math['sup2']}{$math['sub']}{$y}{$math['sup2']}{$math['root2r']}");
    $cc = bcmul($x, $x);
    $aa = bcmul($y, $y);
    array_push($step, "{$math['eq']} {$math['root2l']}{$cc}{$math['sub']}{$aa}{$math['root2r']}");
    $ccaa = bcsub($cc, $aa );
    array_push($step, "{$math['eq']} {$math['root2l']}{$ccaa}{$math['root2r']}");
    $b = $ccaa < 0 ? '无法计算' : bcsqrt($ccaa);
    array_push($step, "{$math['eq']} $b");

    array_push($step, "求勾a的边长,设股b{$math['eq']}{$x},弦c{$math['eq']}{$y}:");
    array_push($step, "{$math['eq']} {$math['root2l']}{$y}{$math['sup2']}{$math['sub']}{$x}{$math['sup2']}{$math['root2r']}");
    $bb = bcmul($x, $x);
    $cc = bcmul($y, $y);
    array_push($step, "{$math['eq']} {$math['root2l']}{$cc}{$math['sub']}{$bb}{$math['root2r']}");
    $ccbb = bcsub($cc, $bb );
    array_push($step, "{$math['eq']} {$math['root2l']}{$ccbb}{$math['root2r']}");
    $a = $ccbb < 0 ? '无法计算' : bcsqrt($ccbb);
    array_push($step, "{$math['eq']} $a");

    //算出结果
    $ends = array();
    array_push($ends, "弦c的边长,:$c");
    array_push($ends, "股b的边长,:$b");
    array_push($ends, "勾a的边长,:$a");

    //公式表示
    $home = array();
    array_push($home, "求弦c的边长:c{$math['eq']}{$math['root2l']}a{$math['sup2']}{$math['add']}b{$math['sup2']}{$math['root2r']}");
    array_push($home, "求股b的边长:b{$math['eq']}{$math['root2l']}c{$math['sup2']}{$math['sub']}a{$math['sup2']}{$math['root2r']}");
    array_push($home, "求勾a的边长:a{$math['eq']}{$math['root2l']}c{$math['sup2']}{$math['sub']}b{$math['sup2']}{$math['root2r']}");

    //公式说明
    $info = array();
    array_push($info, "勾股定理,是一个基本的几何定理,指直角三角形的两条直角边的平方和等于斜边的平方。");
    array_push($info, "中国古代称直角三角形为勾股形,并且直角边中较小者为勾,另一长直角边为股,斜边为弦。");
    array_push($info, "如果设直角三角形的两条直角边长度分别是a和b,斜边长度是c,那么可以用数学语言表达:c{$math['sup2']}{$math['eq']}a{$math['sup2']}{$math['add']}b{$math['sup2']}");

    know($know);
    ends($ends);
    home($home);
    step($step);
    info($info);
}
?>
<?php include ROOT.'/assets/php/foot.php'; ?>

结果:

☁参考上图[2022-11-26]

☀求三角形任意一边已知其他两边长
30 40
设x的边长:30
设y的边长:40

♠算出结果
弦c的边长,:50.00
股b的边长,:无法计算
勾a的边长,:26.45

♦公式表示
求弦c的边长:c=√₍a²+b²₎
求股b的边长:b=√₍c²−a²₎
求勾a的边长:a=√₍c²−b²₎

♣计算步骤
求弦c的边长,设勾a=30,股b=40:
= √₍30²+40²₎
= √₍900.00+1600.00₎
= √₍2500.00₎
= 50.00
求股b的边长,设弦c=30,勾a=40:
= √₍30²−40²₎
= √₍900.00−1600.00₎
= √₍-700.00₎
= 无法计算
求勾a的边长,设股b=30,弦c=40:
= √₍40²−30²₎
= √₍1600.00−900.00₎
= √₍700.00₎
= 26.45

♥公式解释
勾股定理,是一个基本的几何定理,指直角三角形的两条直角边的平方和等于斜边的平方。
中国古代称直角三角形为勾股形,并且直角边中较小者为勾,另一长直角边为股,斜边为弦。
如果设直角三角形的两条直角边长度分别是a和b,斜边长度是c,那么可以用数学语言表达:c²=a²+b²

标签:1600.00,30,直角,40,900.00,边长,三角形,任意,100018
From: https://www.cnblogs.com/onestopweb/p/16927477.html

相关文章