Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Code for 2 dimesional newtons method.

  1. Mar 5, 2012 #1
    Hey,
    I'm trying to figure out how to do newtons method in 2 dimensions. That is, I want it to take in an input of my initial matrix {x0,y0} and then follow the algorithm to find the solution to f1(x,y)=0, f2(x,y)=0. The algorithm is {x1,y1}={x0,y0}-A^-1*F{x0,y0}
    where A is the matrix of mixed partials and F{x,y} is the matrix of {f1,f2} evaluated at {x0,y0}.

    I'm new at mathematica so I'm having more trouble on the coding side than the logic side. I was able to figure out how to do the code for single variable newton's method, but I don't know how to let it take in a matrix as an input. I know that matrices are written with brackets, but I don't know how to let a function be a matrix. Like in the one dimensional case I had:

    g[x_] := x - f[x]/(D[f[t], t] /. t -> x)

    but I cant get x to be a general matrix in the 2d example.

    Any help at all with the coding or anything would be awesome
     
  2. jcsd
  3. Mar 5, 2012 #2
    Remembering the gradient from multivariable calculus might get you started.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Code for 2 dimesional newtons method.
Loading...