Cody

Problem 47563. Find a real root of a quintic function

Solution 3761858

Submitted on 21 Nov 2020 by ChrisR
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
coeffs = [6 8 7 9 12 467]; candidateX = quintic(coeffs); assert(isreal(candidateX)) assert(abs(sum(coeffs.*(candidateX.^(5:-1:0)))-0)<0.0001)

2   Pass
coeffs = [4 6 7 8 2 1]; candidateX = quintic(coeffs); assert(isreal(candidateX)) assert(abs(sum(coeffs.*(candidateX.^(5:-1:0)))-0)<0.0001)

3   Pass
for idx = 1:10 coeffs = randi([1 50],1,6); candidateX = quintic(coeffs); assert(isreal(candidateX)) assert(abs(sum(coeffs.*(candidateX.^(5:-1:0)))-0)<0.0001) end

Suggested Problems

More from this Author72

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!