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; }
public static function get_tile_nw($xtile, $ytile, $zoom) { $n = pow(2, $zoom); $lon = $xtile / $n * 360.0 - 180.0; $lat = rad2deg(atan(sinh(pi() * (1 - 2 * $ytile / $n)))); return array($lat, $lon); }
function getPoint($xtile, $ytile, $zoom) { $n = pow(2, $zoom); $lon_deg = $xtile / $n * 360.0 - 180.0; $lat_deg = rad2deg(atan(sinh(pi() * (1 - 2 * $ytile / $n)))); return $lon_deg . "," . $lat_deg; }
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; }
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); }
function tanh($f) { return sinh($f) / cosh($f); // ok, that one makes sense again :) }
/** * @param float $x A number * @return float The hyperbolic sine of the given value */ public function sinh($x) { return sinh($x); }
<?php define("MAX_64Bit", 9223372036854775807); define("MAX_32Bit", 2147483647); define("MIN_64Bit", -9223372036854775807 - 1); define("MIN_32Bit", -2147483647 - 1); $longVals = array(MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit, MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, MAX_32Bit * 2 + 1, MAX_32Bit * 2 - 1, MAX_64Bit - 1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1); foreach ($longVals as $longVal) { echo "--- testing: {$longVal} ---\n"; var_dump(sinh($longVal)); } ?> ===DONE===
</div> <div id="details"> <?php function human_filesize($bytes, $decimals = 2) { $sz = ' kMGTP'; $factor = floor((strlen($bytes) - 1) / 3); return sprintf("%.{$decimals}f ", $bytes / pow(1000, $factor)) . @$sz[$factor]; } $file = $base . $z . "/" . $x . "/" . $y . ".png"; $imagesize = getimagesize($file); $n = pow(2, $z); $lon_deg = $x / $n * 360.0 - 180.0; $lat_deg = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n)))); $runlog = "../log/run_" . $x . "_" . $y . ".log"; $gclog = "../log/gc_" . $x . "_" . $y . ".log"; $hproflog = "../log/hprof_" . $x . "_" . $y . ".log"; $pbffile = "../../input/old/tiles_z13_" . $x . "_" . $y . ".pbf"; $loglist = ""; if (file_exists($runlog)) { $loglist .= '<a href="' . $runlog . '">run</a>'; } else { $loglist .= '<span class="inactive">run</span>'; } $loglist .= ", "; if (file_exists($gclog)) { $loglist .= '<a href="' . $gclog . '">gc</a>'; } else { $loglist .= '<span class="inactive">gc</span>';
/** * IMSIN * * Returns the sine of a complex number in x + yi or x + yj text format. * * Excel Function: * IMSIN(complexNumber) * * @param string $complexNumber The complex number for which you want the sine. * @return string|float */ public static function IMSIN($complexNumber) { $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); if ($parsedComplex['imaginary'] == 0.0) { return sin($parsedComplex['real']); } else { return self::COMPLEX(sin($parsedComplex['real']) * cosh($parsedComplex['imaginary']),cos($parsedComplex['real']) * sinh($parsedComplex['imaginary']),$parsedComplex['suffix']); } } // function IMSIN()
/** * @param int|float $number * * @return float */ function hyperbolicSine($number) { return (double) \sinh($number); }
private function _sinh($num) { return sinh((double) $num); }
public static function fromMercatorCoords($point) { $point->x *= 360; $point->y = rad2deg(atan(sinh($point->y)) * M_PI); return $point; }
public static function sinh($self, $a) { return sinh($a); }
/** * Calcula o seno hiperbólico do numero * @return Number */ public function sinh() { $this->num = sinh($this->num); return $this; }
public function tileToLat($y, $zoom = 12) { $n = pi() * (1 - 2 * $y / $this->numTiles($zoom)); return rad2deg(atan(sinh($n))); }
/** * This method returns the hyperbolic sine of this object's value. * * @access public * @static * @param IReal\Type $x the operand * @return IDouble\Type the result */ public static function sinh(IReal\Type $x) : IDouble\Type { return IDouble\Type::box(sinh($x->unbox())); }
public function sinhHook(&$parser, $expr = '') { try { $res = $this->exprParser->doExpression($expr); } catch (ExprError $e) { return $e->getMessage(); } $result = sinh($res); return $this->check($result); }
/** * Get latitude from tile x value * * @param int $y * @param int $zoom * @return float latitude */ public static function tileToLat($y, $zoom) { $n = pi() * (1 - 2 * $y / self::numTiles($zoom)); return rad2deg(atan(sinh($n))); }
/** * Returns the hyperbolic sine of of the angle. * * @param number $angle * @return number */ public function sinh($angle) { return sinh($angle); }
function csch($x) { return 1 / sinh($x); }
/** * IMSIN * * Returns the sine of a complex number in x + yi or x + yj text format. * * @param string $complexNumber * @return string */ public static function IMSIN($complexNumber) { $complexNumber = self::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); if (!is_array($parsedComplex)) { return $parsedComplex; } if ($parsedComplex['imaginary'] == 0.0) { return sin($parsedComplex['real']); } else { return self::COMPLEX(sin($parsedComplex['real']) * cosh($parsedComplex['imaginary']), cos($parsedComplex['real']) * sinh($parsedComplex['imaginary']), $parsedComplex['suffix']); } }
/** * Hyperbolic sine. * @link http://php.net/manual/en/function.sinh.php * @param float $number <p>The argument to process</p> * @return float The hyperbolic sine of <i>number</i> */ public static function sinh($number) { return sinh($number); }
/** * @return $this * @desc 双曲正弦。 */ public function sinh() { $this->current = sinh($this->toDouble()); return $this; }
/** * 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); }
echo rtrim("\t\tThese are a few words :) ... "); echo rtrim("\t\tThese are a few words :) ... ", " \t."); echo rtrim("\tExample string\n", ".."); echo chop("\t\tThese are a few words :) ... "); echo chop("\t\tThese are a few words :) ... ", " \t."); echo chop("\tExample string\n", ".."); echo acos(0.5); echo acosh(0.5); echo asin(0.5); echo asinh(0.5); echo atan(0.5); echo atan2(0.5, 0.5); echo atanh(0.5); echo cos(0.5); echo cosh(0.5); echo sin(0.5); echo sinh(0.5); echo tan(0.5); echo tanh(0.5); echo exp(5.7); echo exp(12); echo log10(12); echo log(12); echo sqrt(2); echo ceil(7.9); echo floor(7.9); echo fmod(5.7, 1.3); echo ip2long("127.0.0.1"); echo long2ip(pow(2, 32) + 1024); echo rad2deg(M_PI_4); echo deg2rad(45);
echo pow(2, 64) . "\n"; echo pow(2, 64.0) . "\n"; echo "rad2deg\n"; echo rad2deg(-2354) . " " . rad2deg("foo") . " " . rad2deg(0) . " " . rad2deg(5) . rad2deg(1.2345) . "\n"; echo "rand\n"; for ($i = 0; $i < 1000; $i++) { $zot[rand(0, 2)] = "foo!\n"; } sort($zot); print_r($zot); echo "round\n"; echo round(-2354) . " " . round("foo") . " " . round(0) . " " . round(5) . round(1.2345) . "\n"; echo "sin\n"; echo sin(-2354) . " " . sin("foo") . " " . sin(0) . " " . sin(5) . sin(1.2345) . "\n"; echo "sinh\n"; echo sinh(-2354) . " " . sinh("foo") . " " . sinh(0) . " " . sinh(5) . sinh(1.2345) . "\n"; echo "sqrt\n"; echo sqrt(-2354) . " " . sqrt("foo") . " " . sqrt(0) . " " . sqrt(5) . sqrt(1.2345) . "\n"; echo "srand\n"; srand(12); echo "(no output)\n"; echo "tan\n"; echo tan(-2354) . " " . tan("foo") . " " . tan(0) . " " . tan(5) . tan(1.2345) . "\n"; echo "tanh\n"; echo tanh(-2354) . " " . tanh("foo") . " " . tanh(0) . " " . tanh(5) . tanh(1.2345) . "\n"; echo "is_finite\n"; if (is_finite(1)) { echo "works."; } if (is_finite(log(0))) { echo " broken";
private function tileToLatLon($xtile, $ytile, $zoom) { $n = pow(2, $zoom); $lon_deg = $xtile / $n * 360.0 - 180.0; $lat_deg = rad2deg(atan(sinh(pi() * (1 - 2 * $ytile / $n)))); return array($lat_deg, $lon_deg); }
public function catenary_H_A2_L1_L3_Q_ro($H, $A2, $L1, $L3, $Q, $ro) { $this->resArray['H'][1] = $L1; $this->resArray['H'][2] = $H - $L1; $this->resArray['H'][3] = 0; $this->resArray['H']['sum'] = $H; $this->resArray['A'][1] = 0; $this->resArray['A'][2] = $A2; $this->resArray['A'][3] = $L3; $this->resArray['A']['sum'] = $A2 + $L3; $this->resArray['L'][1] = $L1; $this->resArray['CWIM'] = $Q * (1 - $ro / 7700) * 9.81; $this->resArray['HF'] = 35626.7; $this->resArray['L'][2] = sinh($this->resArray['CWIM'] * $A2 / $this->resArray['HF']); $this->resArray['L'][3] = $L3; $this->resArray['L']['sum'] = $L1 + $L3 + $this->resArray['L'][2]; /* $this->resArray['alfa'][3] = $this->resArray['alfa'][2]; $this->resArray['delta'][2] = $this->resArray['alfa'][2]; $this->resArray['A'][3] = $this->resArray['L'][3] * sin($this->resArray['alfa'][3]); $this->resArray['H'][3] = sqrt(pow($this->resArray['L'][3],2) - pow($this->resArray['A'][3],2)); $this->resArray['A'][2] = $this->resArray['A']['sum'] - $this->resArray['A'][1] - $this->resArray['A'][3]; $this->resArray['R'][2] = $this->resArray['A'][2] / (1 - cos($this->resArray['alfa'][2])); $this->resArray['R'][3] = 0; $this->resArray['L'][2] = $this->resArray['delta'][2] * $this->resArray['R'][2]; $this->resArray['H'][2] = $this->resArray['R'][2] * sin($this->resArray['alfa'][2]); if (!$this->validator->validate($this->resArray['R'][2],'biggerThanZero')){ $this->resArray['error'] = 'Parametr error'; return $this->resArray; } $this->resArray['DLS'][2] = rad2deg((1 / $this->resArray['R'][2]) * 30.48); $this->resArray['H'][1] = $this->resArray['H']['sum'] - $this->resArray['H'][2] - $this->resArray['H'][3]; $this->resArray['L'][1] = $this->resArray['H'][1]; $this->resArray['L']['sum'] = $this->resArray['L'][1] + $this->resArray['L'][2] + $this->resArray['L'][3]; */ return $this->resArray; }
/** * 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()); } }