Question: Write a Python Code for it Question 1: Systems of Non-Linear Equations (40 Marks) Consider the vector-valued function f : R2 + R2 defined by

Write a Python Code for itWrite a Python Code for it Question 1: Systems of Non-Linear Equations

Question 1: Systems of Non-Linear Equations (40 Marks) Consider the vector-valued function f : R2 + R2 defined by [81(x,y)] [200x(y 22) - 2 + 1] 152(x, y) 100(x2 y) (a) Rather than writing the code in terms of x and y, we want to use a more compact, and often more powerful, way of thinking about these problems. In particular, we are going to rely on vectors and matrices. Write two Python functions, say "nlfun and nljac". The two Python functions should take as an input a column vector xvec of dimension 2. This vector stores the current values of the variables x and y as the entries avec[0] and xvec[1], respectively. The two Python functions should return as their respective output: i) for nlfun: a column vector fval of dimension 2 that contains the value of f(.) at xvec; ii) for nljac: a 2-by-2 matrix fjac that contains the Jacobian of f(.) at xvec. Note: in nlfun you may want to write two formulas that compute the two entries in the vector storing the two dependent variables (fval(0] and fval[1]); in nljac you may want to write four formulas, namely the four partial derivatives that represent the Jacobian (fjac[0,0], fjac[0, 1]...). All formulas should be expressed in terms of the entries of the vector evec, i.e. xvec[0] and xvec[1]. Question 1: Systems of Non-Linear Equations (40 Marks) Consider the vector-valued function f : R2 + R2 defined by [81(x,y)] [200x(y 22) - 2 + 1] 152(x, y) 100(x2 y) (a) Rather than writing the code in terms of x and y, we want to use a more compact, and often more powerful, way of thinking about these problems. In particular, we are going to rely on vectors and matrices. Write two Python functions, say "nlfun and nljac". The two Python functions should take as an input a column vector xvec of dimension 2. This vector stores the current values of the variables x and y as the entries avec[0] and xvec[1], respectively. The two Python functions should return as their respective output: i) for nlfun: a column vector fval of dimension 2 that contains the value of f(.) at xvec; ii) for nljac: a 2-by-2 matrix fjac that contains the Jacobian of f(.) at xvec. Note: in nlfun you may want to write two formulas that compute the two entries in the vector storing the two dependent variables (fval(0] and fval[1]); in nljac you may want to write four formulas, namely the four partial derivatives that represent the Jacobian (fjac[0,0], fjac[0, 1]...). All formulas should be expressed in terms of the entries of the vector evec, i.e. xvec[0] and xvec[1]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!