Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 it
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started