blob: 78696618361519f47e93dfffeba8994aa8068a17 (
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.acosh()
slug: Web/JavaScript/Reference/Global_Objects/Math/反双曲余弦值
tags:
- JavaScript
- 双曲函数
- 数学
- 方法
translation_of: Web/JavaScript/Reference/Global_Objects/Math/acosh
---
<div>{{JSRef}}</div>
<p><strong><code>Math.acosh()</code> </strong>函数返回一个数的反双曲余弦值,即:</p>
<p><math display="block"><semantics><mrow><mo>∀</mo><mi>x</mi><mo>≥</mo><mn>1</mn><mo>,</mo><mstyle mathvariant="monospace"><mrow><mo lspace="0em" rspace="thinmathspace">Math.acosh</mo><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow></mstyle><mo>=</mo><mo lspace="0em" rspace="thinmathspace">arcosh</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><mo>≥</mo><mn>0</mn><mspace width="thickmathspace"></mspace><mtext>such that</mtext><mspace width="thickmathspace"></mspace><mo lspace="0em" rspace="0em">cosh</mo><mo stretchy="false">(</mo><mi>y</mi><mo stretchy="false">)</mo><mo>=</mo><mi>x</mi></mrow><annotation encoding="TeX">\forall x \geq 1, \mathtt{\operatorname{Math.acosh}(x)} = \operatorname{arcosh}(x) = \text{ 唯一的} \; y \geq 0 \; \text{使得} \; \cosh(y) = x</annotation></semantics></math></p>
<div>{{EmbedInteractiveExample("pages/js/math-acosh.html")}}</div>
<h2 id="语法">语法</h2>
<pre class="syntaxbox"><code>Math.acosh(<var>x</var>)</code></pre>
<h3 id="参数">参数</h3>
<dl>
<dt><code>x</code></dt>
<dd>一个数字。</dd>
</dl>
<h3 id="返回值">返回值</h3>
<p>返回给定数的反双曲余弦值,如果该数小于 <strong>1</strong> 则返回 {{jsxref("NaN")}}。</p>
<h2 id="描述">描述</h2>
<p>因为 <code>acosh()</code> 是 <code>Math</code> 的静态方法,所以总应该直接调用 <code>Math.acosh()</code> ,而不是创建 <code>Math</code> 对象再调用该方法(<code>Math</code> 不是一个构造函数)。</p>
<h2 id="示例">示例</h2>
<h3 id="使用_Math.acosh">使用 <code>Math.acosh()</code></h3>
<pre class="brush: js">Math.acosh(-1); // NaN
Math.acosh(0); // NaN
Math.acosh(0.5); // NaN
Math.acosh(1); // 0
Math.acosh(2); // 1.3169578969248166
</pre>
<p>当参数小于1时, <code>Math.acosh()</code>将返回 {{jsxref("NaN")}}。</p>
<h2 id="向下兼容">向下兼容</h2>
<p>当 <math><semantics><mrow><mi>x</mi><mo>≥</mo><mn>1</mn></mrow><annotation encoding="TeX">x \geq 1</annotation></semantics></math> 时,都有 <math><semantics><mrow><mo lspace="0em" rspace="thinmathspace">arcosh</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 {arcosh} (x) = \ln \left(x + \sqrt{x^{2} - 1} \right)</annotation></semantics></math> ,因此可以使用以下函数实现:</p>
<pre class="brush: js">Math.acosh = Math.acosh || function(x) {
return Math.log(x + Math.sqrt(x * x - 1));
};
</pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('ESDraft', '#sec-math.acosh', 'Math.acosh')}}</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
<p>{{Compat("javascript.builtins.Math.acosh")}}</p>
<h2 id="参见">参见</h2>
<ul>
<li>{{jsxref("Math.asinh()")}}</li>
<li>{{jsxref("Math.atanh()")}}</li>
<li>{{jsxref("Math.cosh()")}}</li>
<li>{{jsxref("Math.sinh()")}}</li>
<li>{{jsxref("Math.tanh()")}}</li>
</ul>
|