-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requestsmathsMathematical functionsMathematical functions
Description
@oscardssmith mentioned on discourse that IEEE 2018 recommends an nthroot(x, n) that computes the real nth-root of a real x, similar to the Matlab function nthroot and generalizing cbrt.
A possible implementation could be as simple as:
nthroot(x::Real, n::Integer) =
isodd(n) || x ≥ 0 ? copysign(abs(x)^(1//n), x) :
throw(DomainError("Exponentiation yielding a complex result requires a complex argument. Replace nthroot(x, n) with complex(x)^(1//n)."))though it's possible that we could have faster/more-accurate implementations in some special cases.
As discussed in #36534, it probably only makes sense to define this for x::Real arguments.
MasonProtter, oscardssmith, matrixbot123, mikmoore, Seelengrab and 3 more
Metadata
Metadata
Assignees
Labels
featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requestsmathsMathematical functionsMathematical functions