1. 程式人生 > 其它 >200005 計算高度已知水平距和四種坡度表示法

200005 計算高度已知水平距和四種坡度表示法

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

$tit= '計算高度已知水平距和四種坡度表示法';
/**
 * 水平距:a 3500
 * 百分數:p 5%
 * 度數:o 2.86度
 * 坡度值:i i=0.05
 * 比例:m:n 1:20
 * */
$val='3500 5 2.86 0.05 1 20';
$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);
    $a = evev($vals[0]);
    $p = evev($vals[1]);
    $o = evev($vals[2]);
    $i = evev($vals[3]);
    $m = evev($vals[4]);
    $n = evev($vals[5]);

    //已知條件
    $know = array();
    array_push($know, $val);
    $v0 = eveq($vals[0]);
    array_push($know, "水平距:$v0{$unit['m']}");
    $v1 = eveq($vals[1]);
    array_push($know, "百分數:$v1{$math['p100']}");
    $v2 = eveq($vals[2]);
    array_push($know, "度數:$v2{$math['o']}");
    $v3 = eveq($vals[3]);
    array_push($know, "坡度值:$v3");
    $v4 = eveq($vals[4]);
    $v5 = eveq($vals[5]);
    array_push($know, "比例:{$v4}:{$v5}");

    //計算步驟
    $step = array();
    array_push($step, "計算高度按百分比法:");
    array_push($step, "{$math['eq']} $a{$math['mul']}$p{$math['p100']}");
    $h1 = bcmul($a, $p/100);
    array_push($step, "{$math['eq']} $h1");

    array_push($step, "計算高度按度數法:");
    array_push($step, "{$math['eq']} $a{$math['mul']}tan{$math['lpar']}$o{$math['o']}{$math['rpar']}");
    $tano = tan(deg2rad($o));
    array_push($step, "{$math['eq']} $a{$math['mul']}tan{$math['lpar']}$tano{$math['rpar']}");
    $h2 = bcmul($a, $tano);
    array_push($step, "{$math['eq']} $h2");

    array_push($step, "計算高度按坡度值表示法:");
    array_push($step, "{$math['eq']} $a{$math['mul']}$i");
    $h3 = bcmul($a, $i);
    array_push($step, "{$math['eq']} $h3");

    array_push($step, "計算高度按比例法:");
    array_push($step, "{$math['eq']} $a{$math['mul']}{$math['lpar']}$m{$math['div']}$n{$math['rpar']}");
    $mn = bcdiv($m, $n);
    array_push($step, "{$math['eq']} $a{$math['mul']}$mn");
    $h4 = bcmul($a, $mn);
    array_push($step, "{$math['eq']} $h4");

    //算出結果
    $ends = array();
    array_push($ends, "百分比法:{$h1}{$unit['m']}");
    array_push($ends, "度數法:{$h2}{$unit['m']}");
    array_push($ends, "坡度值表示法:{$h3}{$unit['m']}");
    array_push($ends, "比例法:{$h4}{$unit['m']}");

    //公式表示
    $home = array();
    array_push($home, "百分比法:h{$math['eq']}a{$math['mul']}n{$math['p100']}");
    array_push($home, "度數法:h{$math['eq']}a{$math['mul']}tan{$math['lpar']}n{$math['o']}{$math['rpar']}");
    array_push($home, "坡度值表示法:h{$math['eq']}a{$math['mul']}i");
    array_push($home, "比例法:h{$math['eq']}a{$math['mul']}{$math['lpar']}m:n{$math['rpar']}");

    //公式說明
    $info = array();
    array_push($info, "坡度的表示方法有百分比法、度數法、密位法和比例法四種,其中以百分比法和度數法較為常用。密位法這裡不作講解。");
    array_push($info, "坡長的計算公式是坡長{$math['eq']}{$math['root2l']}水平距{$math['sup2']}{$math['add']}高度{$math['sup2']}{$math['root2r']}");

    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]

☀計算高度已知水平距和四種坡度表示法
3500 5 2.86 0.05 1 20  
水平距:3500m  
百分數:5%  
度數:2.86°  
坡度值:0.05  
比例:1:20  

♠算出結果  
百分比法:175.00m  
度數法:174.85m  
坡度值表示法:175.00m  
比例法:175.00m  

♥公式表示  
百分比法:h=a×n%  
度數法:h=a×tan(n°)  
坡度值表示法:h=a×i  
比例法:h=a×(m:n)  

♣計算步驟  
計算高度按百分比法:  
= 3500×5%  
= 175.00  
計算高度按度數法:  
= 3500×tan(2.86°)  
= 3500×tan(0.049957916025615)  
= 174.85  
計算高度按坡度值表示法:  
= 3500×0.05  
= 175.00  
計算高度按比例法:  
= 3500×(1÷20)  
= 3500×0.05  
= 175.00  

♦公式說明  
坡度的表示方法有百分比法、度數法、密位法和比例法四種,其中以百分比法和度數法較為常用。密位法這裡不作講解。  
坡長的計算公式是坡長=√₍水平距²+高度²₎