Assignment 3 -- Solution and Common Mistakes

Solution (possible program):        main file        file with functions

Here is a script file and a printout of Maple session, where I checked the the results.

Comments to the tests:
Test 1: regular values, no command line arguments
Tests 2-3: invalid data (Test 2: invalid x, Test 3: invalid y)
Tests 4-9: testing command line argument (CLA) switch
Test 4: CLA= 1 (arithmetic only)
Test 5: CLA= 2 (geometric only)
Test 6: CLA= 3 (harmonic only)
Test 7: CLA= 4 (AGM only)
Tests 8-9: invalid CLA (Test 8: CLA=-1, Test 9: CLA=5)
Tests 10-13: numerical stress-tests (trying to fail the program)
Test 10: x=2, y=2E+7. The program never ends (failed).
Test 11: x=2, y=2E+6: Passed. Results compare well with Maple's.
Test 12: (Trying to approach the program's bound closer): x=2, y=1E+7: Passed. Results compare well with Maple's.
Test 13: (switching the arguments): x=1E+7, y=2: Passed.

Common Mistakes