Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Jacobian Matrix and Change of Variables | Section
Understanding Multivariate Calculus
SectionΒ 1. ChapterΒ 8
single

single

bookJacobian Matrix and Change of Variables

Swipe to show menu

The Jacobian matrix is a fundamental concept in multivariate calculus, especially when analyzing how functions transform regions in space. Suppose you have a transformation from variables x,yx, y to new variables u,vu, v defined by two functions:

u=f(x,y)v=g(x,y)u = f(x, y)\\ v = g(x, y)

The Jacobian matrix of this transformation is the matrix of all first-order partial derivatives:

J=[βˆ‚uβˆ‚xβˆ‚uβˆ‚yβˆ‚vβˆ‚xβˆ‚vβˆ‚y]J = \begin{bmatrix} \frac{\partial u}{\partial x} & \frac{\partial u}{\partial y} \\ \frac{\partial v}{\partial x} & \frac{\partial v}{\partial y} \end{bmatrix}

The determinant of this matrix, called the Jacobian determinant, measures how areas (or volumes in higher dimensions) are scaled by the transformation at each point. When changing variables in a double integral, the absolute value of the Jacobian determinant adjusts for the stretching or shrinking caused by the transformation.

Example: let's say you have the transformation:

u=x+yv=xβˆ’yu = x + y\\ v = x - y

The Jacobian matrix is:

J=[βˆ‚uβˆ‚xβˆ‚uβˆ‚yβˆ‚vβˆ‚xβˆ‚vβˆ‚y]=[111βˆ’1]J = \begin{bmatrix} \frac{\partial u}{\partial x} & \frac{\partial u}{\partial y} \\ \frac{\partial v}{\partial x} & \frac{\partial v}{\partial y} \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}

The Jacobian determinant is:

∣J∣=(1)(βˆ’1)βˆ’(1)(1)=βˆ’2|J| = (1)(-1) - (1)(1) = -2

This means that at any point, the transformation scales areas by a factor of 2 (the sign indicates orientation).

123456789101112131415161718192021
import sympy as sp import numpy as np # 1. Define the symbolic variables x, y = sp.symbols('x y') # 2. Define our functions as a matrix funcs = sp.Matrix([x**2 + y, x - y**2]) # 3. Compute the Jacobian symbolically (this replaces the custom jacobian_matrix function) J_sym = funcs.jacobian([x, y]) # 4. Substitute the values x=1.0, y=2.0 J_eval = J_sym.subs({x: 1.0, y: 2.0}) # Print the results print("Jacobian matrix at (1, 2):") print(np.array(J_eval, dtype=float)) # Convert to a numpy array for a standard display format print("\nJacobian determinant at (1, 2):") print(float(J_eval.det()))
copy
Task

Swipe to start coding

Practice applying your understanding of the Jacobian matrix for a transformation utilizing the sympy library. Given the transformation defined by h=xsin⁑(y)h = x \sin(y) and k=ycos⁑(x)k = y \cos(x), your goal is to compute the exact analytical Jacobian matrix and evaluate it at the point (1.0,0.5)(1.0, 0.5).

  • Define the symbolic variables x and y utilizing sympy.symbols().
  • Define the equations hh and kk utilizing the sympy sine and cosine functions.
  • Create a sympy.Matrix representing the system of equations.
  • Compute the analytical Jacobian matrix utilizing the .jacobian() method.
  • Substitute the variables x and y with the values 1.0 and 0.5 utilizing the .subs() method.
  • Convert the evaluated matrix to a numpy array of floats and assign it to the J variable.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 8
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt