Cody

# Problem 42840. Coefficients and vertex of a parabola given 3 points

Solution 934152

Submitted on 10 Aug 2016 by SirSteve26
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 = [1 0]; P2 = [2 5]; P3 = [-1 2]; abc = [2 -1 -1]; O1 = Para3(P1,P2,P3); assert(isequal(O1,abc))

Coeff = 2 -1 -1 VERT = 0.2500 0 VERT = 0.2500 -1.1250 Coeff = 2 -1 -1

2   Pass
P1 = [1 0]; P2 = [2 5]; P3 = [-1 2]; vxvy = [0.25 -1.125]; [~,O2] = Para3(P1,P2,P3); assert(isequal(O2,vxvy))

Coeff = 2 -1 -1 VERT = 0.2500 0 VERT = 0.2500 -1.1250 Coeff = 2 -1 -1

3   Pass
i = [0 0]; j = [1 1]; k = [-1 1]; abc = [1 0 0]; tip = [0 0]; [Res,Ans] = Para3(i,j,k); assert(isequal(Res,abc)) assert(isequal(Ans,tip))

Coeff = 1 0 0 VERT = 0 0 VERT = 0 0 Coeff = 1 0 0

4   Pass
ptA = [-1 -5]; ptB = [2 4]; ptC = [3 -5]; exp1 = [-3 6 4]; exp2 = [1 7]; [coefficients,vertex] = Para3(ptA,ptB,ptC); assert(isequal(exp1,coefficients)) assert(isequal(exp2,vertex))

Coeff = -3 6 4 VERT = 1 0 VERT = 1 7 Coeff = -3 6 4