首页 > 其他分享 >100024 求三角形类型各边角度周长面积已知两边夹角

100024 求三角形类型各边角度周长面积已知两边夹角

时间:2022-11-29 22:57:30浏览次数:51  
标签:夹角 step 各边 push array 100024 eq 三角形 math

<?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,o为75
 * x边30 ,y为40,o为90
 * x边30 ,y为40,o为120
 */
$val='30 40 120';
$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);
    $x = evev($vals[0]);
    $y = evev($vals[1]);
    $o = evev($vals[2]);
    
    //已知条件
    $know = array();
    array_push($know, $val);
    $v0 = eveq($vals[0]);
    $v1 = eveq($vals[1]);
    $v2 = eveq($vals[2]);
    array_push($know, "设x边长为:{$v0}");
    array_push($know, "设y边长为:{$v1}");
    array_push($know, "设o夹角为:{$v2}{$math['o']}");
    array_push($know, "求三角形的z边:");
    array_push($know, "{$math['eq']} {$math['root2l']}$x{$math['sup2']}{$math['add']}$y{$math['sup2']}{$math['sub']}2{$math['mul']}{$x}{$math['mul']}{$y}{$math['mul']}cos{$math['ang']}{$o}{$math['o']}{$math['root2r']}");
    $xx = bcmul($x, $x);
    $yy = bcmul($y, $y);
    $xy2 = bcmul(2*$x, $y);
    array_push($know, "{$math['eq']} {$math['root2l']}$xx{$math['add']}$yy{$math['sub']}$xy2{$math['mul']}cos{$math['ang']}{$o}{$math['o']}{$math['root2r']}");
    $xxyy = bcadd($xx, $yy );
    $coso = cos(deg2rad($o));
    array_push($know, "{$math['eq']} {$math['root2l']}$xxyy{$math['sub']}$xy2{$math['mul']}$coso{$math['root2r']}");
    $xy2coso = bcmul($xy2,$coso);
    array_push($know, "{$math['eq']} {$math['root2l']}$xxyy{$math['sub']}$xy2coso{$math['root2r']}");
    $xxyyxy2coso = bcsub($xxyy, $xy2coso);
    array_push($know, "{$math['eq']} {$math['root2l']}$xxyyxy2coso{$math['root2r']}");
    $z = bcsqrt($xxyyxy2coso);
    array_push($know, "{$math['eq']} $z");    
    array_push($know, "根据z{$math['eq']}{$math['root2l']}x{$math['sup2']}{$math['add']}y{$math['sup2']}{$math['sub']}2xy{$math['mul']}cos{$math['ang']}o{$math['root2r']}算出结果:{$z}:");
    array_push($know, "进行数组排序赋值,a边长取最小值,b边长取中间值,c边长取最大值:");

    $arr = array($x, $y ,$z);
    sort($arr);
    $a = $arr[0];
    array_push($know, "a边长:{$a}");
    $b = $arr[1];
    array_push($know, "b边长:{$b}");
    $c = $arr[2];
    array_push($know, "c边长:{$c}");
    if($c >= ($a+$b)){ array_push($know, "<span style='color:#f00;'>注意: {$c} 大于等于 {$math['lpar']}$a{$math['add']}$b{$math['rpar']},无法组成三角形</span>");}
    
    //计算步骤
    $step = array();
    array_push($step, "求三角形的类型:设假c");
    array_push($step, "{$math['eq']} {$math['root2l']}$a{$math['sup2']}{$math['add']}$b{$math['sup2']}{$math['root2r']}");
    $aa = bcmul($a, $a);
    $bb = bcmul($b, $b);
    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']}");
    $c2 = bcsqrt($aabb);
    array_push($step, "{$math['eq']} $c2");
    $c2c ='';
    if($c < $c2){ $c2c = "锐角三角形"; }else if($c == $c2){ $c2c = "直角三角形";}else{$c2c = "钝角三角形";}
    array_push($step, "{$math['eq']} 比较得知类型: {$c2c}");

    array_push($step, "求三角形的半周长:");
    array_push($step, "{$math['eq']} {$math['lpar']}$a{$math['add']}$b{$math['add']}$c{$math['rpar']}{$math['div']}2");
    $ab = bcadd($a, $b);
    array_push($step, "{$math['eq']} {$math['lpar']}$ab{$math['add']}$c{$math['rpar']}{$math['div']}2");
    $abc = bcadd($ab, $c);
    array_push($step, "{$math['eq']} $abc{$math['div']}2");
    $p = bcdiv($abc, 2);
    array_push($step, "{$math['eq']} $p");

    array_push($step, "求三角形的面积:");
    array_push($step, "{$math['eq']} {$math['root2l']}$p{$math['mul']}{$math['lpar']}$p{$math['sub']}$a{$math['rpar']}{$math['mul']}{$math['lpar']}$p{$math['sub']}$b{$math['rpar']}{$math['mul']}{$math['lpar']}$p{$math['sub']}$c{$math['rpar']}{$math['root2r']}");
    $pa = bcsub($p, $a);
    $pb = bcsub($p, $b);
    $pc = bcsub($p, $c);
    array_push($step, "{$math['eq']} {$math['root2l']}$p{$math['mul']}$pa{$math['mul']}$pb{$math['mul']}$pc{$math['root2r']}");
    $papb = bcmul($pa, $pb);
    array_push($step, "{$math['eq']} {$math['root2l']}$p{$math['mul']}$papb{$math['mul']}$pc{$math['root2r']}");
    $papbpc = bcmul($papb, $pc);
    array_push($step, "{$math['eq']} {$math['root2l']}$p{$math['mul']}$papbpc{$math['root2r']}");
    $ppapbpc = bcmul($p, $papbpc);
    array_push($step, "{$math['eq']} {$math['root2']}$ppapbpc");
    $S = bcsqrt($ppapbpc);
    array_push($step, "{$math['eq']} $S");

    array_push($step, "求三角形的周长:");
    array_push($step, "{$math['eq']} $a{$math['add']}$b{$math['add']}$c");
    $ab = bcadd($a, $b);
    array_push($step, "{$math['eq']} $ab{$math['add']}$c");
    $C = bcadd($ab, $c);
    array_push($step, "{$math['eq']} $C");

    array_push($step, "求三角形的c边{$math['lpar']}$c{$math['rpar']}h高:");
    array_push($step, "{$math['eq']} $S{$math['mul']}2{$math['div']}$c");
    $S2 = bcmul($S, 2);
    array_push($step, "{$math['eq']} $S2{$math['div']}$c");
    $h = bcdiv($S2, $c);
    array_push($step, "{$math['eq']} $h");

    array_push($step, "求三角形的{$math['ang']}A:");
    array_push($step, "{$math['eq']} arcsin{$math['lpar']}$h{$math['div']}$b{$math['rpar']}");
    $hb = $h/$b;
    array_push($step, "{$math['eq']} arcsin{$math['lpar']}$hb{$math['rpar']}");
    $asinhb = asin($hb);
    array_push($step, "{$math['eq']} 弧度值:{$asinhb}");
    $ao = round(rad2deg($asinhb),1);
    array_push($step, "{$math['eq']} 角度值:{$ao}{$math['o']}");

    array_push($step, "求三角形的{$math['ang']}B:");
    array_push($step, "{$math['eq']} arcsin{$math['lpar']}$h{$math['div']}$a{$math['rpar']}");
    $ha = $h/$a;
    array_push($step, "{$math['eq']} arcsin{$math['lpar']}$ha{$math['rpar']}");
    $asinha = asin($ha);
    array_push($step, "{$math['eq']} 弧度值:{$asinha}");
    $bo = round(rad2deg($asinha),1);
    array_push($step, "{$math['eq']} 角度值:{$bo}{$math['o']}");

    array_push($step, "求三角形的{$math['ang']}C:");
    array_push($step, "{$math['eq']} 180{$math['o']}{$math['sub']}{$ao}{$math['o']}{$math['sub']}{$bo}{$math['o']}");
    $ao180 = bcsub(180, $ao);
    array_push($step, "{$math['eq']} $ao180{$co}{$math['o']}{$math['sub']}{$bo}{$math['o']}");
    $co = bcsub($ao180, $bo);
    array_push($step, "{$math['eq']} 角度值:{$co}{$math['o']}");

    
    //算出结果
    $ends = array();
    array_push($ends, "三角形的类型:{$c2c}");
    array_push($ends, "三角形的a边:{$a}");
    array_push($ends, "三角形的b边:{$b}");
    array_push($ends, "三角形的c边:{$c}");
    array_push($ends, "三角形的{$math['ang']}A:{$ao}{$math['o']}");
    array_push($ends, "三角形的{$math['ang']}B:{$bo}{$math['o']}");
    array_push($ends, "三角形的{$math['ang']}C:{$co}{$math['o']}");
    array_push($ends, "三角形的面积:{$S}");
    array_push($ends, "三角形的周长:{$C}");
    //array_push($ends, "三角形的半周长:{$p}");
    array_push($ends, "三角形的c边{$math['lpar']}$c{$math['rpar']}h高:$h");

    //公式表示
    $home = array();
    array_push($home, "三角形的类型:设假c,假c{$math['eq']}{$math['root2l']}a{$math['sup2']}{$math['add']}b{$math['sup2']}{$math['root2r']},假c和原c比较得知类型。");
    array_push($home, "三角形的半周长:p{$math['eq']}{$math['lpar']}a{$math['add']}b{$math['add']}c{$math['rpar']}{$math['sol']}2");
    array_push($home, "三角形的面积(海伦公式):S{$math['eq']}{$math['root2l']}p{$math['lpar']}p{$math['sub']}a{$math['rpar']}{$math['lpar']}p{$math['sub']}b{$math['rpar']}{$math['lpar']}p{$math['sub']}c{$math['rpar']}{$math['root2r']}");
    array_push($home, "三角形的周长:C{$math['eq']}a{$math['add']}b{$math['add']}c");
    array_push($home, "三角形的c边h高:h{$math['eq']}2S{$math['sol']}c");
    array_push($home, "求三角形的{$math['ang']}A:arcsin{$math['lpar']}h{$math['sol']}b{$math['rpar']}");
    array_push($home, "求三角形的{$math['ang']}B:arcsin{$math['lpar']}h{$math['sol']}a{$math['rpar']}");
    array_push($home, "求三角形的{$math['ang']}C:180{$math['o']}{$math['sub']}{$math['ang']}A{$math['sub']}{$math['ang']}B");

    //公式说明
    $info = array();
    array_push($info, "勾股定理实际上是一个数学恒等式,它是一个基本的几何定理,解决了直角三角形的{$math['quot']}边的关系{$math['quot']}。");
    array_push($info, "三角函数则将几何问题数字化,解决了三角形的边角关系。");
    array_push($info, "勾股定理虽然只适用于直角三角形,而不适用于任意角的三角函数。");
    array_push($info, "但由于诱导公式使得任意角三角函数的求值问题可以转化为0°到90°角的求值问题,");
    array_push($info, "这就为勾股定理直接应用于任意角三角函数及反三角函数的求值创造了条件。");

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

