MATH/APPM 4650
How to format homework
To make homework easier to grade and more consistent, and to reduce worthless printouts, please submit your homework in the following formats. The bisection method is demonstrated here for problem 2.1, #2.
Maple:
See a Maple formatting example.
Mathematica:
See a Mathematica formatting example.
MATLAB:
Formatting in MATLAB is a bit more complicated, because of the necessity of several files.
You can put several functions (from different homework problems) in different files. In this example I put
function F=sec2_1_2(x);
F=3*(x+1)*(x-1/2)*(x-1);
in a file called sec2_1_2.m, which is in the same directory as bisection.m.
The program bisection.m is here.
Then to run the program and save the output, you would go into the command window and do
>> diary homework3diary.txt
>> format long
>> bisection('sec2_1_2',-2,1.5,0.01)
-2.000000000000000 1.500000000000000
-2.000000000000000 -0.250000000000000 -1.125000000000000
-1.125000000000000 -0.250000000000000 -0.687500000000000
-1.125000000000000 -0.687500000000000 -0.906250000000000
-1.125000000000000 -0.906250000000000 -1.015625000000000
-1.015625000000000 -0.906250000000000 -0.960937500000000
-1.015625000000000 -0.960937500000000 -0.988281250000000
-1.015625000000000 -0.988281250000000 -1.001953125000000
-1.001953125000000 -0.988281250000000 -0.995117187500000
>> diary off
The result then gets stored in the file homework3diary.txt which you can print out.