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

Clarify mathematical definition of lcm #56992

Merged
merged 1 commit into from
Jan 8, 2025
Merged

Clarify mathematical definition of lcm #56992

merged 1 commit into from
Jan 8, 2025

Conversation

LilithHafner
Copy link
Member

Some folks define lcm(x::T,y::T) as any z::T such that there exists a::T, b::T with a*x==z and b*y==z and for all zʹ::T such that there exist a::T, b::T with a*x==zʹ and b*y==zʹ, there also exists c::T with z*c==zʹ. This is a reasonable definition, but not what we use. Notably, it makes lcm(x::Rational, y::Rational) = z::Rational true for all finite, nonzero x, y, and z.

The definition we use requires a, b, and c to all be integers, not rationals in the case of lcm(x::Rational, y::Rational). This clarifies what we mean when we define lcm(x::Rational, y::Rational) and also how the generic function should be extended.

See this thread for more discussion

cc @oscardssmith

@LilithHafner LilithHafner added docs This change adds or pertains to documentation maths Mathematical functions labels Jan 8, 2025
@LilithHafner LilithHafner merged commit 64d4c6b into master Jan 8, 2025
6 of 9 checks passed
@LilithHafner LilithHafner deleted the lh/lcm-doc branch January 8, 2025 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation maths Mathematical functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants