# Message Boards

0
|
4183 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
 The purpose of my project was in order to depict the steps it takes to complete calculations on an abacus. For example, if someone entered (5+2), I would show them the various steps consecutively in an animation or a set of pictures in order to lead them to the answer of 7. The user can use functions such as addition, subtraction, multiplication, and division in order to solve out problems through an abacus, and the visual steps on the abacus will lead them to the correct answer. This can help other users learn how to use an abacus properly, as it will depict the steps it takes to perform several types of calculations. The abacus is an important step in human evolution, from counting sticks, to calculus. The addition algorithm works by adding each digit separately and carrying over. Subtraction works similarly. Multiplication is more complicated, as it requires keeping track of the right number of 10's. For my program, one could input the function multiply[], subtract[], or add[] in order to accomplish an output, along with an animation in the abacus that would show how the beads would move in an abacus in order to receive the desired answer. I believe that through this animation, one could learn how to use an abacus properly as they would be provided examples with how to move along an abacus for different computations such as addition or subtraction. The program was a fun challenge to complete, and I hope it benefits those who wish to explore the riveting mechanisms of an abacus. Demonstrations: Code: add[j_, k_]:=Module[{m=j,n=k},\[IndentingNewLine]x = 0;\[IndentingNewLine]digitM = IntegerDigits[m];\[IndentingNewLine]digitN = IntegerDigits[n];\[IndentingNewLine]longerLength = Max[Length[digitM],Length[digitN]];\[IndentingNewLine]\[IndentingNewLine]If[Length[digitM] \[Equal] Length[digitN],\[IndentingNewLine]x = x,\[IndentingNewLine]If[Length[digitM] > Length[digitN],\[IndentingNewLine]digitN = Join[Table[0, {n, longerLength}], digitN]; digitN = digitN[[Length[digitN]-longerLength+1;;Length[digitN]]],\[IndentingNewLine]digitM = Join[Table[0, {n, longerLength}], digitM]; digitM = digitM[[Length[digitM]-longerLength+1;;Length[digitM]]]]];\[IndentingNewLine]\[IndentingNewLine]Do[Pause[0.8];x = x + 10^(longerLength-l-1)*(digitM[[l+1]]+digitN[[l+1]]),\[IndentingNewLine]{l, 0,longerLength-1}];\[IndentingNewLine]x]; subtract[j_, k_]:=Module[{m=j,n=k},\[IndentingNewLine]x = m;\[IndentingNewLine]digitM = IntegerDigits[m];\[IndentingNewLine]digitN = IntegerDigits[n];\[IndentingNewLine]longerLength = Max[Length[digitM],Length[digitN]];\[IndentingNewLine]\[IndentingNewLine]If[Length[digitM] \[Equal] Length[digitN],\[IndentingNewLine]x = x,\[IndentingNewLine]If[Length[digitM] > Length[digitN],\[IndentingNewLine]digitN = Join[Table[0, {n, longerLength}], digitN]; digitN = digitN[[Length[digitN]-longerLength+1;;Length[digitN]]],\[IndentingNewLine]digitM = Join[Table[0, {n, longerLength}], digitM]; digitM = digitM[[Length[digitM]-longerLength+1;;Length[digitM]]]]];\[IndentingNewLine]\[IndentingNewLine]Do[Pause[0.8];x = x - 10^(longerLength-l-1)*(digitN[[l+1]]),\[IndentingNewLine]{l, 0,longerLength-1}];\[IndentingNewLine]x];\[IndentingNewLine]\[IndentingNewLine]multiply[j_, k_]:=Module[{m=j,n=k},\[IndentingNewLine]x = 0;\[IndentingNewLine]digitM = IntegerDigits[m];\[IndentingNewLine]digitN = IntegerDigits[n]; \[IndentingNewLine]longerLength = Max[Length[digitM],Length[digitN]];\[IndentingNewLine]\[IndentingNewLine]If[Length[digitM] \[Equal] Length[digitN],\[IndentingNewLine]x = x,\[IndentingNewLine]If[Length[digitM] > Length[digitN],\[IndentingNewLine]digitN = Join[Table[0, {n, longerLength}], digitN]; digitN = digitN[[Length[digitN]-longerLength+1;;Length[digitN]]],\[IndentingNewLine]digitM = Join[Table[0, {n, longerLength}], digitM]; digitM = digitM[[Length[digitM]-longerLength+1;;Length[digitM]]]]]; \[IndentingNewLine]Do[Do[Pause[0.8]; x = x+10^(a+b-2)*digitM[[longerLength+1-b]]*digitN[[longerLength+1-a]], {b, Length[digitM]}],{a,Length[digitN]}];\[IndentingNewLine]x];