You will build a polynomial from its roots and check Vieta's formulas. A polynomial is a list of coefficients, the leading one first: [1, -4, 1, 6] is .
The idea. Multiplying by shifts the list one place and subtracts times the old list. The sum of all products of different roots is , and the coefficient in place is .
Your tasks.
times_linear(coeffs, t). Return the coefficients of the polynomial times .from_roots(roots). Start with [1] and multiply in one factor for each root.e(roots, k). Return the sum of the products of the roots taken k at a time.Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…