# Revision history [back]

If you look at the system of linear equations, you can see that it really has 4 equations with 4 unknowns (the 5th equation is 0=0 and the fifth unknown a4 just doesn't appear)

sage: [ssr_a0==0,ssr_a1==0,ssr_a2==0,ssr_a3==0,ssr_a4==0]
[8*a0 + 6.20*a1 + 9.220000*a2 + 16.68200*a3 - 9.2200000 == 0,
6.20000*a0 + 9.2200000*a1 + 16.6820000*a2 + 32.3842000*a3 - 16.682000 == 0,
9.2200*a0 + 16.6820000*a1 + 32.384200*a2 + 64.21802000*a3 - 32.38420000 == 0,
16.68200*a0 + 32.384200*a1 + 64.2180200*a2 + 128.12456200*a3 - 64.2180200 == 0,
0 == 0]


That system has a solution involving only the first four unknown, which explains what you obtain:

[{a0: 0, a1: 0, a2: 1, a3: 0, a4: r3}]


Indeed, we can see that the coefficient of a2 matches the constant terms.

If you look at the system of linear equations, you can see that it really has 4 equations with 4 unknowns (the 5th equation is 0=0 and the fifth unknown a4 just doesn't appear)

sage: [ssr_a0==0,ssr_a1==0,ssr_a2==0,ssr_a3==0,ssr_a4==0]
[8*a0 + 6.20*a1 + 9.220000*a2 + 16.68200*a3 - 9.2200000 == 0,
6.20000*a0 + 9.2200000*a1 + 16.6820000*a2 + 32.3842000*a3 - 16.682000 == 0,
9.2200*a0 + 16.6820000*a1 + 32.384200*a2 + 64.21802000*a3 - 32.38420000 == 0,
16.68200*a0 + 32.384200*a1 + 64.2180200*a2 + 128.12456200*a3 - 64.2180200 == 0,
0 == 0]


That system has a solution involving only the first four unknown, which explains what you obtain:

[{a0: 0, a1: 0, a2: 1, a3: 0, a4: r3}]


Indeed, we can see that the coefficient of a2 matches the constant terms.terms. Alternatively, you can just remove a4 in the call to solve since that variable does not appear in the system:

sage: solve([ssr_a0==0,ssr_a1==0,ssr_a2==0,ssr_a3==0,ssr_a4==0], a0, a1, a2, a3, solution_dict=True)
[{a0: 0, a1: 0, a2: 1, a3: 0}]


If you look at the system of linear equations, you can see that it really has 4 equations with 4 unknowns (the 5th equation is 0=0 and the fifth unknown a4 just doesn't appear)

sage: [ssr_a0==0,ssr_a1==0,ssr_a2==0,ssr_a3==0,ssr_a4==0]
[8*a0 + 6.20*a1 + 9.220000*a2 + 16.68200*a3 - 9.2200000 == 0,
6.20000*a0 + 9.2200000*a1 + 16.6820000*a2 + 32.3842000*a3 - 16.682000 == 0,
9.2200*a0 + 16.6820000*a1 + 32.384200*a2 + 64.21802000*a3 - 32.38420000 == 0,
16.68200*a0 + 32.384200*a1 + 64.2180200*a2 + 128.12456200*a3 - 64.2180200 == 0,
0 == 0]


That system has a solution involving only the first four unknown, which explains what you obtain:

[{a0: 0, a1: 0, a2: 1, a3: 0, a4: r3}]


Indeed, we can see that the coefficient of a2 matches the constant terms. Alternatively, you can just remove a4 in the call to solve since that variable does not appear in the system:

sage: solve([ssr_a0==0,ssr_a1==0,ssr_a2==0,ssr_a3==0,ssr_a4==0], a0, a1, a2, a3, solution_dict=True)
[{a0: 0, a1: 0, a2: 1, a3: 0}]


EDIT 2 (answering a question in the comments): To transform the system of linear equations to matrices, you may do:

sage: SSR = [ssr_a0,ssr_a1,ssr_a2,ssr_a3,ssr_a4]
sage: A = matrix([[ssr_a.coefficient(a) for a in [a0,a1,a2,a3]] for ssr_a in SSR])
sage: b = vector([-ssr_a.subs(a0=0,a1=0,a2=0,a3=0) for ssr_a in SSR])
sage: A \ b
(-4.81096644000283e-16, 8.08282642120849e-14, 0.999999999999817, 7.15728811560799e-14)
sage: A.change_ring(QQ) \ b.change_ring(QQ)  # or in the ring of rationals
(0, 0, 1, 0)


If you look at the system of linear equations, you can see that it really has 4 equations with 4 unknowns (the 5th equation is 0=0 and the fifth unknown a4 just doesn't appear)

sage: [ssr_a0==0,ssr_a1==0,ssr_a2==0,ssr_a3==0,ssr_a4==0]
[8*a0 + 6.20*a1 + 9.220000*a2 + 16.68200*a3 - 9.2200000 == 0,
6.20000*a0 + 9.2200000*a1 + 16.6820000*a2 + 32.3842000*a3 - 16.682000 == 0,
9.2200*a0 + 16.6820000*a1 + 32.384200*a2 + 64.21802000*a3 - 32.38420000 == 0,
16.68200*a0 + 32.384200*a1 + 64.2180200*a2 + 128.12456200*a3 - 64.2180200 == 0,
0 == 0]


That system has a solution involving only the first four unknown, which explains what you obtain:

[{a0: 0, a1: 0, a2: 1, a3: 0, a4: r3}]


Indeed, we can see that the coefficient of a2 matches the constant terms. Alternatively, you can just remove a4 in the call to solve since that variable does not appear in the system:

sage: solve([ssr_a0==0,ssr_a1==0,ssr_a2==0,ssr_a3==0,ssr_a4==0], a0, a1, a2, a3, solution_dict=True)
[{a0: 0, a1: 0, a2: 1, a3: 0}]


EDIT 2 (answering a question in the comments): To transform the system of linear equations to matrices, you may do:

sage: SSR = [ssr_a0,ssr_a1,ssr_a2,ssr_a3,ssr_a4]
sage: A = matrix([[ssr_a.coefficient(a) for a in [a0,a1,a2,a3]] for ssr_a in SSR])
sage: b = vector([-ssr_a.subs(a0=0,a1=0,a2=0,a3=0) for ssr_a in SSR])
sage: A \ b
(-4.81096644000283e-16, 8.08282642120849e-14, 0.999999999999817, 7.15728811560799e-14)
sage: A.change_ring(QQ) \ b.change_ring(QQ)  # or in the ring of rationals
(0, 0, 1, 0)


If you look at the system of linear equations, you can see that it really has 4 equations with 4 unknowns (the 5th equation is 0=0 and the fifth unknown a4 just doesn't appear)

sage: [ssr_a0==0,ssr_a1==0,ssr_a2==0,ssr_a3==0,ssr_a4==0]
[8*a0 + 6.20*a1 + 9.220000*a2 + 16.68200*a3 - 9.2200000 == 0,
6.20000*a0 + 9.2200000*a1 + 16.6820000*a2 + 32.3842000*a3 - 16.682000 == 0,
9.2200*a0 + 16.6820000*a1 + 32.384200*a2 + 64.21802000*a3 - 32.38420000 == 0,
16.68200*a0 + 32.384200*a1 + 64.2180200*a2 + 128.12456200*a3 - 64.2180200 == 0,
0 == 0]


That system has a solution involving only the first four unknown, which explains what you obtain:

[{a0: 0, a1: 0, a2: 1, a3: 0, a4: r3}]


Indeed, we can see that the coefficient of a2 matches the constant terms. Alternatively, you can just remove a4 in the call to solve since that variable does not appear in the system:

sage: solve([ssr_a0==0,ssr_a1==0,ssr_a2==0,ssr_a3==0,ssr_a4==0], a0, a1, a2, a3, solution_dict=True)
[{a0: 0, a1: 0, a2: 1, a3: 0}]


EDIT (answering a question in the comments): To transform the system of linear equations to matrices, matrices and solve the system, you may do:

sage: SSR = [ssr_a0,ssr_a1,ssr_a2,ssr_a3,ssr_a4]
sage: A = matrix([[ssr_a.coefficient(a) for a in [a0,a1,a2,a3]] for ssr_a in SSR])
sage: b = vector([-ssr_a.subs(a0=0,a1=0,a2=0,a3=0) for ssr_a in SSR])
sage: A \ b
(-4.81096644000283e-16, 8.08282642120849e-14, 0.999999999999817, 7.15728811560799e-14)
sage: A.change_ring(QQ) \ b.change_ring(QQ)  # or in the ring of rationals
(0, 0, 1, 0)