Now I got it.
I found an algorithm by looking at these two pages:
http://www.economics.unimelb.edu.au/...n-raphson1.pdf
http://uranus.ee.auth.gr/lessons/1/10.html
This is the actual code:
Code:
//INPUT
//Equation to solve
// f(x,y) == 0
// g(x,y) == 0
//Test equations
function f(x,y) = x^2 - y
function g(x,y) = 2x + 3y - 16
//guess the solution
x = 8
y = 40
//END INPUT
h = 0.0000001
for count = 1...10
//Get the derivatives
dfx = (f(x+h,y) - f(x-h,y))/(2h)
dgx = (g(x+h,y) - g(x-h,y))/(2h)
dfy = (f(x,y+h) - f(x,y-h))/(2h)
dgy = (g(x,y+h) - g(x,y-h))/(2h)
//Create the Jacobian matrix
J = matrix(2,2)
J[1] = (dfx , dfy)
J[2] = (dgx , dgy)
//Create the matrix with the function values
F = matrix(2,1)
F[1,1] = f(x,y)
F[2,1] = g(x,y)
//The matrix with the previous solutions
X = matrix(2,1)
X[1,1] = x
X[2,1] = y
//The solution matrix is now calcualted
S = X - invert(J) * F
//Obtain the variables from the solution matrix
x = S[1,1]
y = S[2,1]
next
println "x="+x
println "y="+y
println "f(x,y)="+f(x,y)
println "g(x,y)="+g(x,y)