I think the main problem in f(x) is a preparser problem: https://trac.sagemath.org/ticket/11621
The other problems could just be numerical instability. The normal precision is 53 bits, which is good for about 16 decimal digits. The constants in the formula are more than that, so if there is significant cancellation, it may be this is just expected. Perhaps try and evaluatie with a larger precision? .n(500) or so? If the answers are now closer then it could just be numerical. The factored expression should give a different evaluation scheme for what is presumably the same quantity. On Wednesday, 7 July 2021 at 13:46:33 UTC-7 Emmanuel Charpentier wrote: > The same ask.sagemath question > <https://ask.sagemath.org/question/57859/wrong-result-after-using-factor-known-sage-bug/> > > may have revealed two different bugs in symbolics handling. > Input interpretation. Raw input, with spaces, indents and newlines : > > f(x) = (3/174465461165747500*pi*(-1750000*I*pi*x^3 - 31250000*(224*pi + > 45*sqrt(448*pi + 2025) + 2025)*x^2 > + 17500000000000000*I*pi*x) > *sqrt(92821652156334811582567480952850314403/10*pi^2/(224*pi + > 45*sqrt(448*pi + 2025) + 2025) > + 98489794142024498175862287197250000*pi*sqrt(448*pi + 2025) > /(224*pi + 45*sqrt(448*pi + 2025) + 2025) + > 7713517620898636162808584411766250000*pi > /(224*pi + 45*sqrt(448*pi + 2025) + 2025) + > 659225266976959904108326638192187500*sqrt(448*pi + 2025) > /(224*pi + 45*sqrt(448*pi + 2025) + 2025) + > 29665137013963195684874698718648437500 > /(224*pi + 45*sqrt(448*pi + 2025) + 2025)) > /(63*pi^2*x^4 - (504000*I*pi^2 + 67500*I*pi*(sqrt(448*pi + 2025) + > 45))*x^3 > - 3000000*(560224*pi^2 + 45*pi*(sqrt(448*pi + 2025) + 45))*x^2 + > 8400000000000000000000*pi^2 > - (-5040000000000000*I*pi^2 - 675000000000000*I*pi*(sqrt(448*pi + > 2025) + 45))*x)) > > Single-line reformatted code (deleting blanks, indents and newlines, > adding a space before ‘+’ and ‘-‘) > > g(x) = (3/174465461165747500*pi*(-1750000*I*pi*x^3 - 31250000*(224*pi + > 45*sqrt(448*pi + 2025) + 2025)*x^2 + > 17500000000000000*I*pi*x)*sqrt(92821652156334811582567480952850314403/10*pi^2/(224*pi > + 45*sqrt(448*pi + 2025) + 2025) + > 98489794142024498175862287197250000*pi*sqrt(448*pi + 2025)/(224*pi + > 45*sqrt(448*pi + 2025) + 2025) + > 7713517620898636162808584411766250000*pi/(224*pi + 45*sqrt(448*pi + 2025) + > 2025) + 659225266976959904108326638192187500*sqrt(448*pi + 2025)/(224*pi + > 45*sqrt(448*pi + 2025) + 2025) + > 29665137013963195684874698718648437500/(224*pi + 45*sqrt(448*pi + 2025) + > 2025))/(63*pi^2*x^4 - (504000*I*pi^2 + 67500*I*pi*(sqrt(448*pi + 2025) + > 45))*x^3 - 3000000*(560224*pi^2 + 45*pi*(sqrt(448*pi + 2025) + 45))*x^2 + > 8400000000000000000000*pi^2 - (-5040000000000000*I*pi^2 - > 675000000000000*I*pi*(sqrt(448*pi + 2025) + 45))*x)) > > Notwithstanding formatting differences, these functions should be equal ; > they are *not* : > > sage: f(1).n() > 418409.917305474 + 1.28757494213663e11*I > sage: g(1).n() > 1.39111866114058e-12 + 6.95559330500736e-6*I > > factor bug > > sage: F = f.real()^2 + f.imag()^2 > sage: Ff = (f.real()^2 + f.imag()^2).factor() > sage: G = g.real()^2 + g.imag()^2 > sage: Gf = (g.real()^2 + g.imag()^2).factor() > sage: F(1).n() > 1.65784923163565e22 > sage: Ff(1).n() > 4.77205703148314e29 > sage: G(1).n() > 4.83802782246652e-11 > sage: Gf(1).n() > 0.00139260822082924 > > These two bugs may have a common origin in SR code (pynac comes to mind). > > My question is : how to file bugs about these ones, which seem extremely > serious (silent errors in basic symbolics abilities) ? > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/0cd1af34-bb0a-4c7e-a8a0-c3420d7284d7n%40googlegroups.com.
