What about : 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 36.8 ms, sys: 0 ns, total: 36.8 ms Wall time: 34.6 ms
*## Note : no addition of 0.01, which can't be cast in SR...* sage: %timeit MyRange=srange(0,QQbar(t).real()+1/100,1/100) 10 loops, best of 3: 55.5 ms per loop Looks reasonable, no ? 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.