Code for 2 dimesional Newtons method.

AI Thread Summary
The discussion focuses on implementing Newton's method for solving a system of two equations in two variables using Mathematica. The user seeks guidance on coding the algorithm, which requires evaluating a function matrix F consisting of two equations, f1 and f2, at a given point (x0, y0), and computing the Jacobian matrix A of mixed partial derivatives. The user has successfully coded single-variable Newton's method but struggles with adapting the function to accept a matrix input for the two-dimensional case. They are looking for assistance in defining a function that can handle matrix operations and integrate the necessary calculations for the iterative process of Newton's method in two dimensions. The conversation highlights the need for clarity on matrix input handling in Mathematica and the application of multivariable calculus concepts, particularly the gradient.
iceblits
Messages
111
Reaction score
0
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 can't get x to be a general matrix in the 2d example.

Any help at all with the coding or anything would be awesome
 
Physics news on Phys.org
Remembering the gradient from multivariable calculus might get you started.
 

Similar threads

Replies
4
Views
1K
Replies
2
Views
3K
Replies
2
Views
2K
Replies
3
Views
2K
Replies
2
Views
3K
Replies
9
Views
2K
Replies
1
Views
2K
Back
Top