结果:

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

☀求三角形类型各边角度周长面积已知两边夹角
30 40 120
设x边长为:30
设y边长为:40
设o夹角为:120°
求三角形的z边:
= √₍30²+40²−2×30×40×cos∠120°₎
= √₍900.00+1600.00−2400.00×cos∠120°₎
= √₍2500.00−2400.00×-0.5₎
= √₍2500.00−-1200.00₎
= √₍3700.00₎
= 60.82
根据z=√₍x²+y²−2xy×cos∠o₎算出结果:60.82:
进行数组排序赋值,a边长取最小值,b边长取中间值,c边长取最大值:
a边长:30
b边长:40
c边长:60.82

♠算出结果
三角形的类型:钝角三角形
三角形的a边:30
三角形的b边:40
三角形的c边:60.82
三角形的∠A:25.3°
三角形的∠B:34.7°
三角形的∠C:120.00°
三角形的面积:519.74
三角形的周长:130.82
三角形的c边(60.82)h高:17.09

♦公式表示
三角形的类型:设假c,假c=√₍a²+b²₎,假c和原c比较得知类型。
三角形的半周长:p=(a+b+c)/2
三角形的面积(海伦公式):S=√₍p(p−a)(p−b)(p−c)₎
三角形的周长:C=a+b+c
三角形的c边h高:h=2S/c
求三角形的∠A:arcsin(h/b)
求三角形的∠B:arcsin(h/a)
求三角形的∠C:180°−∠A−∠B

