unit2_lauc-a
unit2_lauc-a
unit2_lauc-a
%Limit/indeterminate form
syms x % Symbolic Variable
limit(cos(x), x, pi/2) % input angle consider in radian
limit(sind(x), x, 90) % Input angle consider in degree
% Interactive Programming
g=input("Enter the function g(x): ");
a=input("Enter the value 'a' for which limit x tends to 'a': "); h=limit(g,
x, a);
fprintf("The limit of the function g(x)=%s at x tends to %d is %s", g, a, h)
% Successive Differentiation
symsx y % Symbolic variable
diff(x^3-2*x, x, 2) % differentiate function x^3-2*x 2 times w.r.t.
x diff(x^2*y-3*x*y^3, x, 1) % First Order partial derivative w.r.t. x
diff(x^2*y-3*x*y^3, y, 2) % Second Order partial derivative w.r.t. y
% Interactive Programming
f=input("Enter the function f(x)=")
n=input("Enter order of the derivative n=")
for i=1:n
f_d=diff(f, x, i);
1
fprintf("The %i derivative of the function f(x) is %s \n", i, f_d);
end
2
disp("Since, My=Nx, given D.E. is Exact")
terms = sym(children(expand(N)));
terms_free_from_x = sum(terms(~has(terms, x)));
sol=int(M,x)+int(terms_free_from_x,y)==c
else
disp("Since, My=!Nx, given D.E. is Non-Exact")
IF=input("Enter Integrating factor to convert it in to exact")
M1=expand(M*IF);
N1=expand(N*IF);
terms = sym(children(N1));
terms_free_from_x = sum(terms(~has(terms, x))); sol=int(M1,x)
+int(terms_free_from_x,y)==c
end
% Heat Flow
syms T(x) x
x1=input('Enter the inner radius of the pipe (x1): ')
x2=input('Enter the outer radius of the pipe (x2): ')
T1=input('Enter the inner temperature of the pipe (T1): ')
T2=input('Enter the inner temperature of the pipe (T2): ')
k=input('Enter coefficient of thermal conductivity: ')
% find q heat flux/loss first
q= -2*pi*k*(T2-T1)/(log(x2/x1))
% Display the heat flux
fprintf('Heat flux q = %s', q);
a=input('Enter distance normal to the surface area(a): ')
Temp=(T2 - T1) / log(x2 / x1) * log(a / x1) + T1
3
sol=dsolve(ode);
expand(sol)
Step II: solve using previous code of higher order LDE; syms t q(t)
ode= diff(q,t,2)+3*diff(q,t)+2*q==sin(t)
sol=dsolve(ode);
expand(sol)