(p, x, prec)
return res
compute the truncated Newton sum of the polynomial ``p``

    Examples
    ========

    >>> from sympy.polys.domains import QQ
    >>> from sympy.polys.rings import ring
    >>> from sympy.polys.ring_series import rs_newton
    >>> R, x = ring('x', QQ)
    >>> p = x**2 - 2
    >>> rs_newton(p, x, 5)
    8*x**4 + 4*x**2 + 2
compute the truncated Newton sum of the polynomial ``p``
compute the truncated Newton sum of the polynomial p
def rs_newton(p, x, prec):
    """
    compute the truncated Newton sum of the polynomial ``p``

    Examples
    ========

    >>> from sympy.polys.domains import QQ
    >>> from sympy.polys.rings import ring
    >>> from sympy.polys.ring_series import rs_newton
    >>> R, x = ring('x', QQ)
    >>> p = x**2 - 2
    >>> rs_newton(p, x, 5)
    8*x**4 + 4*x**2 + 2
    """
    deg = p.degree()
    p1 = _invert_monoms(p)
    p2 = rs_series_inversion(p1, x, prec)
    p3 = rs_mul(p1.diff(x), p2, x, prec)
    res = deg - p3*x
    return res
def rs_newton ( p , x , prec ) : deg = p . degree ( ) p1 = _invert_monoms ( p ) p2 = rs_series_inversion ( p1 , x , prec ) p3 = rs_mul ( p1 . diff ( x ) , p2 , x , prec ) res = deg - p3 * x return res