[Link]. II Sem (SEP) Lab Manual.
Department of Mathematics
Practical I: Program to find angle between Radius vector & Tangent
If r f ( ) be the given curve then angle between radius vector and
r dr
tangent is given as tan r1
r1 d
Find the angle between radius vector and tangent for r a (1 cos )
/*Angle between redius vector and tangent*/
kill(all)$
a:1$
r:a*(1-cos(θ))$
print("Given curve is r=",r)$
d:diff(r,θ)$
print("dr/dt=",d)$
b:r*(1/d)$
print("tan(pi)=",b)$
tan_pi:trigreduce(trigrat(b))$
print("tan(pi)=",tan_pi)$
pi:trigreduce(atan(tan_pi))$
print("Angle between redius vector and tangent is",pi)$
Output:
1 B.L.D.E.A’s Commerce, BHS Arts & TGP Science College, Jamkhandi.
BSc II Sem (SEP) Lab Manual. Department of Mathematics
Practical II: Program to finding radius of curvature of the given curves.
If y=f(x) be a Cartesian curve then radius of curvature is given by
1 y
3
2 2
dy d2y
1
where y1 y2 2
y2 dx dx
Find radius of curvature of x y 2
4 4
/*radius of curvature in cartesian form*/
kill(all)$
depends(y,x)$
print("Given function is")$
f(x):=x^4+y^4=2$
disp(f(x))$
dy:diff(f(x),x)$
dy_dx:solve(dy,diff(y,x))$
y1:rhs(dy_dx[1])$
print("dy/dx=",y1)$
y11:subst([x=1,y=1],y1)$
print("dy/dx at (1,1)=",y11)$
dy2:diff(y1,x)$
print("d2y/dx2=",dy2)$
y2:subst(y1,diff(y,x),dy2)$
y21:subst([x=1,y=1],y2)$
print("d2y/dx2 at (1,1)=",y21)$
R:((1+(y11)^2)^(3/2)/(y21))$
print("Radius of curvature is ρ=",R)$
2 B.L.D.E.A’s Commerce, BHS Arts & TGP Science College, Jamkhandi.
BSc II Sem (SEP) Lab Manual. Department of Mathematics
Practical III: Program to finding Center of curvature of the given curves.
Let y=f(x) be the equation of curve and (α, β) be the coordinates of centre
y1 (1 y1 ) (1 y1 )
2 2
of curvature then x y2
y
y2
Example1: Find the coordinates of centre of curvature for xy=c 2 at (c,c)
kill(all)$
depends(y,x)$
print("Given function is")$
f(x):=x*y=c^2$
disp(f(x))$
dy:diff(f(x),x)$
dy_dx:solve(dy,diff(y,x))$
y1:rhs(dy_dx[1])$
print("dy/dx=",y1)$
dy2:diff(y1,x)$
y2:subst(y1,diff(y,x),dy2)$
print("d2y/dx2=",y2)$
α:(ratsimp(x-(y1*(1+y1^2)/y2)))$
α1:subst([x=c,y=c],α)$
β:ratsimp(y+(1+y1^2)/y2)$
β1:subst([x=c,y=c],β)$
print("coordinates of centre of curvature are α =",α,"β=",β)$
print("coordinates of centre of curvature are at (c,c) α =",α1,"β=",β1)$
3 B.L.D.E.A’s Commerce, BHS Arts & TGP Science College, Jamkhandi.
BSc II Sem (SEP) Lab Manual. Department of Mathematics
Practical IV: Program to finding arc length of given curves.
If y f (x) be a Cartesian curve then arc length
2
dx
2
ds dy ds
1 & 1
dx dx dy dy
Cartesian Curve: Find the arc length of y 2 4ax
/*Arc Length*/
kill(all)$
depends(y,x)$
print("Given cueve is")$
f(x):=y^2=4*a*x$
print(f(x))$
dy:diff(f(x),x)$
dy1:solve(dy,diff(y,x))$
y1:rhs(dy1[1])$
print("dy/dx=",y1)$
AL1:sqrt(1+y1^2)$
AL2:sqrt(1+(1/y1^2))$
print("Arc length is ds/dx=",AL1,"& ds/dy=", AL2)$
Output:
4 B.L.D.E.A’s Commerce, BHS Arts & TGP Science College, Jamkhandi.
BSc II Sem (SEP) Lab Manual. Department of Mathematics
Practical V: Program to finding arc length of polar curves.
If y f (x) be a Cartesian curve then arc length in parametric form
2 2
ds dr ds dr
1 r2 r2
dr d d d
Find the arc length of r a(1 cos )
/*Arc Length*/
kill(all)$
depends(r,θ)$
print("Given polar curve is")$
r(θ):=a*(1+cos(θ))$
print("r=",r(θ))$
dr:diff(r(θ),θ)$
print("dr/dθ=",dr)$
AL1:trigsimp(sqrt((r(θ))^2+(dr)^2))$
AL2:trigsimp(sqrt(1+(r(θ))^2/(dr)^2))$
print("Arc length is ds/dθ=",AL1)$
print("Arc length is ds/dr=",AL2)$
Output:
5 B.L.D.E.A’s Commerce, BHS Arts & TGP Science College, Jamkhandi.
BSc II Sem (SEP) Lab Manual. Department of Mathematics
Practical VII: Program to verify Euler’s theorem & its extension.
If u f ( x, y) be a homogenous function of two variables then
u u
Euler’s theorem is x x y y nu
2u 2u 2 u
2
Euler’s Extension theorem is x 2 xy
2
y n(n 1)u
x 2 xy y 2
Verify Euler’s theorem & its extension for f ( x, y) ax2 2hxy by 2
kill(all)$
print("Given function is")$
f:a*x*x+2*h*x*y+b*y*y$
print("f=",f)$
n:2$
print("n=",n)$
fx:diff(f,x)$
fy:diff(f,y)$
print("fx=",fx,"fy=",fy)$
lhs:ratsimp(x*fx+y*fy)$
print("LHS=",lhs)$
rhs:ratsimp(n*f)$
print("RHS=",rhs)$
if lhs=rhs then
print("Euler Theorem is verified")
else
print("Euler Theorem is not verified")$
print("Euler's extension")$
fxx:diff(fx,x)$
fxy:diff(fx,y)$
6 B.L.D.E.A’s Commerce, BHS Arts & TGP Science College, Jamkhandi.
BSc II Sem (SEP) Lab Manual. Department of Mathematics
fyy:diff(fy,y)$
print("fxx=",fxx,"fxy=",fxy,"fyy=",fyy)$
lhs:ratsimp(x^2*fxx+2*x*y*fxy+y^2*fyy)$
print("LHS=",lhs)$
rhs:ratsimp(n*(n-1)*f)$
print("RHS=",rhs)$
if lhs=rhs then
print("Extension of Euler Theorem is verified")
else
print("Extension ofEuler Theorem is not verified")$
7 B.L.D.E.A’s Commerce, BHS Arts & TGP Science College, Jamkhandi.
BSc II Sem (SEP) Lab Manual. Department of Mathematics
Practical VIII: Program to find Jacobian of second & third order.
If u and v are functions of x & y then Jacobian of (u,v) with respect to (x,y)
u u u
u u x y z
(u, v) x y (u, v, w) v v v
is J J
( x, y ) v v ( x, y , z ) x y z
x y w w w
x y z
( x, y )
If x r cos y r sin find
( r , )
kill(all)$
v:[r,t]$
x:r*cos(t)$
y:r*sin(t)$
f:[x,y]$
print("given functions are x=",x,"y=",y)$
j:jacobian(f,v)$
print("J=",j)$
trigsimp(determinant(j))$
print("Jacobian J=",%)$
Output:
8 B.L.D.E.A’s Commerce, BHS Arts & TGP Science College, Jamkhandi.
BSc II Sem (SEP) Lab Manual. Department of Mathematics
Practical IX: Program to equation of sphere and plot a graph
If (a, b, c) be the centre and r be the radius of the sphere the equation of the
sphere is ( x a)2 ( y b)2 ( z c)2 r 2
Find the equation of the Sphere with center at (1,2,−3) and radius =4.
kill(all)$
load(ntrig)$
a:1$
b:2$
c:-3$
print("Center of the sphere is"(a,b,c))$
r:4$
print("radius of a sphere r=",r)$
sphr_eqn:((x-a)^2+(y-b)^2+(z-c)^2=r^2);
print("Equation of the sphere is",ratsimp(sphr_eqn))$
Output:
Examples:
1. Find the equation of Sphere with center at (3,-4,7) and radius =7.
2. Find the equation of Sphere with center at (1,2,3) and radius =3.
9 B.L.D.E.A’s Commerce, BHS Arts & TGP Science College, Jamkhandi.
BSc II Sem (SEP) Lab Manual. Department of Mathematics
10 B.L.D.E.A’s Commerce, BHS Arts & TGP Science College, Jamkhandi.