# Creating and solving large systems of equations

I am trying to follow a solution in a book so that I can build my own model. They produce the set of equations below. The book claims it to be a system of equations with 10 unknowns; however from my understanding, to solve a system of equations, each equation in the system must have all of the unknowns for the solver to work. So I am wondering whether I have to rearrange all the equations so that each unknown appears in every equation? This seems like a very long process and I will definitely make an error somewhere. Is there an alternative to doing this or is this the only way? Thanks for any help you can offer. You definitely don't have to have each unknown in each equation (unless you consider it to be there with a coefficient of $0$). The system $x=1,y=2$ doesn't have each unknown in each equation and is easy to solve. If you are solving this system by hand they will ripple through. If you write it as a matrix equation, the nice thing is that it is tridiagonal. Each equation only links three neighboring unknowns. You can solve the system in two passes. Your last equation is $T_9=\frac 12(T_8+T_{10})$ and $T_{10}$ is a constant, not a variable. You can insert this into the next equation up, which is $T_8=\frac 12(T_7+T_9)=\frac 12(T_7+\frac 12(T_8+T_{10})),T_8=\frac 23T_7+\frac 13T_{10}$ and so on. When you get to the top you will get a value for $T_0$, which you can ripple back downward to get all the rest.

You can get a computer algebra system to do the work for you. The funny stuff that goes on at the ground surface will make it a bit messy.

All of the variables do appear in each linear equation, but some of them have coefficient zero. For example, we could write the first equation as $$T_0 - 2T_1 + T_2 + 0T_3 + 0T_4 + 0T_5 + 0T_6 + 0T_7 + 0T_8 + 0T_9 + 0T_{10}.$$ When you write out the matrix that corresponds to this system of linear equations it will have many zeroes. I don't expect that the problem is easy to solve, but you should not have any trouble setting it up from a linear algebra perspective.

• Thanks for that. I will try your suggestion in my solver and see what comes out! – alkey Apr 8 '14 at 23:12

I finally used a Fortran program to solve the problem and if anyone is interested here it is:

PROGRAMME GAUSS
DATA T0,T1,T2,T3,T4,T5,T6,T7,T8/9*0./
DATA T9/50./

real,parameter:: b=0.1714E-8
e = 0.6

DO 20 K = 1,1000

t9 = (T8+50)/2.
t8 = (T7+T9)/2.
t7 = (T6+T8)/2.
t6 = (T5+T7)/2.
t5 = ((86.4*t4)+(0.817*t6))/87.217
t4 = (T3+T5)/2.
t3 = (T2+T4)/2.
t2 = (T1+T3)/2.
t1 = (T0+T2)/2.
t0 = (280 + (e*b*((510.**4)-(t0+460.)**4)) +(86.4*t1))/89.9

WRITE (*,10)K,T0,T1,T2,T3,T4,T5,T6,T7,T8,T9
10 FORMAT (' ',I3,10(F8.1))
20 CONTINUE
END PROGRAM GAUSS