Skip to content

Clarify mathematical definition of lcm#56992

Merged
LilithHafner merged 1 commit intomasterfrom
lh/lcm-doc
Jan 8, 2025
Merged

Clarify mathematical definition of lcm#56992
LilithHafner merged 1 commit intomasterfrom
lh/lcm-doc

Conversation

@LilithHafner
Copy link
Copy Markdown
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
@LilithHafner LilithHafner deleted the lh/lcm-doc branch January 8, 2025 18:37
LilithHafner added a commit that referenced this pull request Feb 14, 2025
See also:

Triage request for this:
#57067 (comment)
Similar PR for `lcm`: #56992
KristofferC pushed a commit that referenced this pull request Feb 14, 2025
See also:

Triage request for this:
#57067 (comment)
Similar PR for `lcm`: #56992

(cherry picked from commit 41a4dfa)
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