On Thu, Apr 2, 2009 at 6:23 PM, Jason Grout <[email protected]> wrote:
>
> kcrisman wrote:
>>
>>>  Incidentally, doing everything with floats would I
>>> think be *very* inappropriate for an undergrad class in linear
>>> algebra, where most of the by hand problems require the students to
>>> use rational numbers.
>>
>> Yes, which is why he only uses Octave for half the semester, I think,
>> or something like that.
>>
>
>
> Remember that both octave and matlab have a "format rat" mode, which
> displays fractions instead of floating point numbers.  Rounding to get
> these nice displayed numbers is another issue, but it does look prettier
> and closer to what you do by hand.
>
> Jason

And Octave and Matlab give different answers by default and both
blatantly *lie* whenever there is overflow.  Matlab and Octave are in
my opinion totally unsuitable for undergraduate linear algebra
teaching, except in a numerical analysis course.  As a person who
actually knows what a rational number is, the behavior of Matlab makes
me cringe.

For example, in Octave:

octave:1> format rat;
octave:2> a = [-86/17,40/29,-68/43,-20/11;-24/17,-1/38,-2/25,49/17]
a =
     -86/17      40/29     -68/43     -20/11
     -24/17      -1/38      -2/25      49/17
octave:3> rref(a)
ans =
          1          0   155/2122   -725/384
          0          1   -152/173  -6553/795

and in Matlab:

>> format rat;
>> a = [-86/17,40/29,-68/43,-20/11;-24/17,-1/38,-2/25,49/17]
a =
     -86/17          40/29         -68/43         -20/11
     -24/17          -1/38          -2/25          49/17
>> rref(a)
ans =
       1              0             13/178       -725/384
       0              1           -152/173      -1426/173

The truth has little to do with either of the two different outputs above:

sage: a = matrix(2,[-86/17, 40/29, -68/43, -20/11, -24/17, -1/38, -2/25, 49/17])
sage: a.echelon_form()
[                 1                  0     306034/4189705     -404710/214357]
[                 0                  1 -18405604/20948525  -30037214/3644069]

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to