Geometric Representation of the Mutual Subtraction Algorithm
2018-10-18 12:41
This example visually demonstrates the execution process of the ancient Chinese mathematical algorithm 'Mutual Subtraction' (equivalent to the Euclidean algorithm for finding the greatest common divisor) through geometric figures. Using GeoGebra commands such as Polygon, IterationList, and Sequence, it dynamically illustrates the geometric changes during the continuous subtraction of two integers,
<?xml version="1.0" encoding="utf-8"?>
<geogebra format="5.0" version="5.0.477.0" app="classic" platform="d" id="ea491ba5-7145-4445-9c06-69cb81057ffb" xsi:noNamespaceSchemaLocation="http://www.geogebra.org/ggb.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<gui>
<window width="1366" height="768" />
<perspectives>
<perspective id="tmp">
<panes>
<pane location="" divider="0.31991215226939973" orientation="1" />
</panes>
<views>
<view id="4097" visible="false" inframe="true" stylebar="true" location="1,1,1,1" size="400" window="333,109,700,550" />
<view id="512" toolbar="0 | 1 501 5 19 , 67 | 2 15 45 18 , 7 37 | 514 3 9 , 13 44 , 47 | 16 | 551 550 11 , 20 22 21 23 , 55 56 57 , 12 | 69 | 510 511 , 512 513 | 533 531 , 534 532 , 522 523 , 537 536 , 535 | 521 520 | 36 , 38 49 560 | 571 30 29 570 31 33 | 17 | 540 40 41 42 , 27 28 35 , 6 , 502" visible="false" inframe="false" stylebar="false" location="1,1,1" size="500" window="100,100,600,400" />
<view id="4" toolbar="0 || 2020 , 2021 , 2022 , 66 || 2001 , 2003 , 2002 , 2004 , 2005 || 2040 , 2041 , 2042 , 2044 , 2043" visible="false" inframe="false" stylebar="false" location="1,1" size="300" window="100,100,600,400" />
<view id="8" toolbar="1001 | 1002 | 1003 || 1005 | 1004 || 1006 | 1007 | 1010 || 1008 1009 || 66 68 || 6" visible="false" inframe="false" stylebar="false" location="1,3" size="300" window="100,100,600,400" />
<view id="1" visible="true" inframe="false" stylebar="true" location="1" size="897" window="100,100,600,400" />
<view id="2" visible="true" inframe="false" stylebar="true" location="3" size="437" window="100,100,600,400" />
<view id="16" visible="false" inframe="false" stylebar="false" location="1" size="150" window="50,50,500,500" />
<view id="32" visible="false" inframe="false" stylebar="true" location="1" size="150" window="50,50,500,500" />
<view id="64" toolbar="0" visible="false" inframe="true" stylebar="true" location="1" size="150" window="50,50,500,500" />
<view id="70" toolbar="0 || 2020 || 2021 || 2022" visible="false" inframe="true" stylebar="true" location="1" size="150" window="50,50,500,500" />
</views>
<toolbar show="true" items="0 39 73 62 | 1 501 67 , 5 19 , 72 75 76 | 2 15 45 , 18 65 , 7 37 | 4 3 8 9 , 13 44 , 58 , 47 | 16 51 64 , 70 | 10 34 53 11 , 24 20 22 , 21 23 | 55 56 57 , 12 | 36 46 , 38 49 50 , 71 14 68 | 30 29 54 32 31 33 | 25 17 26 60 52 61 | 40 41 42 , 27 28 35 , 6 | 100001" position="1" help="false" />
<input show="true" cmd="true" top="algebra" />
<dockBar show="true" east="true" />
</perspective>
</perspectives>
<labelingStyle val="0"/>
<font size="12"/>
</gui>
<euclidianView>
<viewNumber viewNo="1"/>
<size width="897" height="575"/>
<coordSystem xZero="310.5012811806924" yZero="536.1827843994222" scale="27.367573866680274" yscale="27.36757386668034"/>
<evSettings axes="true" grid="false" gridIsBold="false" pointCapturing="1" rightAngleStyle="1" checkboxSize="26" gridType="3"/>
<bgColor r="255" g="255" b="255"/>
<axesColor r="0" g="0" b="0"/>
<gridColor r="192" g="192" b="192"/>
<lineStyle axes="9" grid="0"/>
<axis id="0" show="true" label="" unitLabel="" tickStyle="1" showNumbers="true"/>
<axis id="1" show="true" label="" unitLabel="" tickStyle="1" showNumbers="true"/>
</euclidianView>
<kernel>
<continuous val="false"/>
<usePathAndRegionParameters val="true"/>
<decimals val="2"/>
<angleUnit val="degree"/>
<algebraStyle val="2" spreadsheet="0"/>
<coordStyle val="0"/>
</kernel>
<scripting blocked="false" disabled="false"/>
<construction title="" author="" date="">
<element type="point" label="A">
<show object="false" label="true" ev="4"/>
<objColor r="77" g="77" b="255" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<javascript onUpdate="var a,b,c a=ggbApplet.getValue("a") b=ggbApplet.getValue("b") c=counttimes(a,b) ggbApplet.setValue("steps",0) ggbApplet.setValue("n",c)"/>
<coords x="15.437931066797823" y="10.201225207592245" z="1.0"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<command name="DynamicCoordinates">
<input a0="A" a1="abs(round(x(A)))" a2="abs(round(y(A)))"/>
<output a0="B"/>
</command>
<element type="point" label="B">
<show object="true" label="false" ev="4"/>
<objColor r="68" g="68" b="68" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="1" playing="false"/>
<coords x="15.0" y="10.0" z="1.0"/>
<pointSize val="4"/>
<pointStyle val="0"/>
</element>
<expression label="a" exp="x(B)" />
<element type="numeric" label="a">
<value val="15.0"/>
<symbolic val="true" />
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
</element>
<expression label="b" exp="y(B)" />
<element type="numeric" label="b">
<value val="10.0"/>
<symbolic val="true" />
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
</element>
<element type="numeric" label="n">
<value val="3.0"/>
<symbolic val="true" />
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
<layer val="0"/>
<labelMode val="1"/>
<slider min="0" max="100" absoluteScreenLocation="true" width="200.0" x="30.0" y="90.0" fixed="false" horizontal="true" showAlgebra="false"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<animation speed="1" type="0" playing="false"/>
</element>
<element type="numeric" label="steps">
<value val="0.0"/>
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
<layer val="0"/>
<labelMode val="1"/>
<slider min="0" max="n" absoluteScreenLocation="true" width="200.0" x="88.0" y="78.0" fixed="false" horizontal="true" showAlgebra="true"/>
<lineStyle thickness="10" type="0" typeHidden="1"/>
<animation step="1" speed="1" type="0" playing="false"/>
</element>
<command name="Polygon">
<input a0="(0, 0)" a1="(x(B), 0)" a2="B" a3="(0, y(B))"/>
<output a0="q1" a1="f" a2="g" a3="b_1" a4="h"/>
</command>
<element type="polygon" label="q1">
<lineStyle thickness="5" type="0" typeHidden="1" opacity="178"/>
<show object="true" label="false" ev="4"/>
<objColor r="153" g="51" b="0" alpha="0.10000000149011612"/>
<layer val="0"/>
<labelMode val="0"/>
</element>
<element type="segment" label="f">
<show object="true" label="false"/>
<objColor r="153" g="51" b="0" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<auxiliary val="false"/>
<coords x="0.0" y="15.0" z="0.0"/>
<lineStyle thickness="5" type="0" typeHidden="1" opacity="178"/>
<outlyingIntersections val="false"/>
<keepTypeOnTransform val="true"/>
</element>
<element type="segment" label="g">
<show object="true" label="false"/>
<objColor r="153" g="51" b="0" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<auxiliary val="false"/>
<coords x="-10.0" y="0.0" z="150.0"/>
<lineStyle thickness="5" type="0" typeHidden="1" opacity="178"/>
<outlyingIntersections val="false"/>
<keepTypeOnTransform val="true"/>
</element>
<element type="segment" label="b_1">
<show object="true" label="false"/>
<objColor r="153" g="51" b="0" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<auxiliary val="false"/>
<coords x="0.0" y="-15.0" z="150.0"/>
<lineStyle thickness="5" type="0" typeHidden="1" opacity="178"/>
<outlyingIntersections val="false"/>
<keepTypeOnTransform val="true"/>
</element>
<element type="segment" label="h">
<show object="true" label="false"/>
<objColor r="153" g="51" b="0" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<auxiliary val="false"/>
<coords x="10.0" y="0.0" z="0.0"/>
<lineStyle thickness="5" type="0" typeHidden="1" opacity="178"/>
<outlyingIntersections val="false"/>
<keepTypeOnTransform val="true"/>
</element>
<command name="IterationList">
<input a0="(If[x(P) ≥ y(P), x(P) - y(P), x(P)], If[x(P) ≥ y(P), y(P), y(P) - x(P)])" a1="P" a2="{(a, b)}" a3="n"/>
<output a0="L"/>
</command>
<element type="list" label="L">
<show object="false" label="true"/>
<objColor r="0" g="100" b="0" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<lineStyle thickness="5" type="0" typeHidden="1"/>
<pointSize val="5"/>
<pointStyle val="-1"/>
</element>
<command name="Sequence">
<input a0="If[x(L(i)) ≟ x(L(i + 1)), Polygon[L(i + 1), L(i), 4], Polygon[L(i), L(i + 1), 4]]" a1="i" a2="1" a3="steps"/>
<output a0="L_1"/>
</command>
<element type="list" label="L_1">
<show object="true" label="true"/>
<objColor r="255" g="0" b="0" alpha="0.4000000059604645"/>
<layer val="0"/>
<labelMode val="0"/>
<lineStyle thickness="5" type="0" typeHidden="1"/>
<listType val="polygon"/>
<pointSize val="5"/>
<pointStyle val="-1"/>
</element>
<expression label="text1" exp=""更相减损术的几何表示""/>
<element type="text" label="text1">
<show object="true" label="true" ev="40"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<bgColor r="224" g="224" b="224" alpha="255"/>
<layer val="0"/>
<labelMode val="0"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="2.0" size="12" style="1"/>
<absoluteScreenLocation x="60" y="7"/>
</element>
<expression label="text2" exp=""" + (LaTeX[B]) + """ />
<element type="text" label="text2">
<show object="true" label="true" ev="20"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="2.0" size="12" style="1"/>
<startPoint exp="B"/>
<labelOffset x="6" y="-23"/>
</element>
<command name="If">
<input a0="a ≤ 0 ∨ b ≤ 0" a1=""无意义"" a2=""" + (y(L(-1)))"/>
<output a0="text4"/>
</command>
<element type="text" label="text4">
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
</element>
<expression label="text3" exp=""" + (LaTeX[a]) + "和" + (LaTeX[b]) + "的最大公约数" + (LaTeX[text4]) + """ />
<element type="text" label="text3">
<show object="true" label="true" ev="8"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1.4" size="5" style="1"/>
<absoluteScreenLocation x="89" y="101"/>
</element>
<command name="TableText">
<input a0="{Take[L, 1, steps + 1]}" a1=""vc|_""/>
<output a0="text5"/>
</command>
<element type="text" label="text5">
<show object="true" label="true" ev="8"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1.4" size="5" style="1"/>
<absoluteScreenLocation x="103" y="144"/>
</element>
</construction>
</geogebra>