<?php
header('Content-Type: text/html; charset=utf-8');
define ('ROOT', $_SERVER['DOCUMENT_ROOT']);
include ROOT.'/assets/php/head.php';
$tit= '求三角形各角度已知三边';
/**
* a为30 ,b为40,c为43
* a为30 ,b为40,c为50
* a为30 ,b为40,c为61
*/
$val='30 40 50';
$img='';
//调用方法
mill($val,$img,$tit);
/**
* mill 是磨粉机的方法
* $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);
$a = evev($vals[0]);
$b = evev($vals[1]);
$c = evev($vals[2]);
//已知条件
$know = array();
array_push($know, $val);
$v0 = eveq($vals[0]);
array_push($know, "a边长:$v0");
$v1 = eveq($vals[1]);
array_push($know, "b边长:$v1");
$v2 = eveq($vals[2]);
array_push($know, "a边长:$v2");
//计算步骤
$step = array();
array_push($step, "求三角形的{$math['ang']}A:");
array_push($step, "{$math['eq']} arccos{$math['lsqb']}{$math['lpar']}$c{$math['sup2']}{$math['add']}$b{$math['sup2']}{$math['sub']}$a{$math['sup2']}{$math['rpar']}{$math['div']}{$math['lpar']}2{$math['mul']}$b{$math['mul']}$c{$math['rpar']}{$math['rsqb']}");
$aa = bcmul($a, $a);
$bb = bcmul($b, $b);
$cc = bcmul($c, $c);
array_push($step, "{$math['eq']} arccos{$math['lsqb']}{$math['lpar']}$cc{$math['add']}$bb{$math['sub']}$aa{$math['rpar']}{$math['div']}{$math['lpar']}2{$math['mul']}$b{$math['mul']}$c{$math['rpar']}{$math['rsqb']}");
$ccbb = bcadd($cc, $bb);
$bc = bcmul($b, $c);
array_push($step, "{$math['eq']} arccos{$math['lsqb']}{$math['lpar']}$ccbb{$math['sub']}$aa{$math['rpar']}{$math['div']}{$math['lpar']}2{$math['mul']}$bc{$math['rpar']}{$math['rsqb']}");
$ccbbaa = bcsub($ccbb, $aa);
$bc2 = bcmul($bc ,2);
array_push($step, "{$math['eq']} arccos{$math['lpar']}$ccbbaa{$math['div']}$bc2{$math['rpar']}");
$ccbbaabc2 = $ccbbaa/$bc2;
array_push($step, "{$math['eq']} arccos{$math['lpar']}$ccbbaabc2{$math['rpar']}");
$acosccbbaabc2 = acos($ccbbaabc2);
array_push($step, "{$math['eq']} 弧度值:{$acosccbbaabc2}");
$ao = rad2deg($acosccbbaabc2);
array_push($step, "{$math['eq']} 角度值:{$ao}{$math['o']}");
array_push($step, "求三角形的{$math['ang']}B:");
array_push($step, "{$math['eq']} arccos{$math['lsqb']}{$math['lpar']}$a{$math['sup2']}{$math['add']}$c{$math['sup2']}{$math['sub']}$a{$math['sup2']}{$math['rpar']}{$math['div']}{$math['lpar']}2{$math['mul']}$a{$math['mul']}$c{$math['rpar']}{$math['rsqb']}");
$aa = bcmul($a, $a);
$cc = bcmul($c, $c);
$bb = bcmul($b, $b);
array_push($step, "{$math['eq']} arccos{$math['lsqb']}{$math['lpar']}$aa{$math['add']}$cc{$math['sub']}$aa{$math['rpar']}{$math['div']}{$math['lpar']}2{$math['mul']}$a{$math['mul']}$c{$math['rpar']}{$math['rsqb']}");
$aacc = bcadd($aa, $cc);
$ac = bcmul($a, $c);
array_push($step, "{$math['eq']} arccos{$math['lsqb']}{$math['lpar']}$aacc{$math['sub']}$aa{$math['rpar']}{$math['div']}{$math['lpar']}2{$math['mul']}$ac{$math['rpar']}{$math['rsqb']}");
$aaccbb = bcsub($aacc, $bb);
$ac2 = bcmul($ac ,2);
array_push($step, "{$math['eq']} arccos{$math['lpar']}$aaccbb{$math['div']}$ac2{$math['rpar']}");
$aaccbbac2 = $aaccbb/$ac2;
array_push($step, "{$math['eq']} arccos{$math['lpar']}$aaccbbac2{$math['rpar']}");
$acosaaccbbac2= acos($aaccbbac2);
array_push($step, "{$math['eq']} 弧度值:{$acosaaccbbac2}");
$bo = rad2deg($acosaaccbbac2);
array_push($step, "{$math['eq']} 角度值:{$bo}{$math['o']}");
array_push($step, "求三角形的{$math['ang']}C:");
array_push($step, "{$math['eq']} arccos{$math['lsqb']}{$math['lpar']}$a{$math['sup2']}{$math['add']}$b{$math['sup2']}{$math['sub']}$c{$math['sup2']}{$math['rpar']}{$math['div']}{$math['lpar']}2{$math['mul']}$a{$math['mul']}$b{$math['rpar']}{$math['rsqb']}");
$aa = bcmul($a, $a);
$bb = bcmul($b, $b);
$cc = bcmul($c, $c);
array_push($step, "{$math['eq']} arccos{$math['lsqb']}{$math['lpar']}$aa{$math['add']}$bb{$math['sub']}$cc{$math['rpar']}{$math['div']}{$math['lpar']}2{$math['mul']}$a{$math['mul']}$b{$math['rpar']}{$math['rsqb']}");
$aabb = bcadd($aa, $bb);
$ab = bcmul($a, $b);
array_push($step, "{$math['eq']} arccos{$math['lsqb']}{$math['lpar']}$aabb{$math['sub']}$cc{$math['rpar']}{$math['div']}{$math['lpar']}2{$math['mul']}$ab{$math['rpar']}{$math['rsqb']}");
$aabbcc = bcsub($aabb, $cc);
$ab2 = bcmul($ab ,2);
array_push($step, "{$math['eq']} arccos{$math['lpar']}$aabbcc{$math['div']}$ab2{$math['rpar']}");
$aabbccab2 = $aabbcc/$ab2;
array_push($step, "{$math['eq']} arccos{$math['lpar']}$aabbccab2{$math['rpar']}");
$acosaabbccab2= acos($aabbccab2);
array_push($step, "{$math['eq']} 弧度值:{$acosaabbccab2}");
$co = rad2deg($acosaabbccab2);
array_push($step, "{$math['eq']} 角度值:{$co}{$math['o']}");
//算出结果
$ends = array();
$aoo = round($ao,1);
$boo = round($bo,1);
$coo = round($co,1);
array_push($ends, "三角形的{$math['ang']}A:{$aoo}{$math['o']}");
array_push($ends, "三角形的{$math['ang']}B:{$boo}{$math['o']}");
array_push($ends, "三角形的{$math['ang']}C:{$coo}{$math['o']}");
//公式表示
$home = array();
array_push($home, "三角形的{$math['ang']}A:{$math['ang']}A{$math['eq']}arccos{$math['lsqb']}{$math['lpar']}c{$math['sup2']}{$math['add']}b{$math['sup2']}{$math['sub']}a{$math['sup2']}{$math['rpar']}{$math['sol']}2bc{$math['rsqb']}");
array_push($home, "三角形的{$math['ang']}B:{$math['ang']}B{$math['eq']}arccos{$math['lsqb']}{$math['lpar']}a{$math['sup2']}{$math['add']}c{$math['sup2']}{$math['sub']}b{$math['sup2']}{$math['rpar']}{$math['sol']}2ac{$math['rsqb']}");
array_push($home, "三角形的{$math['ang']}C:{$math['ang']}C{$math['eq']}arccos{$math['lsqb']}{$math['lpar']}a{$math['sup2']}{$math['add']}b{$math['sup2']}{$math['sub']}c{$math['sup2']}{$math['rpar']}{$math['sol']}2ab{$math['rsqb']}");
//公式说明
$info = array();
array_push($info, "三角函数的余弦定理,可求任意三角形");
array_push($info, "已知任意三角形的两边及两边所夹的角,求第三边:");
array_push($info, "a{$math['sup2']}{$math['eq']}b{$math['sup2']}{$math['add']}c{$math['sup2']}{$math['sub']}2bc{$math['mul']}cos{$math['ang']}A");
array_push($info, "b{$math['sup2']}{$math['eq']}a{$math['sup2']}{$math['add']}c{$math['sup2']}{$math['sub']}2ac{$math['mul']}cos{$math['ang']}B");
array_push($info, "c{$math['sup2']}{$math['eq']}a{$math['sup2']}{$math['add']}b{$math['sup2']}{$math['sub']}2ab{$math['mul']}cos{$math['ang']}C");
array_push($info, "已知三角形的两边及与第三边所夹的两角,求第三边:");
array_push($info, "a{$math['eq']}b{$math['mul']}cos{$math['ang']}C{$math['add']}c{$math['mul']}cos{$math['ang']}B");
array_push($info, "b{$math['eq']}c{$math['mul']}cos{$math['ang']}A{$math['add']}a{$math['mul']}cos{$math['ang']}C");
array_push($info, "c{$math['eq']}a{$math['mul']}cos{$math['ang']}B{$math['add']}b{$math['mul']}cos{$math['ang']}A");
array_push($info, "已知三角形的三边,求角度数:");
array_push($info, "cos{$math['ang']}A{$math['eq']}{$math['lpar']}c{$math['sup2']}{$math['add']}b{$math['sup2']}{$math['sub']}a{$math['sup2']}{$math['rpar']}{$math['sol']}2bc");
array_push($info, "cos{$math['ang']}B{$math['eq']}{$math['lpar']}a{$math['sup2']}{$math['add']}c{$math['sup2']}{$math['sub']}b{$math['sup2']}{$math['rpar']}{$math['sol']}2ac");
array_push($info, "cos{$math['ang']}C{$math['eq']}{$math['lpar']}a{$math['sup2']}{$math['add']}b{$math['sup2']}{$math['sub']}c{$math['sup2']}{$math['rpar']}{$math['sol']}2ab");
array_push($info, "");
array_push($info, "");
array_push($info, "");
array_push($info, "");
array_push($info, "");
know($know);
ends($ends);
home($home);
step($step);
info($info);
}
?>
<?php include ROOT.'/assets/php/foot.php'; ?>
结果:
☁参考上图[2022-11-30]
☀求三角形各角度已知三边
30 40 50
a边长:30
b边长:40
a边长:50
♠算出结果
三角形的∠A:36.9°
三角形的∠B:53.1°
三角形的∠C:90°
♦公式表示
三角形的∠A:∠A=arccos[(c²+b²−a²)/2bc]
三角形的∠B:∠B=arccos[(a²+c²−b²)/2ac]
三角形的∠C:∠C=arccos[(a²+b²−c²)/2ab]
♣计算步骤
求三角形的∠A:
= arccos[(50²+40²−30²)÷(2×40×50)]
= arccos[(2500.00+1600.00−900.00)÷(2×40×50)]
= arccos[(4100.00−900.00)÷(2×2000.00)]
= arccos(3200.00÷4000.00)
= arccos(0.8)
= 弧度值:0.64350110879328
= 角度值:36.869897645844°
求三角形的∠B:
= arccos[(30²+50²−30²)÷(2×30×50)]
= arccos[(900.00+2500.00−900.00)÷(2×30×50)]
= arccos[(3400.00−900.00)÷(2×1500.00)]
= arccos(1800.00÷3000.00)
= arccos(0.6)
= 弧度值:0.92729521800161
= 角度值:53.130102354156°
求三角形的∠C:
= arccos[(30²+40²−50²)÷(2×30×40)]
= arccos[(900.00+1600.00−2500.00)÷(2×30×40)]
= arccos[(2500.00−2500.00)÷(2×1200.00)]
= arccos(0.00÷2400.00)
= arccos(0)
= 弧度值:1.5707963267949
= 角度值:90°
♥公式解释
三角函数的余弦定理,可求任意三角形
已知任意三角形的两边及两边所夹的角,求第三边:
a²=b²+c²−2bc×cos∠A
b²=a²+c²−2ac×cos∠B
c²=a²+b²−2ab×cos∠C
已知三角形的两边及与第三边所夹的两角,求第三边:
a=b×cos∠C+c×cos∠B
b=c×cos∠A+a×cos∠C
c=a×cos∠B+b×cos∠A
已知三角形的三边,求角度数:
cos∠A=(c²+b²−a²)/2bc
cos∠B=(a²+c²−b²)/2ac
cos∠C=(a²+b²−c²)/2ab
标签:三边,cos,30,50,40,arccos,100025,三角形
From: https://www.cnblogs.com/onestopweb/p/16939887.html