♣计算步骤
求三角形的类型:设假c
= √₍30²+40²₎
= √₍900.00+1600.00₎
= √₍2500.00₎
= 50.00
= 比较得知类型: 钝角三角形
求三角形的半周长:
= (30+40+60.82)÷2
= (70.00+60.82)÷2
= 130.82÷2
= 65.41
求三角形的面积:
= √₍65.41×(65.41−30)×(65.41−40)×(65.41−60.82)₎
= √₍65.41×35.41×25.41×4.59₎
= √₍65.41×899.76×4.59₎
= √₍65.41×4129.89₎
= √270136.10
= 519.74
求三角形的周长:
= 30+40+60.82
= 70.00+60.82
= 130.82
求三角形的c边(60.82)h高:
= 519.74×2÷60.82
= 1039.48÷60.82
= 17.09
求三角形的∠A:
= arcsin(17.09÷40)
= arcsin(0.42725)
= 弧度值:0.44144899710677
= 角度值:25.3°
求三角形的∠B:
= arcsin(17.09÷30)
= arcsin(0.56966666666667)
= 弧度值:0.60610022191167
= 角度值:34.7°
求三角形的∠C:
= 180°−25.3°−34.7°
= 154.70°−34.7°
= 角度值:120.00°

♥公式解释
勾股定理实际上是一个数学恒等式,它是一个基本的几何定理,解决了直角三角形的"边的关系"。
三角函数则将几何问题数字化,解决了三角形的边角关系。
勾股定理虽然只适用于直角三角形,而不适用于任意角的三角函数。
但由于诱导公式使得任意角三角函数的求值问题可以转化为0°到90°角的求值问题,
这就为勾股定理直接应用于任意角三角函数及反三角函数的求值创造了条件。

标签:夹角,step,各边,push,array,100024,eq,三角形,math
From: https://www.cnblogs.com/onestopweb/p/16936989.html

相关文章