本文整理汇总了PHP中cosh函数的典型用法代码示例。如果您正苦于以下问题:PHP cosh函数的具体用法?PHP cosh怎么用?PHP cosh使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cosh函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HyperbolicArc
function HyperbolicArc($p, $a, $b, $t1, $t2 = 0.0, $n, $reflectx = FALSE, $reflecty = FALSE)
{
if (empty($n)) {
$n = $this->N();
}
if (empty($t2)) {
$t2 = $t1;
$t1 = -$t2;
}
//Circles
if (!is_array($r)) {
$r = array($r, $r);
}
$dt = ($t2 - $t1) / (1.0 * ($n - 1));
$factx = 1.0;
if ($reflectx) {
$factx = -1.0;
}
$facty = 1.0;
if ($reflecty) {
$facty = -1.0;
}
$ps = array();
$t = $t1;
for ($i = 0; $i < $n; $i++) {
array_push($ps, array($p[0] + $factx * $a * cosh($t), $p[1] + $factx * $b * sinh($t)));
$t += $dt;
}
return $ps;
}
示例2: inverse
public function inverse($p)
{
$x = $p->x;
$y = $p->y;
$L = atan(Proj4php::$common . sinh(($x - $this->xs) / $this->n2) / cos(($y - $this->ys) / $this->n2));
$lat1 = asin(sin(($y - $this->ys) / $this->n2) / Proj4php::$common . cosh(($x - $this->xs) / $this->n2));
$LC = Proj4php::$common . latiso(0.0, $lat1, sin($lat1));
$p->x = $this->lc + $L / $this->rs;
$p->y = Proj4php::$common . invlatiso($this->e, ($LC - $this->cp) / $this->rs);
return $p;
}
示例3: wgs2u1992
function wgs2u1992($lat, $lon)
{
//double Brad , Lrad, Lorad ,k, C, firad, Xmer, Ymer, Xgk, Ygk;
// stale
$E = 0.0818191910428;
$Pi = 3.141592653589793;
$Pi_2 = 1.570796327;
//3.141592653589793238462643 / 2 // Pi / 2
$Pi_4 = 0.7853981634;
// 3.141592653589793238462643 / 4 // Pi / 4
$Pi__180 = 0.01745329252;
// 3.141592653589793238462643 / 180
$Ro = 6367449.14577;
$a2 = 0.0008377318247344;
$a4 = 7.608527788826E-7;
$a6 = 1.197638019173E-9;
$a8 = 2.44337624251E-12;
// uklad UTM
//#define mo 0.9996 //wspo#udnik skali na po#udniku #rodkowym
//#define Lo (double)((((int)(lon/6)) * 6) + 3) // po#udnik #rodkowy
// zone = (int)(lon+180/6)+1
//#define FE 500000 //False Easting
//#define FN 0 //False Northing
// uklad 1992
$mo = 0.9993;
//wspo#udnik #rodkowy
$Lo = 19.0;
$FE = 500000;
//False Easting
$FN = -5300000;
//False Northing
$Brad = $lat * $Pi / 180;
//Pi / 180;
$Lrad = $lon * $Pi / 180;
// Pi / 180;
$Lorad = $Lo * $Pi / 180;
// Pi / 180;
//k = ((1 - E * sin(Brad)) / (1 + E * sin(Brad))) ^ (E / 2); // pasc
//k = pow(((1 - E * sin(Brad)) / (1 + E * sin(Brad))) , (E / 2)); // c
$k = exp($E / 2 * log((1 - $E * sin($Brad)) / (1 + $E * sin($Brad))));
$C = $k * tan($Brad / 2 + $Pi_4);
$firad = 2 * atan($C) - $Pi_2;
$Xmer = atan(sin($firad) / (cos($firad) * cos($Lrad - $Lorad)));
$Ymer = 0.5 * log((1 + cos($firad) * sin($Lrad - $Lorad)) / (1 - cos($firad) * sin($Lrad - $Lorad)));
$Xgk = $Ro * ($Xmer + $a2 * sin(2 * $Xmer) * cosh(2 * $Ymer) + $a4 * sin(4 * $Xmer) * cosh(4 * $Ymer) + $a6 * sin(6 * $Xmer) * cosh(6 * $Ymer) + $a8 * sin(8 * $Xmer) * cosh(8 * $Ymer));
$Ygk = $Ro * ($Ymer + $a2 * cos(2 * $Xmer) * sinh(2 * $Ymer) + $a4 * cos(4 * $Xmer) * sinh(4 * $Ymer) + $a6 * cos(6 * $Xmer) * sinh(6 * $Ymer) + $a8 * cos(8 * $Xmer) * sinh(8 * $Ymer));
$X = $mo * $Xgk + $FN;
$Y = $mo * $Ygk + $FE;
return array($X, $Y);
}
示例4: tanh
/**
* Calculates the hyperbolic tangent of a complex number: z = tanh(c1)
*
* @param Math_Complex $c1
* @return Math_Complex A valid Math_Complex number on success
* @throws InvalidArgumentException
*/
public static function tanh(Math_Complex $c1)
{
if (!Math_ComplexOp::isComplex($c1)) {
throw new InvalidArgumentException('argument is not a Math_Complex object');
}
$r = $c1->getReal();
$i = $c1->getIm();
$d = cos($i) * cos($i) + sinh($r) * sinh($r);
return new Math_Complex(sinh($r) * cosh($r) / $d, 0.5 * sin(2 * $i) / $d);
}
示例5: atanh
if (PHP_OS != 'WINNT') {
echo "atanh\n";
echo atanh(-2354) . " " . atanh("foo") . " " . atanh(0) . " " . atanh(5) . atanh(1.2345) . "\n";
}
echo "atan2\n";
echo atan2(-2354, 3) . " " . atan2("foo", 12) . " " . atan2(0, 3) . " " . atan2(5, 2.3) . atan2(1.2345, 3.22) . "\n";
echo "base_convert\n";
echo base_convert("-2354", 10, 2) . " " . base_convert("foo", 10, 10) . " " . base_convert(300, 4, 20) . " " . base_convert(5, 6, 7) . " " . base_convert(5, 4, 7) . " " . base_convert(1.2345, 8, 2) . "\n";
echo "bindec\n";
echo bindec("-2354") . " " . bindec("foo") . " " . bindec(0) . " " . bindec(5) . bindec("1.2345") . "\n";
echo "ceil\n";
echo ceil(-2354) . " " . ceil("foo") . " " . ceil(0) . " " . ceil(5) . ceil(1.2345) . "\n";
echo "cos\n";
echo cos(-2354) . " " . cos("foo") . " " . cos(0) . " " . cos(5) . cos(1.2345) . "\n";
echo "cosh\n";
echo cosh(-2354) . " " . cosh("foo") . " " . cosh(0) . " " . cosh(5) . cosh(1.2345) . "\n";
echo "decbin\n";
echo decbin(2354) . " " . decbin("foo") . " " . decbin(0) . " " . decbin("5") . decbin(1.2345) . "\n";
echo "dechex\n";
echo dechex("2354") . " " . dechex("foo") . " " . dechex(0) . " " . dechex(5) . dechex(1.2345) . "\n";
echo "decoct\n";
echo decoct(2354) . " " . decoct("foo") . " " . decoct(0) . " " . decoct(5) . decoct(1.2345) . "\n";
echo "deg2rad\n";
echo deg2rad(-2354) . " " . deg2rad("foo") . " " . deg2rad(0) . " " . deg2rad(5) . deg2rad(1.2345) . "\n";
echo "exp\n";
echo exp(-2354) . " " . exp("foo") . " " . exp(0) . " " . exp(5) . exp(1.2345) . "\n";
if (PHP_OS != 'WINNT') {
echo "expm1\n";
echo expm1(-2354) . " " . expm1("foo") . " " . expm1(0) . " " . expm1(5) . expm1(1.2345) . "\n";
}
echo "floor\n";
示例6: grid_to_geodetic
/**
* Conversion from grid coordinates to geodetic coordinates.
*
* http://www.lantmateriet.se/templates/LMV_Page.aspx?id=5197
* based on: http://mellifica.se/geodesi/gausskruger.js
* "Gauss Conformal Projection (Transverse Mercator), Krügers Formulas"
*/
function grid_to_geodetic($x, $y)
{
global $coords;
//Prepare ellipsoid-based stuff
$e2 = $coords['flattening'] * (2.0 - $coords['flattening']);
$n = $coords['flattening'] / (2.0 - $coords['flattening']);
$a_roof = $coords['axis'] / (1.0 + $n) * (1.0 + $n * $n / 4.0 + $n * $n * $n * $n / 64.0);
$delta1 = $n / 2.0 - 2.0 * $n * $n / 3.0 + 37.0 * $n * $n * $n / 96.0 - $n * $n * $n * $n / 360.0;
$delta2 = $n * $n / 48.0 + $n * $n * $n / 15.0 - 437.0 * $n * $n * $n * $n / 1440.0;
$delta3 = 17.0 * $n * $n * $n / 480.0 - 37 * $n * $n * $n * $n / 840.0;
$delta4 = 4397.0 * $n * $n * $n * $n / 161280.0;
$Astar = $e2 + $e2 * $e2 + $e2 * $e2 * $e2 + $e2 * $e2 * $e2 * $e2;
$Bstar = -(7.0 * $e2 * $e2 + 17.0 * $e2 * $e2 * $e2 + 30.0 * $e2 * $e2 * $e2 * $e2) / 6.0;
$Cstar = (224.0 * $e2 * $e2 * $e2 + 889.0 * $e2 * $e2 * $e2 * $e2) / 120.0;
$Dstar = -(4279.0 * $e2 * $e2 * $e2 * $e2) / 1260.0;
//Convert
$deg_to_rad = M_PI / 180;
$lambda_zero = $coords['central_meridian'] * $deg_to_rad;
$xi = ($x - $coords['false_northing']) / ($coords['scale'] * $a_roof);
$eta = ($y - $coords['false_easting']) / ($coords['scale'] * $a_roof);
$xi_prim = $xi - $delta1 * sin(2.0 * $xi) * cosh(2.0 * $eta) - $delta2 * sin(4.0 * $xi) * cosh(4.0 * $eta) - $delta3 * sin(6.0 * $xi) * cosh(6.0 * $eta) - $delta4 * sin(8.0 * $xi) * cosh(8.0 * $eta);
$eta_prim = $eta - $delta1 * cos(2.0 * $xi) * sinh(2.0 * $eta) - $delta2 * cos(4.0 * $xi) * sinh(4.0 * $eta) - $delta3 * cos(6.0 * $xi) * sinh(6.0 * $eta) - $delta4 * cos(8.0 * $xi) * sinh(8.0 * $eta);
$phi_star = asin(sin($xi_prim) / cosh($eta_prim));
$delta_lambda = atan(sinh($eta_prim) / cos($xi_prim));
$lon_radian = $lambda_zero + $delta_lambda;
$lat_radian = $phi_star + sin($phi_star) * cos($phi_star) * ($Astar + $Bstar * pow(sin($phi_star), 2) + $Cstar * pow(sin($phi_star), 4) + $Dstar * pow(sin($phi_star), 6));
$lat = $lat_radian * 180.0 / M_PI;
$lon = $lon_radian * 180.0 / M_PI;
return array($lat, $lon);
}
示例7: sech
function sech($x)
{
return 1 / cosh($x);
}
示例8: tanh
function tanh($f)
{
return sinh($f) / cosh($f);
// ok, that one makes sense again :)
}
示例9: visitFunctionNode
/**
* Evaluate a FunctionNode
*
* Computes the value of a FunctionNode `f(x)`, where f is
* an elementary function recognized by StdMathLexer and StdMathParser.
*
* @see \MathParser\Lexer\StdMathLexer StdMathLexer
* @see \MathParser\StdMathParser StdMathParser
* @throws UnknownFunctionException if the function respresented by the
* FunctionNode is *not* recognized.
*
* @param FunctionNode $node AST to be evaluated
* @retval float
*/
public function visitFunctionNode(FunctionNode $node)
{
$inner = $node->getOperand()->accept($this);
switch ($node->getName()) {
// Trigonometric functions
case 'sin':
return sin($inner);
case 'cos':
return cos($inner);
case 'tan':
return tan($inner);
case 'cot':
return 1 / tan($inner);
// Inverse trigonometric functions
// Inverse trigonometric functions
case 'arcsin':
return asin($inner);
case 'arccos':
return acos($inner);
case 'arctan':
return atan($inner);
case 'arccot':
return pi() / 2 - atan($inner);
// Exponentials and logarithms
// Exponentials and logarithms
case 'exp':
return exp($inner);
case 'log':
return log($inner);
case 'lg':
return log10($inner);
// Powers
// Powers
case 'sqrt':
return sqrt($inner);
// Hyperbolic functions
// Hyperbolic functions
case 'sinh':
return sinh($inner);
case 'cosh':
return cosh($inner);
case 'tanh':
return tanh($inner);
case 'coth':
return 1 / tanh($inner);
// Inverse hyperbolic functions
// Inverse hyperbolic functions
case 'arsinh':
return asinh($inner);
case 'arcosh':
return acosh($inner);
case 'artanh':
return atanh($inner);
case 'arcoth':
return atanh(1 / $inner);
default:
throw new UnknownFunctionException($node->getName());
}
}
示例10: _coth
private function _coth($num)
{
$num = (double) $num;
if (0 == $num) {
return NAN;
}
return cosh($num) / sinh($num);
}
示例11: echo
<?php
echo (int) (cosh(1) * 1000000);
echo abs(-1);
echo "Done.";
示例12: hyperbolicCosine
/**
* @param int|float $number
*
* @return float
*/
function hyperbolicCosine($number)
{
return (double) \cosh($number);
}
示例13: cosh
/**
* {@inheritdoc}
*/
public function cosh($angle)
{
return $this->withPrecision(cosh($angle));
}
示例14: processSech
protected function processSech()
{
$operands = $this->getOperands();
$operand = $operands[0];
if ($operand->getValue() == 0) {
return null;
}
return new Float(1 / cosh($operand->getValue()));
}
示例15: sech
/**
* Calculates the hyperbolic secant of the parameter
*
* @param float $x
* @returns mixed A floating point on success, PEAR_Error object otherwise
* @access public
*/
function sech($x)
{
/*{{{*/
$x = floatval($x);
$cosh = cosh($x);
if ($cosh == 0.0) {
return PEAR::raiseError('Undefined operation, hyperbolic cosine of parameter is zero');
} else {
return 1 / $cosh;
}
}