AngouriMath
AsSingleFraction
Method (no overloads)
Summary
This expression written as a single fraction: one numerator over one denominator, with
nothing divided inside either, asa + b/c is written (a c + b)/c . Any
expression, functions included, and nothing cancelled or multiplied out, so the factors
of the denominator stay as they were:1/(t^2 + 1) + 1/(t + 1) is
(2 + t + t^2) / ((t^2 + 1)(t + 1)) , and x/x stays x/x . The common
denominator is the least common multiple of the denominators as they are written, so
1/x + 1/x^2 is (x + 1)/x^2 ; nothing is factorised to find it. A rational number
counts as the fraction it is written as, so2/3 + x/2 is (4 + 3x)/6 . An
expression with no division in it comes back as it was. Dividing by a fraction moves
its denominator into the numerator, and the expression has no value where that
denominator is zero, so the answer says so:1/(1/x) is x provided not x = 0 .
nothing divided inside either, as
expression, functions included, and nothing cancelled or multiplied out, so the factors
of the denominator stay as they were:
denominator is the least common multiple of the denominators as they are written, so
counts as the fraction it is written as, so
expression with no division in it comes back as it was. Dividing by a fraction moves
its denominator into the numerator, and the expression has no value where that
denominator is zero, so the answer says so:
Remarks
Simplify(System.Int32) never does this, since one fraction is not always the
simpler form:1/x + 1/y reads more easily than (x + y)/(x y) . For a
rational function in lowest terms, the denominator multiplied out and monic, use
RationalCanonicalization, which is a canonical form and
declines anything with a function in it.
#1239
simpler form:
rational function in lowest terms, the denominator multiplied out and monic, use
RationalCanonicalization, which is a canonical form and
declines anything with a function in it.
#1239
Example
Console.WriteLine("sin(x) + 1/cos(x)".ToEntity().AsSingleFraction());Prints
(1 + cos(x) * sin(x)) / cos(x)Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 4862 pages online