simplifyFraction

Simplify symbolic rational expressions

Syntax

simplifyFraction(expr)
simplifyFraction(expr,'Expand',true)

Description

example

simplifyFraction(expr) simplifies the rational expression expr such that the numerator and denominator have no divisors in common.

example

simplifyFraction(expr,'Expand',true) expands the numerator and denominator of the resulting simplified fraction as polynomials without factorization.

Examples

collapse all

Simplify two rational expressions by using simplifyFraction.

syms x y
fraction = (x^2-1)/(x+1);
simplifyFraction(fraction)
ans =
x - 1
fraction = (y*(x^2-1))/((x+1)*(x-1));
simplifyFraction(fraction)
ans =
y

Create a rational expression. Simplify the expression by using simplifyFraction.

syms x y
fraction = ((y+1)^2*(x^2-1))/((x+1)*(x-1)^2);
simplifyFraction(fraction)
ans =
(y + 1)^2/(x - 1)

Simplify the same rational expression again. Expand the numerator and denominator of the resulting fraction by setting 'Expand' to true.

simplifyFraction(fraction,'Expand',true)
ans =
(y^2 + 2*y + 1)/(x - 1)

Simplify rational expressions by using simplifyFraction.

syms x
expr = ((x^2+2*x+1)/(x+1))^(1/2);
simplifyFraction(expr)
ans =
(x + 1)^(1/2)

Simplify rational expressions that contain irrational subexpressions instead of variables.

expr = (1-sin(x)^2)/(1-sin(x));
simplifyFraction(expr)
ans =
sin(x) + 1

simplifyFraction does not apply algebraic identities to simplify the rational expression. Show that simplifyFraction does not apply standard trigonometric identities.

expr = (1-cos(x)^2)/sin(x);
simplifyFraction(expr)
ans =
-(cos(x)^2 - 1)/sin(x)

Input Arguments

collapse all

Input, specified as a number, vector, matrix, or array, or a symbolic number, variable, array, function, or expression.

Tips

  • expr can contain irrational subexpressions, such as sin(x) and x^(-1/3). simplifyFraction simplifies such expressions as if they were variables.

  • simplifyFraction does not apply algebraic identities.

Alternatives

You can also simplify rational expressions using the general simplification function simplify. However, simplifyFraction is more efficient for simplifying rational expressions.

Introduced in R2011b