blob: 3b89299f29273a5a58c241ae482465309e41e297 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
---
title: Math.asinh()
slug: Web/JavaScript/Reference/Global_Objects/Math/asinh
translation_of: Web/JavaScript/Reference/Global_Objects/Math/asinh
original_slug: Web/JavaScript/Referencia/Objetos_globales/Math/asinh
---
<div>{{JSRef}}</div>
<p>La función <strong><code>Math.asinh()</code></strong> retorna el arcoseno hyperbólico de un número, es decir</p>
<p><math display="block"><semantics><mrow><mstyle mathvariant="monospace"><mrow><mo lspace="0em" rspace="thinmathspace">Math.asinh</mo><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow></mstyle><mo>=</mo><mo lspace="0em" rspace="thinmathspace">arsinh</mo><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mtext> the unique </mtext><mspace width="thickmathspace"></mspace><mi>y</mi><mspace width="thickmathspace"></mspace><mtext>such that</mtext><mspace width="thickmathspace"></mspace><mo lspace="0em" rspace="0em">sinh</mo><mo stretchy="false">(</mo><mi>y</mi><mo stretchy="false">)</mo><mo>=</mo><mi>x</mi></mrow><annotation encoding="TeX">\mathtt{\operatorname{Math.asinh}(x)} = \operatorname{arsinh}(x) = \text{ the unique } \; y \; \text{such that} \; \sinh(y) = x</annotation></semantics></math></p>
<h2 id="Sintáxis">Sintáxis</h2>
<pre class="syntaxbox"><code>Math.asinh(<var>x</var>)</code></pre>
<h3 id="Parámetros">Parámetros</h3>
<dl>
<dt><code>x</code></dt>
<dd>Un número.</dd>
</dl>
<h3 id="Valor_de_retorno">Valor de retorno</h3>
<p>El arcoseno hyperbólico del número dado.</p>
<h2 id="Descripción">Descripción</h2>
<p>Debido a que <code>asinh()</code> es un método estático de <code>Math</code>, siempre hay que usarlo como <code>Math.asinh()</code>, en lugar de como un método del objeto <code>Math</code> que se hayamos creado (<code>Math</code> no es un constructor).</p>
<h2 id="Ejemplos">Ejemplos</h2>
<h3 id="Usos_de_Math.asinh()">Usos de <code>Math.asinh()</code></h3>
<pre class="brush: js">Math.asinh(1); // 0.881373587019543
Math.asinh(0); // 0
</pre>
<h2 id="Polyfill">Polyfill</h2>
<p>As a quick and dirty hack the expression <math><semantics><mrow><mo lspace="0em" rspace="thinmathspace">arsinh</mo><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mo lspace="0em" rspace="0em">ln</mo><mrow><mo>(</mo><mrow><mi>x</mi><mo>+</mo><msqrt><mrow><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><mn>1</mn></mrow></msqrt></mrow><mo>)</mo></mrow></mrow><annotation encoding="TeX">\operatorname {arsinh} (x) = \ln \left(x + \sqrt{x^{2} + 1} \right)</annotation></semantics></math> may be used directly for a coarse emulation by the following function:</p>
<pre class="brush: js">Math.asinh = Math.asinh || function(x) {
if (x === -Infinity) {
return x;
} else {
return Math.log(x + Math.sqrt(x * x + 1));
}
};
</pre>
<p>Been formally correct it suffers from a number of issues related to floating point computations. Accurate result requires special handling of positive/negative, small/large arguments as it done e.g. in <a href="https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/ieee754/dbl-64/s_asinh.c">glibc</a> or <a href="http://git.savannah.gnu.org/cgit/gsl.git/tree/sys/invhyp.c">GNU Scientific Library</a>.</p>
<h2 id="Especificaciones">Especificaciones</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('ES6', '#sec-math.asinh', 'Math.asinh')}}</td>
<td>{{Spec2('ES6')}}</td>
<td>Initial definition.</td>
</tr>
<tr>
<td>{{SpecName('ESDraft', '#sec-math.asinh', 'Math.asinh')}}</td>
<td>{{Spec2('ESDraft')}}</td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="Compatibilidades_de_buscadores">Compatibilidades de buscadores</h2>
<p>{{Compat("javascript.builtins.Math.asinh")}}</p>
<h2 id="See_also">See also</h2>
<ul>
<li>{{jsxref("Math.acosh()")}}</li>
<li>{{jsxref("Math.atanh()")}}</li>
<li>{{jsxref("Math.cosh()")}}</li>
<li>{{jsxref("Math.sinh()")}}</li>
<li>{{jsxref("Math.tanh()")}}</li>
</ul>
|