2008/9/23 John Cremona <[EMAIL PROTECTED]>: > 2008/9/23 pong <[EMAIL PROTECTED]>: >> >> >> I tried >> >> sage: A=matrix([[1,1],[2,3]]) >> sage: A.eigenvalues() >> [0.2679491924311228?, 3.732050807568878?] >> >> My question is why the last digit before ? in 0.2679491924311228? is >> '8'? Shouldn't it be "7" according to >> >> sage: ch=characteristic_polynomial(A) >> sage: solve(ch(x)==0,x) >> [x == 2 - sqrt(3), x == sqrt(3) + 2] >> sage: N(2-sqrt(3), digits=18) >> 0.267949192431122706 >> >> >> >> >> >> >> > > Alternatively: > > sage: e1,e2= A.eigenvalues() > sage: e1 > 0.2679491924311228? > sage: e1.interval(ComplexIntervalField(53)) # the default is 53 bits precision > 0.2679491924311228? > sage: e1.interval(ComplexIntervalField(100)) > 0.267949192431122706472553658494? > sage: e1.interval(ComplexIntervalField(200)) > 0.267949192431122706472553658494127633057194746189619371944193? > > i.e. e1 is a number of a type which is essentially infinite precision, > and you can ask for it to any desired precision later. > > However I'm still not sure why the original display ends 8? and not > 7?. The ? notatation was introduced quite recently, so I am not sure > whether this is a feature or a bug.
OK, it is a feature. To quote from http://wiki.sagemath.org/sage-3.1.2 (Release notes for 3.1.2): The question marks at the end of the numbers in the previous example mean that Sage is printing out an approximation of an exact value that it uses. In particular, the question mark means that the last digit can vary by plus or minus 1. In other words, 32.46424919657298? means that the exact number is really between 32.46424919657297 and 32.46424919657299. Sage knows what the exact number is and uses the exact number in calculations. So in Pong's case the final 8? means 8-plus-or-minus-1 which is not wrong. > > 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 -~----------~----~----~----~------~----~------~--~---