Math 関数

目次

  • abs — 絶対値
  • acos — 逆余弦(アークコサイン)
  • acosh — 逆双曲線余弦(アークハイパボリックコサイン)
  • asin — 逆正弦(アークサイン)
  • asinh — 逆双曲線正弦(アークハイパボリックサイン)
  • atan — 逆正接(アークタンジェント)
  • atan2 — 2 変数のアークタンジェント
  • atanh — 逆双曲線正接(アークハイパボリックタンジェント)
  • base_convert — 数値の基数を任意に変換する
  • bindec — 2 進数 を 10 進数に変換する
  • ceil — 端数の切り上げ
  • cos — 余弦(コサイン)
  • cosh — 双曲線余弦(ハイパボリックコサイン)
  • decbin — 10 進数を 2 進数に変換する
  • dechex — 10 進数を 16 進数に変換する
  • decoct — 10 進数を 8 進数に変換する
  • deg2rad — 度単位の数値をラジアン単位に変換する
  • exp — e の累乗を計算する
  • expm1 — 値がゼロに近い時にでも精度を保つために exp(number) - 1 を返す
  • fdiv — IEEE 754 に従い、数値の除算を行う
  • floor — 端数の切り捨て
  • fmod — 引数で除算をした際の剰余を返す
  • fpow — IEEE 754 に従い、数値をべき乗する
  • hexdec — 16 進数を 10 進数に変換する
  • hypot — 直角三角形の斜辺の長さを計算する
  • intdiv — 整数値の除算
  • is_finite — 浮動小数点数の値が、有限の数値であるかどうかを調べる
  • is_infinite — 浮動小数点数の値が、無限大であるかどうかを調べる
  • is_nan — 浮動小数点数の値が、非数かどうかを調べる
  • log — 自然対数
  • log10 — 底が 10 の対数
  • log1p — 値がゼロに近い時にでも精度を保つ方法で計算した log(1 + number) を返す
  • max — 最大値を返す
  • min — 最小値を返す
  • octdec — 8 進数を 10 進数に変換する
  • pi — 円周率の値を得る
  • pow — 指数表現
  • rad2deg — ラジアン単位の数値を度単位に変換する
  • round — 浮動小数点数を丸める
  • sin — 正弦(サイン)
  • sinh — 双曲線正弦(ハイパボリックサイン)
  • sqrt — 平方根
  • tan — 正接(タンジェント)
  • tanh — 双曲線正接(ハイパボリックタンジェント)
add a note

User Contributed Notes 2 notes

up
11
pat.mat AT sympatico DOT com
21 years ago
For people interest in Differential Equations, I've done a function that receive a string like: x^2+x^3 and put it in2x+3x^2 witch is the differantial of the previous equation.In the code there is one thing missing: the $string{$i} is often going outOfBound (Uninitialized string offset: 6 in...)if your error setting is set a little too high... I just dont know how to fix this.So there is the code for differential equation with (+ and -) only:<?function differentiel($equa){    $equa = strtolower($equa);    echo "Equation de depart: ".$equa."<br>";    $final = "";         for($i = 0; $i < strlen($equa); $i++)    {        //Make a new string from the receive $equa        if($equa{$i} == "x" && $equa{$i+1} == "^")        {            $final .= $equa{$i+2};            $final .= "x^";            $final .= $equa{$i+2}-1;        }        elseif($equa{$i} == "+" || $equa{$i} == "-")        {            $final .= $equa{$i};        }        elseif(is_numeric($equa{$i}) && $i == 0)        {            //gerer parenthese et autre terme generaux + gerer ^apres: 2^2            $final .= $equa{$i}."*";        }        elseif(is_numeric($equa{$i}) && $i > 0 && $equa{$i-1} != "^")        {            //gerer ^apres: 2^2            $final .= $equa{$i}."*";        }        elseif($equa{$i} == "^")        {            continue;        }        elseif(is_numeric($equa{$i}) && $equa{$i-1} == "^")        {            continue;        }        else        {            if($equa{$i} == "x")            {                $final .= 1;            }            else            {                $final .= $equa{$i};             }        }    }    //    //Manage multiplication add in the previous string $final    //    $finalMul = "";    for($i = 0; $i < strlen($final); $i++)    {        if(is_numeric($final{$i}) && $final{$i+1} == "*" && is_numeric($final{$i+2}))        {            $finalMul .= $final{$i}*$final{$i+2};        }        elseif($final{$i} == "*")        {            continue;        }        elseif(is_numeric($final{$i}) && $final{$i+1} != "*" && $final{$i-1} == "*")        {            continue;        }        else        {            $finalMul .= $final{$i};            }    }    echo "equa final: ".$finalMul;}?>I know this is not optimal but i've done this quick :)If you guys have any comment just email me.I also want to do this fonction In C to add to phpCore maybe soon...Patoff
up
7
daniel at g-loc dot org
19 years ago
If you're an aviator and needs to calculate windcorrection angles and groundspeed (e.g. during flightplanning) this can be very useful.

$windcorrection = rad2deg(asin((($windspeed * (sin(deg2rad($tt - ($winddirection-180))))/$tas))));
$groundspeed = $tas*cos(deg2rad($windcorrection)) + $windspeed*cos(deg2rad($tt-($winddirection-180)));

You can probably write these lines more beautiful, but they work!
To Top