Find the side of a triangle using two sides and an angle:
<?
$a = "10"; // length of side a
$b = "15"; // length of side b
$angle = "45"; // angle opposite side c
$c = (sqrt(pow($a, 2) + pow($b, 2) - $a * $b * cos(deg2rad($angle)) * 2));
// side c = 10.613894770933
?>
cos
(PHP 4, PHP 5)
cos — 余弦(コサイン)
説明
float cos ( float $arg )cos() は、arg のコサインを 返します。arg はラジアンです。
パラメータ
- arg
ラジアンで表した角度。
返り値
arg のコサインを返します。
例
参考
| acos() |
| sin() |
| tan() |
| deg2rad() |
cos
joescuriosityshoppe at gmail dot com
13-Oct-2006 06:55
13-Oct-2006 06:55
felipensp at gmail dot com
12-Mar-2006 10:29
12-Mar-2006 10:29
Convert degree to radianus, radianus to cos.
<?php
// Degree
$degree = 360;
// Convertion
print cos(deg2rad($degree));
?>