Lab 3

Exercise 1: Symbolic Differentiation

  1. Define the symbols (x), (y), and (z) using SymPy.
  2. Define the expression ( f(x, y) = x^3 \sin(y) + e^{x^2 \cdot y} ).
  3. Compute the following derivatives:
    • Partial derivative of (f) with respect to (x).
    • Partial derivative of (f) with respect to (y).
    • Mixed partial derivative (\frac{\partial^2 f}{\partial x \partial y}).
    • Evaluate the second partial derivative (\frac{\partial^2 f}{\partial y^2}) at (x = 1) and (y = \pi/4).

Exercise 2: Higher-Order and Unevaluated Derivatives

  1. Define the expression ( g(x) = x^6 + 4x^4 - 2x^2 + 1 ).
  2. Compute the second, third, and fourth derivatives of (g(x)).
  3. Create an unevaluated derivative for ( \frac{d^5}{dx^5} g(x) ) using the Derivative class.
  4. Evaluate the unevaluated derivative from step 3 using doit() and confirm the result.
  5. Find and plot the critical points of (g(x)) within the interval ([-2, 2]).

Exercise 3: Symbolic Integration

  1. Define the expression ( h(x) = x^3 + \cos(x) ).
  2. Compute:
    • The indefinite integral of (h(x)).
    • The definite integral of (h(x)) over ([0, \pi]).
  3. Define a new expression ( p(x) = x^2 e^{-x^2} ) and compute its improper integral over ([0, \infty)).
  4. Solve for ( C ) such that the integral of ( h(x) + C ) over ([0, \pi]) equals 10.

Exercise 4: Series Expansion

  1. Define the expression ( f(x) = \cos(x) \cdot e^x ).
  2. Compute the Taylor series expansion of (f(x)) around (x = 0) up to the 8th order.
  3. Define the expression ( g(x) = \ln(1 + x^2) ). Compute its asymptotic expansion as (x \to \infty) up to 4 terms.
  4. Truncate the Taylor series from step 2 by removing the (O(x^n)) term and write the resulting polynomial explicitly.

Exercise 5: Solving Differential Equations

  1. Define the second-order ODE ( y'' - 2y' + y = 0 ).
  2. Solve the ODE symbolically and display the general solution.
  3. Solve the ODE with initial conditions:
    • ( y(0) = 1 )
    • ( y'(0) = 0 ).
  4. Plot the solution with initial conditions using lambdify and matplotlib.

Exercise 6: Systems of ODEs

  1. Define the coupled system: [ y_1'(x) = y_1(x) + y_2(x), \quad y_2'(x) = -y_1(x) + 2y_2(x) ]
  2. Solve the system symbolically using dsolve.
  3. Extract and manipulate the solutions for (y_1(x)) and (y_2(x)).
  4. Verify the solutions satisfy the original system using checkodesol.