Code for 2 dimesional Newtons method.

In summary, the conversation discusses the use of Newton's method in 2 dimensions and how to code it in Mathematica. The algorithm and necessary matrices are mentioned, along with the difficulty of using matrices as inputs in functions. A suggestion to use the gradient from multivariable calculus is also given.
  • #1
iceblits
113
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
  • #2
Remembering the gradient from multivariable calculus might get you started.
 

Related to Code for 2 dimesional Newtons method.

1. What is 2 dimensional Newton's method?

2 dimensional Newton's method is an algorithm used for finding the roots of a set of equations in two variables. It uses an iterative process to approximate the roots by making use of the first and second derivatives of the equations.

2. How does 2 dimensional Newton's method work?

2 dimensional Newton's method works by starting with an initial guess for the root and then using the first and second derivatives of the equations to make a more accurate approximation of the root. This process is repeated until the desired level of accuracy is achieved.

3. What are the advantages of using 2 dimensional Newton's method?

Some advantages of using 2 dimensional Newton's method include its speed and efficiency in finding roots, its ability to handle complex equations, and its ability to converge to the correct root even when starting with a poor initial guess.

4. Are there any limitations to 2 dimensional Newton's method?

While 2 dimensional Newton's method is a powerful tool, it does have some limitations. It may fail to converge if the initial guess is too far from the actual root, and it may also converge to a different root if the equations have multiple roots.

5. How is 2 dimensional Newton's method used in real-world applications?

2 dimensional Newton's method is commonly used in fields such as physics, engineering, and economics to solve complex equations and find roots. It can also be used in computer graphics and image processing to optimize and improve algorithms.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Programming and Computer Science
2
Replies
36
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
321
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Replies
1
Views
599
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
Back
Top