Quotient and remainder - MATLAB quorem (2024)

Quotient and remainder

collapse all in page

Syntax

[Q,R] =quorem(A,B,var)

[Q,R] =quorem(A,B)

Description

example

[Q,R] =quorem(A,B,var) divides A by B and returns the quotient Q and remainder R of the division, such that A = Q*B + R. This syntax regards A and B as polynomials in the variable var.

If A and B are matrices, quorem performs elements-wise division, using var as a variable. It returns the quotient Q and remainder R of the division, such that A = Q.*B + R.

example

[Q,R] =quorem(A,B) uses the variable determined by symvar(A,1). If symvar(A,1) returns an empty symbolic object sym([]), then quorem uses the variable determined by symvar(B,1).

If both symvar(A,1) and symvar(B,1) are empty, then A and B must both be integers or matrices with integer elements. In this case, quorem(A,B) returns symbolic integers Q and R, such that A = Q*B + R. If A and B are matrices, then Q and R are symbolic matrices with integer elements, such that A = Q.*B + R, and each element of R is smaller in absolute value than the corresponding element of B.

Examples

Divide Multivariate Polynomials

Compute the quotient and remainder of the division of these multivariate polynomials with respect to the variable y:

syms x yp1 = x^3*y^4 - 2*x*y + 5*x + 1;p2 = x*y;[q, r] = quorem(p1, p2, y)
q =x^2*y^3 - 2 r =5*x + 1

Divide Univariate Polynomials

Compute the quotient and remainder of the division of these univariate polynomials:

syms xp = x^3 - 2*x + 5;[q, r] = quorem(x^5, p)
q =x^2 + 2r =- 5*x^2 + 4*x - 10

Divide Integers

Compute the quotient and remainder of the division of these integers:

[q, r] = quorem(sym(10)^5, sym(985))
q =101 r =515

Input Arguments

collapse all

ADividend (numerator)
symbolic integer | polynomial | symbolic vector | symbolic matrix

Dividend (numerator), specified as a symbolic integer, polynomial, or a vector or matrix of symbolic integers or polynomials.

BDivisor (denominator)
symbolic integer | polynomial | symbolic vector | symbolic matrix

Divisor (denominator), specified as a symbolic integer, polynomial, or a vector or matrix of symbolic integers or polynomials.

varPolynomial variable
symbolic variable

Polynomial variable, specified as a symbolic variable.

Output Arguments

collapse all

Q — Quotient of the division
symbolic integer | symbolic expression | symbolic vector | symbolic matrix

Quotient of the division, returned as a symbolic integer, expression, or a vector or matrix of symbolic integers or expressions.

R — Remainder of the division
symbolic integer | symbolic expression | symbolic vector | symbolic matrix

Remainder of the division, returned as a symbolic integer, expression, or a vector or matrix of symbolic integers or expressions.

Version History

Introduced before R2006a

See Also

deconv | mod

MATLAB Command

You clicked a link that corresponds to this MATLAB command:

 

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Quotient and remainder - MATLAB quorem (1)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

Europe

Asia Pacific

Contact your local office

Quotient and remainder - MATLAB quorem (2024)

References

Top Articles
Latest Posts
Article information

Author: Pres. Carey Rath

Last Updated:

Views: 6202

Rating: 4 / 5 (61 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Pres. Carey Rath

Birthday: 1997-03-06

Address: 14955 Ledner Trail, East Rodrickfort, NE 85127-8369

Phone: +18682428114917

Job: National Technology Representative

Hobby: Sand art, Drama, Web surfing, Cycling, Brazilian jiu-jitsu, Leather crafting, Creative writing

Introduction: My name is Pres. Carey Rath, I am a faithful, funny, vast, joyous, lively, brave, glamorous person who loves writing and wants to share my knowledge and understanding with you.