Cody

# Problem 43619. Divide polynomial p1 by p2.

Solution 1030507

Submitted on 24 Oct 2016 by Andriy Kavetsky
• Size: 17
• This is the leading solution.
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
p1=[3 2 5 1 0 2 ] p2=[1 2 0 5 0 3] q_correct= r_correct=[0 -4 5 -14 0 -7] [q,r]=DivPol(p1,p2) assert(isequal(q,q_correct)) assert(isequal(r,r_correct))

p1 = 3 2 5 1 0 2 p2 = 1 2 0 5 0 3 q_correct = 3 r_correct = 0 -4 5 -14 0 -7 q = 3 r = 0 -4 5 -14 0 -7 q = 3 r = 0 -4 5 -14 0 -7

2   Pass
p1=[-2 0 3 -5 -6 5 -1 0 16 8] p2=[1 0 -1 2 4] q_correct=[-2 0 1 -1 3 2] r_correct=[0 0 0 0 0 0 0 0 0 0] [q,r]=DivPol(p1,p2) assert(isequal(q,q_correct)) assert(isequal(r,r_correct))

p1 = -2 0 3 -5 -6 5 -1 0 16 8 p2 = 1 0 -1 2 4 q_correct = -2 0 1 -1 3 2 r_correct = 0 0 0 0 0 0 0 0 0 0 q = -2 0 1 -1 3 2 r = 0 0 0 0 0 0 0 0 0 0 q = -2 0 1 -1 3 2 r = 0 0 0 0 0 0 0 0 0 0

### Community Treasure Hunt

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

Start Hunting!