1st question import numpy as np A = np.matrix("8 -8 -2; 4 -3 -2; 3 -4 1") print("A :", A) ev1, ev2 = np.linalg.eig(A) print("Eigen Values :", ev1) print("Eigen Vector :", ev2) 3rd question import math eqn = input("Enter the function in terms of x (e.g., x**3 - x - 2): ") a = float(input("Enter interval start (a): ")) b = float(input("Enter interval end (b): ")) tol = float(input("Enter tolerance (e.g., 0.0001): ")) fa = eval(eqn, {"x": a, "math": math}) fb = eval(eqn, {"x": b, "math": math}) if fa * fb >= 0: print("Root does not lie in this interval.") else: while (b - a) / 2 > tol: mid = (a + b) / 2 f_mid = eval(eqn, {"x": mid, "math": math}) if f_mid == 0: break elif eval(eqn, {"x": a, "math": math}) * f_mid < 0: b = mid else: a = mid print(f"\nApproximate Root: {((a + b) / 2):.5f}") 5th question x, y, z, w = 0.0, 0.0, 0.0, 0.0 n = 15 print(f"{'k':<4} {'x':<12} {'y':<12} {'z':<12} {'w':<12}") for k in range(1, n+1): x_new = (6 + y - 2*z) / 10 y_new = (25 + x + z - 3*w) / 11 z_new = (-11 - 2*x + y + w) / 10 w_new = (15 - 3*y + z) / 8 x, y, z, w = x_new, y_new, z_new, w_new print(f"{k:<4} {x_new:<12.4f}{y_new:<12.4f}{z_new:<12.4f}{w_new:<12.4f}") 7th question print("Choose M(x,y):") print("1. M = x*y") print("2. M = x + y") m_choice = int(input("Enter your choice for M: ")) print("\nChoose N(x,y):") print("1. N = x**2/2") print("2. N = x - y") n_choice = int(input("Enter your choice for N: ")) def dM_dy(x): if m_choice == 1: return x elif m_choice == 2: return 1 def dN_dx(x): if n_choice == 1: return x elif n_choice == 2: return 1 x = 2 if dM_dy(x) == dN_dx(x): print("\nThe differential equation is Exact") else: print("\nThe differential equation is Not Exact") 9th question from sympy import symbols, Function, dsolve, Eq x = symbols('x') y = Function('y') eq = Eq(y(x).diff(x, 2) - 8*y(x).diff(x) + 15*y(x), 0) solution = dsolve(eq) print("y =", solution.rhs)