Difference between revisions of "ExtendedGCD Command"

From GeoGebra Manual
Jump to: navigation, search
 
Line 5: Line 5:
 
:Results are calculated by applying the [[w:Extended_Euclidean_algorithm|Extended Euclidean algorithm]].  
 
:Results are calculated by applying the [[w:Extended_Euclidean_algorithm|Extended Euclidean algorithm]].  
  
{{example| 1=<code><nowiki>ExtendedGCD(240,46)</nowiki></code> yields {<math>-9,47,2</math>}. (Plugging the result into the Bézout's identity we have: <math>-9 \cdot 240+47 \cdot 46=2</math>). }}
+
{{example| 1=<code><nowiki>ExtendedGCD(240,46)</nowiki></code> yields {<math>-9,47,2</math>}. <br> (Plugging the result into the Bézout's identity we have: <math>-9 \cdot 240+47 \cdot 46=2</math>). }}
  
  
Line 13: Line 13:
 
:Results are calculated by applying the [[w:Extended_Euclidean_algorithm|Extended Euclidean algorithm]].  
 
:Results are calculated by applying the [[w:Extended_Euclidean_algorithm|Extended Euclidean algorithm]].  
  
{{example| 1=<code><nowiki>ExtendedGCD(x^2-1,x+4)</nowiki></code> yields {<math>1,-x+4,15</math>}. (Plugging the result into the Bézout's identity for polynomials we have: <math>1 \cdot (x^2-1) + (-x+4) \cdot (x+4) = 15</math>). }}
+
{{example| 1=<code><nowiki>ExtendedGCD(x^2-1,x+4)</nowiki></code> yields {<math>1,-x+4,15</math>}. <br> (Plugging the result into the Bézout's identity for polynomials we have: <math>1 \cdot (x^2-1) + (-x+4) \cdot (x+4) = 15</math>). }}
  
 
{{notes|1=<div>
 
{{notes|1=<div>
 
*The GCD of two polynomials is not unique (it's unique up to a scalar multiple).
 
*The GCD of two polynomials is not unique (it's unique up to a scalar multiple).
 
*See also [[GCD Command]].</div>}}
 
*See also [[GCD Command]].</div>}}

Latest revision as of 15:31, 2 May 2023


CAS Syntax

ExtendedGCD( <Integer>,<Integer> )
Returns a list containing the integer coefficients s, t of Bézout's identity as+bt= GCD(a,b) and the greatest common divisor of the given integers a and b.
Results are calculated by applying the Extended Euclidean algorithm.
Example: ExtendedGCD(240,46) yields {-9,47,2}.
(Plugging the result into the Bézout's identity we have: -9 \cdot 240+47 \cdot 46=2).



ExtendedGCD( <Polynomial>, <Polynomial> )
Returns a list containing the polynomial coefficients S(x), T(x) of Bézout's identity for polynomials A(x)S(x) + B(x)T(x) = GCD(A(x), B(x)) and the greatest common divisor of the given polynomialsA(x) and B(x).
Results are calculated by applying the Extended Euclidean algorithm.
Example: ExtendedGCD(x^2-1,x+4) yields {1,-x+4,15}.
(Plugging the result into the Bézout's identity for polynomials we have: 1 \cdot (x^2-1) + (-x+4) \cdot (x+4) = 15).


Notes:
  • The GCD of two polynomials is not unique (it's unique up to a scalar multiple).
  • See also GCD Command.
© 2024 International GeoGebra Institute