euclid
Syntax
Description
Examples
Euclidean Division of Laurent Polynomials
Create two Laurent polynomials:
cfa = [1 3 5 7]; cfb = [1 2]; lpA = laurentPolynomial(Coefficients=cfa,MaxOrder=2); lpB = laurentPolynomial(Coefficients=cfb);
Perform Euclidean division of by . Use the helper function helperPrintLaurent
to print the quotient and remainder polynomials of each Euclidean division.
dec = euclid(lpA,lpB); numFac = size(dec,1); for k=1:numFac q = helperPrintLaurent(dec(k,1).LP); r = helperPrintLaurent(dec(k,2).LP); fprintf('Euclidean Division #%d\n',k) fprintf('Quotient: %s\n',q) fprintf('Remainder: %s\n \n',r) end
Euclidean Division #1
Quotient: z^(2) + z + 3
Remainder: + z^(-1)
Euclidean Division #2
Quotient: z^(2) + z + 3.5
Remainder: - 0.5
Euclidean Division #3
Quotient: z^(2) + 0.75*z + 3.5
Remainder: + 0.25*z
Euclidean Division #4
Quotient: 1.125*z^(2) + 0.75*z + 3.5
Remainder: - 0.125*z^(2)
For each Euclidean division, confirm that , where and are the quotient and remainder polynomials, respectively, of the ith division.
for k=1:numFac q = dec(k,1).LP; r = dec(k,2).LP; areEqual = (lpA==lpB*q+r); fprintf('Euclidean Division #%d: %d\n',k,areEqual) end
Euclidean Division #1: 1 Euclidean Division #2: 1 Euclidean Division #3: 1 Euclidean Division #4: 1
Input Arguments
A
— Laurent polynomial
laurentPolynomial
object
Laurent polynomial, specified as a laurentPolynomial
object.
B
— Laurent polynomial
laurentPolynomial
object
Laurent polynomial, specified as a laurentPolynomial
object.
Output Arguments
dec
— Euclidean algorithm factors
structure array
Euclidean algorithm factors, returned as a N-by-2 structure
array, where N ≤ 4 is the number of decompositions. The
ith row of dec
contains one Euclidean division
of A
by B
:
A = B*(dec(i,1).LP) +
dec(i,2).LP
where
dec(i,1).LP
is the Laurent polynomial corresponding to the quotient.dec(i,2).LP
is the Laurent polynomial corresponding to the remainder.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2021b
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)