> On Tuesday, January 18, 2011 10:19:58 AM UTC-7, einek wrote:
>>
>> Hi tvn,
>>
>> Am Montag, den 17.01.2011, 14:22 -0800 schrieb tvn:
>> > I try to solve for 3 variables x y z with 3 equations as below  ,
>> > I am expecting something like  z = r1, x = -r1, y = -2*r1  but instead
>> > get x = y = z = 0 (which trivially valid though not expected).   Is
>> > this because the numbers used too complex (equation 2)  and have some
>> > rounding errors ?   if not what's the cause and how to get around it ?
>> > Thanks
>> >
>> >
>> >
>> >
>> > sage version 4.6.1
>> >
>> >
>> > solve([x + 0.106*y + 1.212*z == 0, 3.8759765625*x + 0.04801171875*y +
>> > 3.972*z == 0, 3.0625*x + 0.09325*y + 3.249*z == 0],[x,y,z])
>> > [[x == 0, y == 0, z == 0]]   #not expected
>> sage: A = matrix([[1, 0.106, 1.212], [3.8759765625, 0.04801171875,
>> 3.972], [3.0625, 0.09325, 3.249]])
>> sage: A.rank()
>> 3
>>
>> Thus (0,0,0) is the unique solution of your system.

The problem is rounding error. Over the rationals:

sage: A = matrix(3, 3, [QQ(a) for a in [1, 0.106, 1.212, 3.8759765625,
0.04801171875, 3.972, 3.0625, 0.09325, 3.249]])
sage: A
[           1       53/500      303/250]
[   3969/1024 12291/256000      993/250]
[       49/16     373/4000    3249/1000]

sage: A.rank()
 2

- Robert

-- 
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
URL: http://www.sagemath.org

Reply via email to