On Thu, 27 Apr 2023 at 06:25, 'Martin R' via sage-devel <[email protected]> wrote: > > On Wednesday, 26 April 2023 at 21:06:30 UTC+2 Oscar Benjamin wrote: >> >> One thing Sage could do with SymPy's RootSum is to call doit which >> will expand using radical formulae if possible: >> >> x**2/(3*a**2 + 3*a*b*x**3) + RootSum(729*_t**3*a**4*b**2 + 1, >> Lambda(_t, _t*log(81*_t**2*a**3*b + x))) >> >> In [37]: x, a, b, _t = symbols('x, a, b, _t') >> >> In [38]: expr = x**2/(3*a**2 + 3*a*b*x**3) + >> RootSum(Poly(729*_t**3*a**4*b**2 + 1, _t), Lambda(_t, >> _t*log(81*_t**2*a**3*b + x))) >> >> In [39]: print(expr) >> x**2/(3*a**2 + 3*a*b*x**3) + RootSum(729*_t**3*a**4*b**2 + 1, >> Lambda(_t, _t*log(81*_t**2*a**3*b + x))) >> >> In [40]: print(expr.doit()) >> x**2/(3*a**2 + 3*a*b*x**3) + >> (-1/(a**4*b**2))**(1/3)*log(a**3*b*(-1/(a**4*b**2))**(2/3) + x)/9 + >> (-(-1/(a**4*b**2))**(1/3)/18 - >> sqrt(3)*I*(-1/(a**4*b**2))**(1/3)/18)*log(81*a**3*b*(-(-1/(a**4*b**2))**(1/3)/18 >> - sqrt(3)*I*(-1/(a**4*b**2))**(1/3)/18)**2 + x) + >> (-(-1/(a**4*b**2))**(1/3)/18 + >> sqrt(3)*I*(-1/(a**4*b**2))**(1/3)/18)*log(81*a**3*b*(-(-1/(a**4*b**2))**(1/3)/18 >> + sqrt(3)*I*(-1/(a**4*b**2))**(1/3)/18)**2 + x) > > If I recall correctly, this is what I did for the FriCAS interface. It would > be nice to factor out any common functionality, if possible.
Obviously though the RootSum is better than the radicals which is why it is used in the first place so the ideal solution would be to preserve the RootSum. The simple case above already shows that it is better but in others the radical formulae can explode and in more complicated cases formulae won't even exist. -- Oscar -- You received this message because you are subscribed to the Google Groups "sage-devel" 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-devel/CAHVvXxQVU9E_-JNtasmSc-McVbdts7tkQUhLBDjhKj11HDXMGg%40mail.gmail.com.
