Assignment Solution

Vectorized Operations

Source code

download solutions as m-files

Expected Output

approxpi.m

         10  -0.0997530346603899 
        100  -0.00999975003123943 
       1000  -0.000999999749998981
      10000  -9.99999997586265e-05
     100000  -1.00000000733402e-05
    1000000  -1.00000001879152e-06

limit.m

   1.71828182845905
   1.29744254140026
   1.13610166675097
   1.06518762453461
   1.03191134268575
   1.01578903997129
   1.00785334954789
   1.00391644242535
   1.00195567061695
   1.00097719859343
   1.00048844023445
   1.00024418036628
   1.00012208024691
   1.00006103763917
   1.00003051820022
   1.00001525894186
   1.00000762943819
   1.00000381469727
   1.00000190734863
   1.00000095367432
   1.00000047683716
   1.00000023841858
   1.00000011920929
   1.00000005960464
   1.00000002980232
   1.00000001490116


baseball.m

      0                      0
      0.372534013605442     15.6406853387188
      0.745068027210884     29.9213110827664
      1.11760204081633      42.8418772321429
      1.49013605442177      54.4023837868481
      1.86267006802721      64.6028307468821
      2.23520408163265      73.4432181122449
      2.6077380952381       80.9235458829365
      2.98027210884354      87.0438140589569
      3.35280612244898      91.8040226403061
      3.72534013605442      95.2041716269841
      4.09787414965986      97.2442610189909
      4.47040816326531      97.9242908163265
      4.84294217687075      97.2442610189909
      5.21547619047619      95.2041716269841
      5.58801020408163      91.8040226403061
      5.96054421768708      87.0438140589569
      6.33307823129252      80.9235458829365
      6.70561224489796      73.4432181122449
      7.0781462585034       64.6028307468821
      7.45068027210884      54.402383786848
      7.82321428571429      42.8418772321428
      8.19574829931973      29.9213110827664
      8.56828231292517      15.6406853387188
      8.94081632653061      -5.6843418860808e-14


floatingError.m

  86.884 percent

extra.m

          #terms       Problem A               First Extra            Second Extra
              10  -0.0997530346603899    -0.0922310176077232    -4.57457382050386e-05
             100  -0.00999975003123943   -0.00951612178068695   -5.22627305876711e-08
            1000  -0.000999999749998981  -0.000954597383800326  -5.29714050401253e-11
           10000  -9.99999997586265e-05  -9.54896425784391e-05  -4.35207425653061e-14
          100000  -1.00000000733402e-05  -9.54926335650086e-06  -4.35207425653061e-14
         1000000  -1.00000001879152e-06  -9.54929378238489e-07  -4.35207425653061e-14

Last modified: Tuesday, 03 February 2009