Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Partial Derivative of the Function | Mathematical Analysis
Mathematics for Data Analysis and Modeling
course content

Зміст курсу

Mathematics for Data Analysis and Modeling

Mathematics for Data Analysis and Modeling

1. Basic Mathematical Concepts and Definitions
2. Linear Algebra
3. Mathematical Analysis

bookPartial Derivative of the Function

Partial derivative

If we are talking about the functions with multiple arguments, we must consider the concept of partial derivative. A partial derivative measures how a function changes with respect to one of its variables while keeping the other variables constant. It is a concept used in multivariable calculus to analyze the rate of change of a function in multiple dimensions.
If we have a function y = f(x1, x2, ..., xn) the partial derivative with respect to argument xi is defined as follows:

12345678910111213141516171819202122232425262728
import sympy as sp # Define the variables x, y = sp.symbols('x y') # Define the function f = x**3 + 2*x*y + y**2 + x - 3*y # Calculate the partial derivative with respect to x df_dx = sp.diff(f, x) # Calculate the partial derivative with respect to y df_dy = sp.diff(f, y) # Define the point at which to evaluate the partial derivatives point = {x: 2, y: 3} # Evaluate the partial derivatives at the given point df_dx_value = df_dx.subs(point) df_dy_value = df_dy.subs(point) # Print the partial derivatives print(f'Partial derivative with respect to x: {df_dx}') print(f'Partial derivative with respect to y: {df_dy}') # Print the partial derivatives at the given point print(f'Partial derivative with respect to x at point {point}: {df_dx_value}') print(f'Partial derivative with respect to y at point {point}: {df_dy_value}')
copy

Higher-order derivatives

We can also take derivatives and partial derivatives of higher orders. For example, the second (partial) derivative is defined as the (partial) derivative of the first (partial) derivative of a function, and so on:

We can use sympy library to calculate derivative of the second order too:

12345678910111213
import sympy as sp # Define the variable x, y = sp.symbols('x y') # Define the function f = 2*x**3 + sp.sin(x*y) # Calculate the second-order derivative d2f_dx2 = sp.diff(f, x, 2) # Print the second-order derivative print(f'Second-order partial derivative with respect to x is: {d2f_dx2}')
copy

We used d2f_dx2 = sp.diff(f, x, 2) to calculate the derivative of the second order of the function f with respect to argument x.

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 2
We're sorry to hear that something went wrong. What happened?
some-alt