2008/9/4 agi <[EMAIL PROTECTED]>: > > I have this: H is a real-valued Matrix > > z=abs(H[i,j]/H[j,j]) > if z!=infinity: > print H[i,j], H[i,j].parent() > print H[j,j], H[j,j].parent() > print z > > But it doesn't work: > > H[ 2 , 1 ]= -0.0243252127705267 Real Field with 53 bits of > precision > H[ 1 , 1 ]= 0.000000000000000 Real Field with 53 bits of > precision > z=+infinity > > This was printed although z=infinity. >
This is getting more interesting: so, you have computed a value z (in the default real field) which prints itself as "+infinity" though it is apparently not infinity. I think that if you replce the test z!=infinity by not z.is_infinity() then you will not get this disrepancy. This is what the print function will use to determine whether a value prints as infinity or not, while != is a more general comparison which is probably failing because z and infinity have different types. ( z!=RR(infinity) might also work, but using z.is-infinity() is curely better. Tell us if this works. John Cremona > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---