Check out the last four links in this web site:

http://www.neng.usu.edu/cee/faculty/gurro/Classes/ClassNotesAllClasses/CEE3510/Lectures/CEE3510_Lecture15a.htm

They are:

- Pipes converging at a junction - pdf file: see pages 5-12 in this pdf file
- Pipes converging at a junction (SMath Studio files): SMath Studio file with examples
- Creating function "fNewtonm.sm" to solve multiple equations OPTIONAL VIDEO - explains how to create the code snippet for the function
- Using function "fNewtonm.sm" to solve problems of pipe at a junction VIDEO - shows how to use SMath Studio to solve junction problems

Note: the "norme" function in the most recent version of SMath Studio (July 2012) is not working properly, so you'll have to implement your own "norme" function, e.g.:

NormE(F):line(nn:length(F),sqrt(sum((el(F,k)^2),k,1,nn)),2,1)

NOTE: copy the line above and paste it in your SMath Studio worksheet, but not as text.

The function that solves the system of non-linear equations is:

fNewtonm(f(x),xs,x0,ε,Nmax):line(fJ(x):Jacob(f(x),xs),k:0,xG:x0,while(((k≤Nmax)&(NormE(f(xG))>ε)),line(JJ:eval(fJ(xG)),JJI:eval(invert(JJ)),fxG:eval(f(xG)),DxG:eval(JJI*fxG),xGp1:eval(xG-DxG),k:k+1,xG:xGp1,7,1)),mat(xG,k,2,1),5,1)

Again, copy the line above and paste it in your SMath Studio worksheet, but not as text.