Completed Lab Manual 3vy23ue059
Completed Lab Manual 3vy23ue059
IN
A
Laboratory Report On
MATHEMATICS-II LABORATORY
VARUN R MALASHETTI
(USN: 3VY23UE059)
KALABURAGI
2023-2024
VISVESVARAYA TECHNOLOGICAL UNIVERSITY, BELAGAVI
CPGS, Kalaburagi
U.S.N:3VY23UE059 DATE:
CERTIFICATE
Examiners:
OUTPUT :
(Derivative(N.x**2*N.y + 2*N.x*N.z - 4, N.x))*N.i +
(Derivative(N.x**2*N.y + 2*N.x*N.z - 4, N.y))*N.j +
(Derivative(N.x**2*N.y + 2*N.x*N.z - 4, N.z))*N.k Gradient of
N.x**2*N.y + 2*N.x*N.z - 4 is (2*N.x*N.y + 2*N.z)*N.i + N.x**2*N.j +
2*N.x*N.k
OUTPUT :
(Derivative(N.x**2*N.y*N.z*N.i + N.x*N.y**2*N.z*N.j +
N.x*N.y*N.z**2*N.k, N.x))*N.i + (Derivative(N.x**2*N.y*N.z*N.i +
N.x*N.y**2*N.z*N.j + N.x*N.y*N.z**2*N.k, N.y))*N.j +
(Derivative(N.x**2*N.y*N.z*N.i + N.x*N.y**2*N.z*N.j +
N.x*N.y*N.z**2*N.k, N.z))*N.k
divergence of N.x**2*N.y*N.z*N.i + N.x*N.y**2*N.z*N.j +
N.x*N.y*N.z**2*N.kis
6*N.x*N.y*N.z
To find curl of F⃗ = 𝑥2yzˆi + 𝑦2zxˆj + 𝑧 2xykˆ.
OUTPUT:
(Derivative(N.x**2*N.z*N.i + N.x*N.y**2*N.z*N.j + N.x*N.y*N.z**2*N.k,
N.x))*N.i + (Derivative(N.x**2*N.z*N.i + N.x*N.y**2*N.z*N.j +
N.x*N.y*N.z**2*N.k, N.y))*N.j + (Derivative(N.x**2*N.z*N.i +
N.x*N.y**2*N.z*N.j + N.x*N.y*N.z**2*N.k, N.z))*N.k
curl of N.x**2*N.z*N.i + N.x*N.y**2*N.z*N.j + N.x*N.y*N.z**2*N.k is
(-N.x*N.y**2 + N.x*N.z**2)*N.i + (N.x**2 - N.y*N.z**2)*N.j +
N.y**2*N.z*N.k
LAB 2 :- Computation of basis and dimension for a vector space
and graphical representation of linear transformation.
Rank Nullity Theorem:
OUTPUT:
Rank of the matrix 2
Null space of the matrix [[-0.40824829]
[ 0.81649658]
[-0.40824829]]
Null space of the matrix 1
Rank - nullity theorem holds .
Find the dimension of subspace spanned by the vectors (1, 2, 3),(2, 3, 1) and (3, 1, 2).
OUTPUT:
Basis of the matrix 3
Dimension of the matrix 3
LAB 3 :- Visualization in time and frequency domain of standard
functions.
Laplace Transformation:
Represent the Laplace transform of f(t)=sin2t, both in time and frequency domains.
OUTPUT:
The Laplace Transform of f is 2/(s**2 + 4) 2/(s**2 + 4)
LAB 4 :- Computing Laplace transform and inverse Laplace
transform of standard functions
f = sin(a*t)
laplace_transform = integrate(f*exp(-s*t), (t, 0, oo))
laplace_transform
OUTPUT:-
LAB 5 :- Laplace transform of convolution of two functions.
The Convolution Theorem:
Find the Laplace Transform of the Convolution of the functions f(t)= t and g(t)=et
def LT(func):
return laplace_transform(func, t, s, noconds=True)
FOG = LT(fog)
print('Laplace Transform of the convolution of given functions is:')
display(FOG)
OUTPUT:
Laplace Transform of the convolution of given functions is :
1/(s**2*(s - 1))
LAB 6 :- Solution of algebraic and transcendental equation by
Regula – falsi and Newton – Raphson method.
Find a root of the equation 3x=cosx+1, near 1, by Newton Rapshon Method .Perform
5 iterations.
OUTPUT:
enter the function : 3*x -cos(x) -1
Output:
Enter the function x**3-2*x-5
Enter a valus :2
Enter b valus :3
OUTPUT:
enter the function : x**3-2*x-5
enter a value : 2
enter b value : 3
enter number of iterations : 5
Use Newtons forward interpolation to obtain the interpolating polynomial and hence
calculate y(2) for the following:
x: 1 3 5 7 9
y: 6 10 62 210 502
y[0]= 6
x[1]= 3
y[1]= 10
x[2]= 5
y[2]= 62
x[3]= 7
y[3]= 210
x[4]= 9
y[4]= 502
9.00 502.00
THE INTERPOLATING POLYNOMIAL IS
3 2
1.0⋅t - 3.0⋅t + 1.0⋅t + 7.0
Trapezoidal Rule:
Evaluate ∫ 50 1 2 dx.
1+𝑥
from sympy import *
var('x')
f=lambda x:1/(1+x**2)
x0=0
xn=5
n=10
h=(xn-x0)/n
I=f(x0)+f(xn)
for i in range(1,n):
k=x0+i*h
i=i+2*f(k)
result=I*(h/2)
print("Trapezoidal y=",result)
OUTPUT :
Trapezoidal y= 0.25961538461538464
OUTPUT :
simpsons1/3th y= 0.01730769230769231
Simpson’s (3/8)th Rule:
Evaluate using∫ 60 1 2 dx Simpson’s 3/8 th rule, taking 6 sub intervals
1+𝑥
OUTPUT :
simpson's 3/8th rule y= 1.2763116057233705
LAB 9 :- Solution of ODE of first order and first degree by Taylor’s
series and Modified Euler’s method.
OUTPUT :
The required values are : at x=0.00, y=0.00000,
x=0.10, y=0.34850,
x=0.20,y=0.81079,
x=0.30, y=1.41590.
Modified Euler’s method:
import numpy as np
import matplotlib.pyplot as plt
def modified_euler(f, x0, y0, h, n):
x = np.zeros(n + 1)
y = np.zeros(n + 1)
x[0] = x0
y[0] = y0
for i in range(n):
x[i + 1] = x[i] + h
k1 = h * f(x[i], y[i])
k2 = h * f(x[i] + h, y[i] + k1)
y[i + 1] = y[i] + 0.5 * (k1 + k2)
return x, y
def f(x, y):
return -0.01 * y
x0 = 0.0
y0 = 100.0
h = 25
n = 4
x, y = modified_euler(f, x0, y0, h, n)
print("The required value at x=%.2f, y=%.5f" % (x[4], y[4]))
print("\n\n")
plt.plot(x, y, 'bo-')
plt.xlabel('x')
plt.ylabel('y')
plt.title('Solution of dy/dx = -ky using Modified Euler\'s Method')
plt.grid(True)
plt.show()
OUTPUT :
required value at x= 100.00, y=37.25290
LAB 10 :- Solution of ODE of first order and first degree by Range –
kutta 4th order method and Milne’s predictor and corrector
method.
Range-Kutta method
OUTPUT :
[2. 2.62 3.36 4.14 4.94 5.77 6.62]