blob: 9b24cbbeaf471f512bd288319637077d0cb46644 (
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
92
93
94
95
96
97
98
99
100
101
102
|
---
title: Math.cosh()
slug: Web/JavaScript/Reference/Global_Objects/Math/cosh
tags:
- JavaScript
- Math
- Method
- Reference
translation_of: Web/JavaScript/Reference/Global_Objects/Math/cosh
---
<div>{{JSRef}}</div>
<p>Die <strong><code>Math.cosh()</code></strong> Funktion gibt den Cosinus Hyperbolicus einer Zahl zurück. Dieser kann mit dem Einsatz der {{jsxref("Math.E", "Eulerschen Zahl", "", 1)}} folgendermaßen berechnet werden:</p>
<p><math display="block"><semantics><mrow><mstyle mathvariant="monospace"><mo lspace="0em" rspace="thinmathspace">Math.cosh(x)</mo></mstyle><mo>=</mo><mfrac><mrow><msup><mi>e</mi><mi>x</mi></msup><mo>+</mo><msup><mi>e</mi><mrow><mo>-</mo><mi>x</mi></mrow></msup></mrow><mn>2</mn></mfrac></mrow><annotation encoding="TeX">\mathtt{\operatorname{Math.cosh(x)}} = \frac{e^x + e^{-x}}{2}</annotation></semantics></math></p>
<div>{{EmbedInteractiveExample("pages/js/math-cosh.html")}}</div>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox"><code>Math.cosh(<var>x</var>)</code></pre>
<h3 id="Parameter">Parameter</h3>
<dl>
<dt><code>x</code></dt>
<dd>Eine Zahl.</dd>
</dl>
<h3 id="Rückgabewert">Rückgabewert</h3>
<p>Der hyperbolische Cosinus der übergebenen Zahl.</p>
<h2 id="Beschreibung">Beschreibung</h2>
<p>Weil <code>cosh()</code> eine statische Funktion von <code>Math</code> ist, wird es immer als <code>Math.cosh()</code> eingesetzt<code>,</code> jedoch nicht als Methode eines erzeugten <code>Math</code> Objektes (<code>Math</code> ist kein Konstruktor).</p>
<h2 id="Beispiele">Beispiele</h2>
<h3 id="Einsatz_von_Math.cosh()">Einsatz von <code>Math.cosh()</code></h3>
<pre class="brush: js">Math.cosh(0); // 1
Math.cosh(1); // 1.5430806348152437
Math.cosh(-1); // 1.5430806348152437
</pre>
<h2 id="Polyfill">Polyfill</h2>
<p>Diese Funktion kann mit Hilfe der Funktion {{jsxref("Math.exp()")}} emuliert werden:</p>
<pre class="brush: js">Math.cosh = Math.cosh || function(x) {
return (Math.exp(x) + Math.exp(-x)) / 2;
}
</pre>
<p>Oder nur mit einem Aufruf der {{jsxref("Math.exp()")}} Funktion:</p>
<pre class="brush: js">Math.cosh = Math.cosh || function(x) {
var y = Math.exp(x);
return (y + 1 / y) / 2;
};
</pre>
<h2 id="Spezifikationen">Spezifikationen</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Spezifikation</th>
<th scope="col">Status</th>
<th scope="col">Kommentar</th>
</tr>
<tr>
<td>{{SpecName('ES6', '#sec-math.cosh', 'Math.cosh')}}</td>
<td>{{Spec2('ES6')}}</td>
<td>Initiale Definition.</td>
</tr>
<tr>
<td>{{SpecName('ESDraft', '#sec-math.cosh', 'Math.cosh')}}</td>
<td>{{Spec2('ESDraft')}}</td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="Browserkompatibilität">Browserkompatibilität</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.cosh")}}</p>
<h2 id="Siehe_auch">Siehe auch</h2>
<ul>
<li>{{jsxref("Math.acosh()")}}</li>
<li>{{jsxref("Math.asinh()")}}</li>
<li>{{jsxref("Math.atanh()")}}</li>
<li>{{jsxref("Math.sinh()")}}</li>
<li>{{jsxref("Math.tanh()")}}</li>
</ul>
|