Partial Derivatives
Glissez pour afficher le menu
When working with functions of several variables, such as f(x,y), the idea of a derivative extends naturally, but with a key difference: you can measure how the function changes with respect to one variable while keeping the others fixed. This is known as taking a partial derivative.
To compute the partial derivative of a function with respect to a specific variable, you treat all other variables as constants. For example, consider the function f(x,y)=x2y+3xy2. If you want to find the partial derivative with respect to x, denoted as ∂x∂f, you treat y as a constant and differentiate as you would in single-variable calculus. The result is:
- The derivative of x2y with respect to x is 2xy (since y is constant);
- The derivative of 3xy2 with respect to x is 3y2 (again, y is constant).
So, ∂x∂f=2xy+3y2.
Similarly, to find the partial derivative with respect to y, denoted as ∂y∂f, treat x as constant:
- The derivative of x2y with respect to y is x2;
- The derivative of 3xy2 with respect to y is 6xy.
So, ∂y∂f=x2+6xy.
This process can be generalized for any function of several variables. The notation for partial derivatives often uses the curly "∂" symbol to distinguish from ordinary derivatives. Geometrically, the partial derivative with respect to a variable at a point gives the slope of the tangent line to the curve you obtain by varying that variable alone, holding the others fixed.
Partial derivatives are foundational to multivariate calculus, enabling you to analyze how a function changes in each direction independently.
1234567891011121314151617import sympy as sp x, y = sp.symbols('x y') f = x**2 * y + 3 * x * y**2 # Compute partial derivatives symbolically df_dx = sp.diff(f, x) df_dy = sp.diff(f, y) # Evaluate at the point (x, y) = (1, 2) df_dx_at_1_2 = df_dx.subs({x: 1, y: 2}) df_dy_at_1_2 = df_dy.subs({x: 1, y: 2}) print("Symbolic partial derivative ∂f/∂x:", df_dx) print("Value at (1, 2):", df_dx_at_1_2) print("Symbolic partial derivative ∂f/∂y:", df_dy) print("Value at (1, 2):", df_dy_at_1_2)
Merci pour vos commentaires !
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion