LongDivision - Maple Help

Student[Basics]

 LongDivision
 generate steps for numeric and polynomial long division

 Calling Sequence Student[Basics][LongDivision]( dividend, divisor ) Student[Basics][LongDivision]( dividend, divisor, variable )

Parameters

 dividend - integer, float, or polynomial divisor - integer, float, or polynomial variable - (optional) name output - identical(typeset,string,qr,printf); (optional) format of result digits - nonnegint (optional) decimaldigits - nonnegint (optional)

Description

 • The LongDivision command shows the steps in dividing dividend/divisor by constructing a tableau:

quotient

---------------

divisor ) dividend

... steps ...

 • This command shows the steps for polynomial, integer, and floating-point long division.
 • When divisor and/or dividend are polynomials, the inputs may first be rearranged in a standard form as returned by collect.  If no variable is given for which to collect the terms by, it picks a variable for you.
 • The default output format, typeset, is chosen for the best visual display in the standard document interface.  The output option can be set to printf for an alternate, character based visual display. The string output is the same character based format as printf, but returned as a string, so that it can be further processed in your own code.  Note that when the string output is displayed, it is center-formatted and will not look as good as output=printf.  The output=qr option returns a pair of values: the quotient as computed, and the number at the bottom of the tableau (the remainder for exact integer and polynomial division).
 • When dividing numbers, there are two similar options for controlling how far to proceed if a zero remainder is not reached.  Both options only apply after exhausting the digits in the dividend.  After this, the digits=n option causes division to continue until n significant digits have been computed in the quotient.  Alternately, the decimaldigits=m causes division to continue until m digits have been computed to the right of the decimal point in the quotient.

Package Usage

 • This function is part of the Student[Basics] package, so it can be used in the short form LongDivision(..) only after executing the command with(Student[Basics]). However, it can always be accessed through the long form of the command by using Student[Basics][LongDivision](..).

Examples

 > $\mathrm{with}\left(\mathrm{Student}\left[\mathrm{Basics}\right]\right):$
 > $\mathrm{LongDivision}\left(1001,30\right)$
 (1)
 > $\mathrm{LongDivision}\left(1001,30,'\mathrm{decimaldigits}'=2\right)$
 (2)
 > $\mathrm{LongDivision}\left(48{x}^{4}+284{x}^{3}+620{x}^{2}+593x+210,2x+3\right)$
 $\begin{array}{cc}\stackrel{\phantom{\frac{{{x}}^{{2}}}{{2}}}}{{\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[{\mathrm{%+}}{}\left({2}{}{x}{,}{3}\right)\right]\right)}& \begin{array}{cccccc}{}& {24}{}{{x}}^{{3}}& {+}{106}{}{{x}}^{{2}}& {+}{151}{}{x}& {+}{70}& {}\\ {)}\phantom{{{x}}^{{2}}}& \phantom{{1}}{48}{}{{x}}^{{4}}& \phantom{{1}}{+}{284}{}{{x}}^{{3}}& \phantom{{1}}{+}{620}{}{{x}}^{{2}}& \phantom{{1}}{+}{593}{}{x}& \phantom{{1}}{+}{210}\\ {}& \multicolumn{2}{c}{\frac{{48}{}{{x}}^{{4}}{+}{72}{}{{x}}^{{3}}}{\phantom{{.}}}}& {}\\ {}& {}& \multicolumn{2}{c}{{212}{}{{x}}^{{3}}{+}{620}{}{{x}}^{{2}}}& {}& {}\\ {}& {}& \multicolumn{2}{c}{\frac{{212}{}{{x}}^{{3}}{+}{318}{}{{x}}^{{2}}}{\phantom{{.}}}}& {}& {}\\ {}& {}& {}& \multicolumn{2}{c}{{302}{}{{x}}^{{2}}{+}{593}{}{x}}& {}& {}& {}\\ {}& {}& {}& \multicolumn{2}{c}{\frac{{302}{}{{x}}^{{2}}{+}{453}{}{x}}{\phantom{{.}}}}& {}& {}& {}\\ {}& {}& {}& {}& \multicolumn{2}{c}{{140}{}{x}{+}{210}}& {}& {}& {}& {}\\ {}& {}& {}& {}& \multicolumn{2}{c}{\frac{{140}{}{x}{+}{210}}{\phantom{{.}}}}& {}& {}& {}& {}\\ {}& {}& {}& {}& {}& {0}\hfill & {}& {}& {}& {}& {}\end{array}\end{array}$ (3)
 > $\mathrm{LongDivision}\left(48{x}^{4}+284{x}^{3}+620{x}^{2}+593x+210,2x+3,'\mathrm{output}'='\mathrm{qr}'\right)$
 $\left[{24}{}{{x}}^{{3}}{+}{106}{}{{x}}^{{2}}{+}{151}{}{x}{+}{70}{,}{0}\right]$ (4)

Compatibility

 • The Student[Basics][LongDivision] command was introduced in Maple 2021.