FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mathjs/src/function/trigonometry/asech.js at develop · mkloeppner/mathjs · GitHub
mkloeppner
/
mathjs
Public
forked from
josdejong/mathjs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
mathjs
/
src
/
function
/
trigonometry
/
asech.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
53 lines (47 loc) · 1.37 KB
Breadcrumbs
mathjs
/
src
/
function
/
trigonometry
/
asech.js
Copy path
File metadata and controls
53 lines (47 loc) · 1.37 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
{
factory
}
from
'../../utils/factory.js'
import
{
asechNumber
}
from
'../../plain/number/index.js'
const
name
=
'asech'
const
dependencies
=
[
'typed'
,
'config'
,
'Complex'
,
'BigNumber'
]
export
const
createAsech
=
/* #__PURE__ */
factory
(
name
,
dependencies
,
(
{
typed
,
config
,
Complex
,
BigNumber
}
)
=>
{
/**
* Calculate the hyperbolic arcsecant of a value,
* defined as `asech(x) = acosh(1/x) = ln(sqrt(1/x^2 - 1) + 1/x)`.
*
* To avoid confusion with the matrix hyperbolic arcsecant, this function
* does not apply to matrices.
*
* Syntax:
*
* math.asech(x)
*
* Examples:
*
* math.asech(0.5) // returns 1.3169578969248166
*
* See also:
*
* acsch, acoth
*
*
@param
{
number | BigNumber | Complex
} x Function input
*
@return
{
number | BigNumber | Complex
} Hyperbolic arcsecant of x
*/
return
typed
(
name
,
{
number
:
function
(
x
)
{
if
(
(
x
<=
1
&&
x
>=
-
1
)
||
config
.
predictable
)
{
const
xInv
=
1
/
x
if
(
xInv
>
0
||
config
.
predictable
)
{
return
asechNumber
(
x
)
}
const
ret
=
Math
.
sqrt
(
xInv
*
xInv
-
1
)
return
new
Complex
(
Math
.
log
(
ret
-
xInv
)
,
Math
.
PI
)
}
return
new
Complex
(
x
,
0
)
.
asech
(
)
}
,
Complex
:
function
(
x
)
{
return
x
.
asech
(
)
}
,
BigNumber
:
function
(
x
)
{
return
new
BigNumber
(
1
)
.
div
(
x
)
.
acosh
(
)
}
}
)
}
)
Back
|
FazBrowse Home
|
New Git URL