ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 23 Mar 2017 17:28:43 +0100use multiple precision by default ?https://ask.sagemath.org/question/37048/use-multiple-precision-by-default/ I don't like that QQ(2.3)^QQ(.51) thing. It's ugly. I just want to write the numbers as they are without any conditions attached. I use mpmath, since it is an external module in python the same problem persists.
>I hope sagemath has an internal built-in way to do it, without extra syntax. I don't like that annoying R.() thing every time I have to write. screened00Thu, 23 Mar 2017 17:28:43 +0100https://ask.sagemath.org/question/37048/Incorrect result for comparison (precision issues?)https://ask.sagemath.org/question/32371/incorrect-result-for-comparison-precision-issues/ Consider this session:
sage: if log(10) * 248510777753 < log(1024) * 82553493450:
....: print 'Less'
....: else:
....: print 'Not less'
....:
Not less
or more simply:
sage: bool(log(10)*248510777753 < log(1024)*82553493450)
False
But this is wrong, as we can see with higher-precision arithmetic:
sage: import mpmath
sage: mpmath.mp.dps = 22 # or anything greater
sage: bool(mpmath.log(10)*248510777753 < mpmath.log(1024)*82553493450)
True
I guess this is happening because Sage is computing to some finite precision. But when writing some bigger program, it's scary that a condition involving variables, like say,
if m * q < n * p:
can without warning give the wrong result and take the wrong path. Is there a way to prevent this from happening, i.e. to make sure that in the program, comparisons are done using as many bits of precision as are necessary to evaluate them correctly, without us having to pre-specify a precision (which may be both too large and wasteful, or too small and give incorrect results)?ShreevatsaRFri, 29 Jan 2016 04:58:13 +0100https://ask.sagemath.org/question/32371/Arbitrary precision with power functionhttps://ask.sagemath.org/question/9788/arbitrary-precision-with-power-function/Hello! Sorry for my english.
Why in Sage 5.6
> numerical_approx((3**2.72), digits=200)
gives
> 19.850425152727527944307439611293375492095947265625000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000
and
> RealField(1000)(3**2.72)
gives
> 19.850425152727527944307439611293375492095947265625000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
0000000000000
? After digit 5 zero, zero, zero. How to get more digits in Sage?PlezzeRFri, 08 Feb 2013 21:53:21 +0100https://ask.sagemath.org/question/9788/How to enter a multiprecision integer in hex big endianhttps://ask.sagemath.org/question/8681/how-to-enter-a-multiprecision-integer-in-hex-big-endian/Hi,
I have a multiprecision integer (retrieved from a gpg signature). Example:
DSA p(2048 bits) - ab 21 99 ...many bytes here ... 5b
How can I enter the hex representation into Sage to work with it?tbenderSun, 29 Jan 2012 13:50:05 +0100https://ask.sagemath.org/question/8681/