Title: Newton's Method for Solving Nonlinear Equations
Python code:
Write a program to solve the system of nonlinear equations using Newton's method.
1.0 = x^4 + y^4
0.0 = x^3 - y
Run Newton's method for 5 iterations, and save the result of each iteration in the "guesses" array. As a starting guess, take each variable to be 1.
In the provided starter code, you are given the function "f" that represents the system of nonlinear equations, as well as the array "w" that should serve as your initial guess.
Your code snippet should define the following variables:
Name: guesses
Type: 2D numpy array
Description: A numpy array of shape 5 x 2, where guesses[i] is the (i + 1)th guess from Newton's method
user_code.py:
import numpy as np
import numpy.linalg as la
def f(w):
x, y = w
return np.array([x**4 + y**4 - 1, x**3 - y])
guesses = np.zeros((5, 2))
# Initial guess, don't save this in output
w = np.array([1., 1.])