本文整理汇总了PHP中tanh函数的典型用法代码示例。如果您正苦于以下问题:PHP tanh函数的具体用法?PHP tanh怎么用?PHP tanh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tanh函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: calculate
public function calculate($data)
{
$this->data = $data;
$result = tanh($this->sum() * $this->beta * $this->betaWeight);
// $result = tanh($this->sum() * $this->beta * $this->betaWeight);
return $result;
}
开发者ID:Harry27PL,项目名称:si,代码行数:7,代码来源:NeuronSigmoidal.php
示例2: nicko
function nicko(&$irc, &$data)
{
$args = array_slice($data->messageex, 1);
$nick = $args[0];
if (strlen($nick) > 0) {
$this->score = $shifts = 0;
$special_cost = array('69' => 500, 'dea?th' => 500, 'dark' => 400, 'n[i1]ght' => 300, 'n[i1]te' => 500, 'fuck' => 500, 'sh[i1]t' => 500, 'coo[l1]' => 500, 'kew[l1]' => 500, 'lame' => 500, 'dood' => 500, 'dude' => 500, '[l1](oo?|u)[sz]er' => 500, '[l1]eet' => 500, 'e[l1]ite' => 500, '[l1]ord' => 500, 'pron' => 1000, 'warez' => 1000, 'xx' => 100, '\\[rkx]0' => 1000, '\\0[rkx]' => 1000);
foreach ($special_cost as $special => $cost) {
$special_pattern = $special;
if (ereg($special, $nick)) {
$this->punish($cost, "special");
}
}
$clean = eregi_replace("[^A-Z0-9]", "", $nick);
$this->punish(pow(10, strlen($nick) - strlen($clean)) - 1, "non-alha ({$clean} vs {$nick})");
$k3wlt0k_weights = array(5, 5, 2, 5, 2, 3, 1, 2, 2, 2);
for ($digit = 0; $digit < 10; $digit++) {
$this->punish($k3wlt0k_weights[$digit] * substr_count($nick, $digit), "leet digits");
}
$this->punish($this->slow_pow(9, similar_text($nick, strtoupper($nick))) - 1, "lowercase");
if (ereg("^.*[XZ]\$", $nick)) {
$this->punish(50, "lame endings");
}
if (eregi("[0-9][a-z]", $nick, $regs)) {
$shifts = @sizeof($regs) - 1;
unset($regs);
}
if (eregi("[a-z][0-9]", $nick, $regs)) {
$shifts = @sizeof($regs) - 1;
unset($regs);
}
$this->punish($this->slow_pow(9, $shifts) - 1, "shifts");
if (ereg("[A-Z]", $nick, $regs)) {
$caps = @sizeof($regs) - 1;
unset($regs);
$this->punish($this->slow_pow(7, $caps), "upper case");
}
$percentage = 100 * (1 + tanh(($this->score - 400) / 400)) * (1 - 1 / (1 + $this->score / 5)) / 2;
$digits = 2 * (2 - floor(log(100 - $percentage) / log(10)));
$out = "'{$nick}' is " . sprintf("%." . $digits . "f", $percentage) . "% lame";
} else {
$out = "'" . $data['nick'] . "' is 100% lame";
}
$this->talk($irc, $data, $out);
$this->log($irc, $data, $out);
}
开发者ID:BackupTheBerlios,项目名称:lulubot,代码行数:46,代码来源:nickometer.php
示例3: activation
function activation()
{
//calculate the outputs of the hidden neurons, the hidden neurons are tanh
for ($i = 0; $i < $this->numHidden; $i++) {
$hidVal =& $this->hiddenVal[$i];
$hidVal = 0.0;
for ($j = 0; $j < $this->numInputs; $j++) {
$hidVal = $hidVal + $this->trainInput[$this->patNum][$j] * $this->weightsIH[$j][$i];
}
$hidVal = tanh($hidVal);
}
//calculate the output of the network, the output neuron is linear
$this->outPred = 0.0;
for ($i = 0; $i < $this->numHidden; $i++) {
$this->outPred = $this->outPred + $this->hiddenVal[$i] * $this->weightsHO[$i];
}
//calculate the error
$this->errThisPat = $this->outPred - $this->trainOutput[$this->patNum];
}
开发者ID:0-php,项目名称:AI,代码行数:19,代码来源:multilayerperceptron.class.php
示例4: tanh
/**
* Returns the hyperbolic tangent of an angle.
*
* @param number $angle
* @return number
*/
public function tanh($angle)
{
return tanh($angle);
}
开发者ID:krishnaguragain,项目名称:math,代码行数:10,代码来源:MathExecutionEngine.php
示例5: tanh
/**
* Hyperbolic tangent.
* @link http://php.net/manual/en/function.tanh.php
* @param float $number <p>The argument to process</p>
* @return float The hyperbolic tangent of <i>number</i>
*/
public static function tanh($number)
{
return tanh($number);
}
开发者ID:charlanalves,项目名称:sped,代码行数:10,代码来源:Math.php
示例6: tanh
/**
* @param float $x A number
* @return float The hyperbolic tangent of the given value
*/
public function tanh($x)
{
return tanh($x);
}
开发者ID:neos,项目名称:flow-development-collection,代码行数:8,代码来源:MathHelper.php
示例7: define
<?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(tanh($longVal));
}
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:13,代码来源:tanh_basiclong_64bit.php
示例8: rtrim
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);
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:1596.php
示例9: tanh
public static function tanh($self, $a)
{
return tanh($a);
}
开发者ID:r3sist,项目名称:MathScript,代码行数:4,代码来源:mathscript.class.php
示例10: getCompatibilityByWeight
/**
*
* Get the compatibility by weight. Based on euclidean distance ...
* @param array $searchee
* @param array $candidate
* @param int $type
*/
function getCompatibilityByWeight($searchee = array(), $candidate = array(), $type = 1)
{
$commonItems = 0;
$sim = 0;
foreach ($searchee["MemberAttributeWeight"] as $weight_searchee) {
foreach ($candidate["MemberAttributeWeight"] as $weight_candidate) {
if ($weight_searchee["attribute_id"] == $weight_candidate["attribute_id"]) {
$attribute = $this->controller->Attribute->find("first", array("conditions" => array("Attribute.id" => $weight_candidate["attribute_id"])));
//if ($attribute["attribute_type_id"]==$type){
$commonItems++;
$weight1 = $weight_searchee["weight"];
$weight2 = $weight_candidate["weight"];
$sim += pow($weight1 - $weight2, 2);
//}
}
}
}
if ($commonItems > 0) {
$sim = sqrt($sim / $commonItems);
$sim = 1 - tanh($sim);
$maxItems = min(count($searchee["MemberAttributeWeight"]), count($candidate["MemberAttributeWeight"]));
$sim = $sim * ($commonItems / $maxItems);
}
return $sim;
}
开发者ID:redhattaccoss,项目名称:Qalanjo,代码行数:32,代码来源:match_maker.php
示例11: tanh
/**
* Calculate TANH, within bounds.
*
* @param
* double d The value to calculate for.
* @return double The result.
*/
function tanh($d)
{
return \Encog\MathUtil\BoundNumbers\bound(\tanh($d));
}
开发者ID:katrinaniolet,项目名称:encog-php-core,代码行数:11,代码来源:BoundMath.php
示例12: tanh
/**
* {@inheritdoc}
*/
public function tanh($angle)
{
return $this->withPrecision(tanh($angle));
}
开发者ID:stillat,项目名称:common,代码行数:7,代码来源:BinaryCalculatorExpressionEngine.php
示例13: processCoth
protected function processCoth()
{
$operands = $this->getOperands();
$operand = $operands[0];
if ($operand->getValue() == 0) {
return null;
} else {
if (is_infinite($operand->getValue())) {
return new Float(0.0);
}
}
return new Float(1 / tanh($operand->getValue()));
}
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:13,代码来源:MathOperatorProcessor.php
示例14: var_dump
<?php
/*
* proto float tanh(float number)
* Function is implemented in ext/standard/math.c
*/
$arg_0 = 1.0;
$extra_arg = 1;
echo "\nToo many arguments\n";
var_dump(tanh($arg_0, $extra_arg));
echo "\nToo few arguments\n";
var_dump(tanh());
开发者ID:badlamer,项目名称:hhvm,代码行数:12,代码来源:tanh_error.php
示例15: coth
/**
* Calculates the hyperbolic cotangent of the parameter
*
* @param float $x
* @returns mixed A floating point on success, PEAR_Error object otherwise
* @access public
*/
function coth($x)
{
/*{{{*/
$x = floatval($x);
$tanh = tanh($x);
if ($tanh == 0.0) {
return PEAR::raiseError('Undefined operation, hyperbolic tangent of parameter is zero');
} else {
return 1 / $tanh;
}
}
开发者ID:Esleelkartea,项目名称:kz-adeada-talleres-electricos-,代码行数:18,代码来源:TrigOp.php
示例16: tanh
/**
* This method returns the hyperbolic tangent of this object's value.
*
* @access public
* @static
* @param IReal\Type $x the operand
* @return IDouble\Type the result
*/
public static function tanh(IReal\Type $x) : IDouble\Type
{
return IDouble\Type::box(tanh($x->unbox()));
}
开发者ID:bluesnowman,项目名称:fphp-saber,代码行数:12,代码来源:Module.php
示例17: rand
<?php
if ($_GET['map'] == 'y') {
$url = "http://sat0" . rand(1, 4) . ".maps.yandex.net/tiles?l=sat&x=" . $_GET['x'] . "&y=" . $_GET['y'] . "&z=" . $_GET['z'] . "&g=" . substr("Gagarin", 0, rand(1, 8));
$url = "https://khms0.google.com/kh/v=184&src=app&x=" . $_GET['x'] . "&y=" . $_GET['y'] . "&z=" . $_GET['z'] . "&s=" . substr("Galileo", 0, rand(1, 8));
//echo "<a href='".$url."' target='_blank'>".$url."</a><br>";
//$exec='echo '.$_GET['x'].' '.$_GET['y'].' |cs2cs +proj=merc +ellps=WGS84 +to +proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6356752 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs';
//echo '<br>';
//$lonlat = explode(" ", exec($exec));
//print_r($lonlat);
//echo exec($exec);
/*echo '<br>';
echo $exec;*/
//$url = "http://sat0".rand(1, 4).".maps.yandex.net/tiles?l=sat&x=".round($lonlat[0])."&y=".round($lonlat[1])."&z=".$_GET['z']."&g=".substr("Gagarin", 0, rand(1, 8));
$xtile = $_GET['x'] / 111319.49079327358;
$ytile = rad2deg(asin(tanh($_GET['y'] / 20037508.342789244 * pi)));
echo $xtile . '<br>';
echo $ytile . '<br>';
$url = "http://sat0" . rand(1, 4) . ".maps.yandex.net/tiles?l=sat&x=" . round($lonlat[0]) . "&y=" . round($lonlat[1]) . "&z=" . $_GET['z'] . "&g=" . substr("Gagarin", 0, rand(1, 8));
//echo "<a href='".$url."' target='_blank'>".$url."</a><br>";
} else {
$url = "http://khms" . rand(1, 3) . ".google.com/kh/v=184&src=app&x=" . $_GET['x'] . "&y=" . $_GET['y'] . "&z=" . $_GET['z'] . "&s=" . substr("Galileo", 0, rand(1, 8));
}
if ($_GET['map'] != 'y') {
header('Content-Type: image/jpeg');
//header('Content-Length: ' . filesize($file));
//echo $url;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
开发者ID:steryoshkin,项目名称:fibers,代码行数:31,代码来源:google.php
示例18: lambert93ToWgs84
function lambert93ToWgs84($x, $y)
{
$x = number_format($x, 10, '.', '');
$y = number_format($y, 10, '.', '');
$b6 = 6378137.0;
$b7 = 298.257222101;
$b8 = 1 / $b7;
$b9 = 2 * $b8 - $b8 * $b8;
$b10 = sqrt($b9);
$b13 = 3.0;
$b14 = 700000.0;
$b15 = 12655612.0499;
$b16 = 0.725607765053267;
$b17 = 11754255.426096;
$delx = $x - $b14;
$dely = $y - $b15;
$gamma = atan(-$delx / $dely);
$r = sqrt($delx * $delx + $dely * $dely);
$latiso = log($b17 / $r) / $b16;
$sinphiit0 = tanh($latiso + $b10 * atanh($b10 * sin(1)));
$sinphiit1 = tanh($latiso + $b10 * atanh($b10 * $sinphiit0));
$sinphiit2 = tanh($latiso + $b10 * atanh($b10 * $sinphiit1));
$sinphiit3 = tanh($latiso + $b10 * atanh($b10 * $sinphiit2));
$sinphiit4 = tanh($latiso + $b10 * atanh($b10 * $sinphiit3));
$sinphiit5 = tanh($latiso + $b10 * atanh($b10 * $sinphiit4));
$sinphiit6 = tanh($latiso + $b10 * atanh($b10 * $sinphiit5));
$longrad = $gamma / $b16 + $b13 / 180 * pi();
$latrad = asin($sinphiit6);
$long = $longrad / pi() * 180;
$lat = $latrad / pi() * 180;
return array('y84' => $lat, 'x84' => $long);
}
开发者ID:HandiPressante,项目名称:HandiPressante-server,代码行数:32,代码来源:controller.php
示例19: tanh
/**
* Tangente hiperbólica
* @return Number
*/
public function tanh()
{
$this->num = tanh($this->num);
return $this;
}
开发者ID:laiello,项目名称:samusframework,代码行数:9,代码来源:Type_Number.php
示例20: dirname
*/
$file_path = dirname(__FILE__);
require $file_path . "/allowed_rounding_error.inc";
echo "tanh .5 = ";
var_dump(tanh(0.5));
if (allowed_rounding_error(tanh(0.5), 0.46211715726001)) {
echo "Pass\n";
} else {
echo "Fail\n";
}
echo "tanh -0.5 = ";
var_dump(tanh(-0.5));
if (allowed_rounding_error(tanh(-0.5), -0.46211715726001)) {
echo "Pass\n";
} else {
echo "Fail\n";
}
echo "tanh 3 = ";
var_dump(tanh(3.0));
if (allowed_rounding_error(tanh(3.0), 0.99505475368673)) {
echo "Pass\n";
} else {
echo "Fail\n";
}
echo "tanh -3 = ";
var_dump(tanh(-3.0));
if (allowed_rounding_error(tanh(-3.0), -0.99505475368673)) {
echo "Pass\n";
} else {
echo "Fail\n";
}
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:tanh_basic.php
注:本文中的tanh函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论