Dear developers of SAGE, I ran into a very strange behavior of SAGE. This has been occurring on 64-bit Arch Linux box and 32-bit Ubuntu Linux box using SAGE 2.8.3. In order to reproduce it please do the following:
1) save the following as bary2test.sage: [---cut here---] # This script tries to compute barycentric coordinates of some points and lines. #Some routines def line_by_2_points(point1,point2): """Finds barycentric equation of the line through two given points""" m = matrix ([[x,y,z],point1,point2]) return m.determinant() def intersection_of_2_lines(line1,line2): """Finds barycentric coordinates of the intersection point of 2 lines""" solution = solve([x+y+z==1,line1==0,line2==0],x,y,z)[int(0)] tmp_x = solution[int(0)].right() tmp_y = solution[int(1)].right() tmp_z = solution[int(2)].right() return [tmp_x,tmp_y,tmp_z] var ('x y z _l1 _l2 _l3') # This dictionary contains the barycentric coordinates of points and # equations for lines. v = { '.B': [0, 1, 0], '.C': [0, 0, 1], '.Y': [_l2/(2*(_l2 - _l1)), (_l3/(_l3 - _l2) - (_l1/(_l2 - _l1)))/2, - _l2/(2*(_l3 - _l2))], '.Z': [_l3/(2*(_l3 - _l1)), _l3/(2*(_l3 - _l2)), (-_l2/(_l3 - _l2) - (_l1/(_l3 - _l1)))/2] } v['_q']=line_by_2_points(v['.B'],v['.Y']) v['_r']=line_by_2_points(v['.C'],v['.Z']) [---cut here---] 2) Run SAGE and load bary2test.sage 3) Repeatedly try to compute v['.P']=intersection_of_2_lines(v['_q'],v['_r']) by just pressing the up-arrow and enter several times. On my computers, I get the correct result (which is [1/2, (_l3 - _l1)/ (2*_l3 - 2*_l2), (_l1 - _l2)/(2*_l3 - 2*_l2)]) every fifth time or so, all the other attempts result in the following error message: --------------------------------------------------------------------------- <type 'exceptions.ValueError'> Traceback (most recent call last) /home/jan/install/sage-u2.8.3-ubuntu-7.04-32bit-i686-Linux/<ipython console> in <module>() /home/jan/install/sage-u2.8.3-ubuntu-7.04-32bit-i686-Linux/ bary2test.py in intersection_of_2_lines(line1, line2) 13 def intersection_of_2_lines(line1,line2): 14 """Finds barycentric coordinates of the intersection point of 2 lines""" ---> 15 solution = solve([x+y +z==Integer(1),line1==Integer(0),line2==Integer(0)],x,y,z) [int(Integer(0))] 16 tmp_x = solution[int(Integer(0))].right() 17 tmp_y = solution[int(Integer(1))].right() /home/jan/install/sage-u2.8.3-ubuntu-7.04-32bit-i686-Linux/local/lib/ python2.5/site-packages/sage/calculus/equations.py in solve(f, *args, **kwds) 672 s = m.solve(args) 673 except: --> 674 raise ValueError, "Unable to solve %s for %s"%(f, args) 675 a = repr(s) 676 return string_to_list_of_solutions(a) <type 'exceptions.ValueError'>: Unable to solve [z + y + x == 1, - x*_l2/(2*(_l3 - _l2)) - z*_l2/(2*(_l2 - _l1)) == 0, y*_l3/(2*(_l3 - _l1)) - x*_l3/(2*(_l3 - _l2)) == 0] for (x, y, z) Now, there is a perhaps related issue found in ticket #507, but it still does not explain why this computation sometimes succeeds and sometimes (even mostly) does not. Hope someone can help us to sort this out. Keep up the good work! Jan Willemson --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---