For the record : you shouldn't add a float (0.01) to an exact number (your root) : it complexifies and slows your computations to no avail. E. g. :
sage: %time t = -2/3*((sqrt(3)*sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/337 ....: 5)^(2/3) + 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 364)/(88/3 ....: 0375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - 45*sqrt(-(88/30375*I*sqrt(79) ....: *sqrt(3) + 1328/3375)^(1/3) - 704/225*sqrt(3)/sqrt((675*(88/30375*I*sqrt(79 ....: )*sqrt(3) + 1328/3375)^(2/3) + 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375 ....: )^(1/3) + 364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - 364/675/( ....: 88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 368/225) + 6)^2 - 90*sqrt( ....: 3)*sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + 552*(88/3037 ....: 5*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 364)/(88/30375*I*sqrt(79)*sqrt(3) ....: + 1328/3375)^(1/3)) + 4050*sqrt(-(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375) ....: ^(1/3) - 704/225*sqrt(3)/sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375 ....: )^(2/3) + 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 364)/(88/30 ....: 375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - 364/675/(88/30375*I*sqrt(79)*s ....: qrt(3) + 1328/3375)^(1/3) + 368/225) - 4590)/((sqrt(3)*sqrt((675*(88/30375* ....: I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + 552*(88/30375*I*sqrt(79)*sqrt(3) + ....: 1328/3375)^(1/3) + 364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - ....: 45*sqrt(-(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) - 704/225*sqrt(3)/ ....: sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + 552*(88/30375*I ....: *sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 364)/(88/30375*I*sqrt(79)*sqrt(3) + ....: 1328/3375)^(1/3)) - 364/675/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) ....: + 368/225) + 6)*(sqrt(1/3)*sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3 ....: 375)^(2/3) + 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 364)/(88 ....: /30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - 15*sqrt(-(88/30375*I*sqrt(7 ....: 9)*sqrt(3) + 1328/3375)^(1/3) - 704/75*sqrt(1/3)/sqrt((675*(88/30375*I*sqrt ....: (79)*sqrt(3) + 1328/3375)^(2/3) + 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3 ....: 375)^(1/3) + 364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - 364/67 ....: 5/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 368/225) + 2)) CPU times: user 39 ms, sys: 13 µs, total: 39 ms Wall time: 36.6 ms ## Precisin lowered to reduce result size... sage: %time srange(0,abs(t)+1/10,1/10) # Add your constant *afterwards*... CPU times: user 297 ms, sys: 0 ns, total: 297 ms Wall time: 297 ms [0, 1/10, 1/5, 3/10, 2/5, 1/2, 3/5, 7/10, 4/5, 9/10, 1, 11/10, 6/5, 13/10, 7/5, 3/2, 8/5, 17/10, 9/5, 19/10, 2, 21/10, 11/5, 23/10, 12/5, 5/2, 13/5] You should also reconsider the necessity of expressing your polynomial roots. complex_root_of? might come in handy... HTH, Le mercredi 20 février 2019 19:08:35 UTC+1, Michael Beeson a écrit : > > The solution of a cubic or quartic may require the use of complex numbers. > (Indeed that's how the complex numbers were first discovered.) > Below I exhibit a long expression for such a number that solve() found for > me. > It evaluates using n(t) to a real (decimal) number, and it passes " t in > RR" > although that takes five minutes and turns the fan of my laptop on (a sign > of > serious CPU use). Then I enter this number in range(0,t), which should be > OK > if t is real, but it causes the same crash that range(0,I) causes, > complaining that > t is complex. Below is the code (Sage version is 8.0--I plan to update > Real Soon Now). > Well, so you may wonder "what is the actual question"? It is, how can I > get my > hands on this number in a form that I can actually put into range? I > want to bound > a search by the size of the solution of a quartic and could not manage it > because of > this problem. > > > > def test(): > t = -2/3*((sqrt(3)*sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + > 1328/3375)^(2/3) + 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + > 364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - > 45*sqrt(-(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) - > 704/225*sqrt(3)/sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + > 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + > 364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - > 364/675/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 368/225) + 6)^2 - > 90*sqrt(3)*sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + > 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + > 364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) + > 4050*sqrt(-(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) - > 704/225*sqrt(3)/sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + > 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + > 364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - > 364/675/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 368/225) - > 4590)/((sqrt(3)*sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + > 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + > 364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - > 45*sqrt(-(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) - > 704/225*sqrt(3)/sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + > 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + > 364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - > 364/675/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 368/225) + > 6)*(sqrt(1/3)*sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + > 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + > 364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - > 15*sqrt(-(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) - > 704/75*sqrt(1/3)/sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) > + 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + > 364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - > 364/675/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 368/225) + 2)) + > 0.0100000000000000 > print(n(t)) > print(t in RR) > print(range(0,t)) > -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.