Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document that inv(x) is not just for matrices #22610

Merged
merged 3 commits into from
Jul 2, 2017

Conversation

stevengj
Copy link
Member

inv(x) returns the multiplicative identity for any x, not just matrices, but this wasn't documented.

(See comments at JuliaMath/SpecialFunctions.jl#32.)

@stevengj stevengj added the domain:docs This change adds or pertains to documentation label Jun 29, 2017
base/number.jl Outdated
some types `inv(x)` may be slightly more efficient.

# Examples

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no blank line here

Copy link
Member

@Sacha0 Sacha0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! :)

base/number.jl Outdated
inv(x)

Return the multiplicative inverse of `x`, such that `x*inv(x)` or `inv(x)*x`
yields [`one(x)`](@ref) (the multiplicative identity).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @MikaelSlevinsky mentioned this isn't true. i.e. x*inv(x) or inv(x)*x does not yield one(x)

julia> x=49.0

julia> inv(x)*x
0.9999999999999999

julia> one(x)
1.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure on the best way to word this but probably best to write essentially yields instead of yields or something alike that doesn't imply inv(x)*x == one(x)

base/number.jl Outdated
Return the multiplicative inverse of `x`, such that `x*inv(x)` or `inv(x)*x`
yields [`one(x)`](@ref) (the multiplicative identity).

If `x` is a number, this is essentially the same as `one(x)/x`, but for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the same

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It need not be identical under roundoff errors, nor is it necessarily computationally identical. Hence "essentially"

@stevengj stevengj merged commit efb05d9 into JuliaLang:master Jul 2, 2017
@stevengj stevengj deleted the invdoc branch July 2, 2017 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants