FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mathjs/src/function/trigonometry/asec.js at develop · husayt/mathjs · GitHub
husayt
/
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
/
asec.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
48 lines (44 loc) · 1.25 KB
Breadcrumbs
mathjs
/
src
/
function
/
trigonometry
/
asec.js
Copy path
File metadata and controls
48 lines (44 loc) · 1.25 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
import
{
factory
}
from
'../../utils/factory.js'
import
{
asecNumber
}
from
'../../plain/number/index.js'
const
name
=
'asec'
const
dependencies
=
[
'typed'
,
'config'
,
'Complex'
,
'BigNumber'
]
export
const
createAsec
=
/* #__PURE__ */
factory
(
name
,
dependencies
,
(
{
typed
,
config
,
Complex
,
BigNumber
}
)
=>
{
/**
* Calculate the inverse secant of a value. Defined as `asec(x) = acos(1/x)`.
*
* To avoid confusion with the matrix arcsecant, this function does not
* apply to matrices.
*
* Syntax:
*
* math.asec(x)
*
* Examples:
*
* math.asec(2) // returns 1.0471975511965979
* math.asec(math.sec(1.5)) // returns 1.5
*
* math.asec(0.5) // returns Complex 0 + 1.3169578969248166i
*
* See also:
*
* acos, acot, acsc
*
*
@param
{
number | BigNumber | Complex
} x Function input
*
@return
{
number | BigNumber | Complex
} The arc secant of x
*/
return
typed
(
name
,
{
number
:
function
(
x
)
{
if
(
x
<=
-
1
||
x
>=
1
||
config
.
predictable
)
{
return
asecNumber
(
x
)
}
return
new
Complex
(
x
,
0
)
.
asec
(
)
}
,
Complex
:
function
(
x
)
{
return
x
.
asec
(
)
}
,
BigNumber
:
function
(
x
)
{
return
new
BigNumber
(
1
)
.
div
(
x
)
.
acos
(
)
}
}
)
}
)
Back
|
FazBrowse Home
|
New Git URL