When using numpy Ive been using the code lines; > > import numpy > (np.longdouble(1.4142)** 6000 )%400 > > I am not sure how accurate the result is, and I have tried using other > methods too > but recently I found a post comparing sympy to numpy and it seems someone > is claiming that sympy can return superior precision results, can anyone > confirm > that this is true and do you know if this would be a good solution to run > on my system? > > Link with info comparing the below is shown ; > > > http://stackoverflow.com/questions/25181642/how-set-numpy-floating-point-accuracy > > In normal numpy use, the numbers are double. Which means that the accuracy > will be less than 16 digits. Here is a solved subject that contains the > same problematic ... > > If you need to increase the accuracy, you can use symbolic computation > .... The library mpmath ... is a quiet good one. The advantage is that you > can use limitless precision. However, calculations are slower than what > numpy can do. > > Here is an example: > > # The library mpmath is a good solution > >>> import sympy as smp > >>> mp = smp.mpmath > > >>> mp.mp.dps = 50 # Computation precision is 50 digits > # Notice that the difference between x and y is in the digit before last > (47th) > >>> x = > smp.mpmath.mpf("0.910221324013388510820732335560023784637451171875") > >>> y = > smp.mpmath.mpf("0.910221324013388510820732335560023784637451171865") > >>> x - y # Must be equal to 1e-47 as the difference is on the 47th digit > mpf('1.000014916280995001003481719184726944958705912691304e-47') > > You can't do better with numpy. You can calculate exponentials with a > better accuracy. > > smp.exp(x).evalf(20) = 2.4848724344693696167 > > > http://stackoverflow.com/questions/25181642/how-set-numpy-floating-point-accuracy > > https://github.com/sympy/sympy/releases > http://docs.sympy.org/latest/index.html >
-- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/ff07f5f3-7041-42e5-bfd2-75c06029a52d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
