We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4
LAB 2: Finding angle between two polar curves, curvature and radius of curvature.
1.Find the angle between the curves r = 4(1 + cost) and r = 5(1 − cost).
from sympy import *
r,t=symbols('r,t') r1=4*(1+cos(t)); r2=5*(1-cos(t)); dr1=diff(r1,t) dr2=diff(r2,t) t1=r1/dr1 t2=r2/dr2 q=solve(r1-r2,t) w1=t1.subs({t:float(q[1])}) w2=t2.subs({t:float(q[1])}) y1=atan(w1) y2=atan(w2) w=abs(y1-y2) print ('Angle between curves in radians is %0.3f '%(w))
2.Find the angle between the curves r = 4 cost and r = 5 sin t.
from sympy import *
r,t=symbols('r,t') r1=4*(cos(t)); r2=5*(sin(t)); dr1=diff(r1,t) dr2=diff(r2,t) t1=r1/dr1 t2=r2/dr2 q=solve(r1-r2,t) w1=t1.subs({t:float(q[0])}) w2=t2.subs({t:float(q[0])}) y1=atan(w1) y2=atan(w2) w=abs(y1-y2) print ('Angle between curves in radians is %0.4f '%(w))
3.Find the radius of curvature, r = 4(1 + cost) at t=π/2.
from sympy import *
t=Symbol('t') r=Symbol('r') r=4*(1+cos(t)) r1=Derivative(r,t).doit() r2=Derivative(r1,t).doit() rho=(r**2+r1**2)**(1.5)/(r**2+2*r1**2-r*r2); rho1=rho.subs(t,pi/2) print ('The radius of curvature is %3.4f units '% rho1) 4.Find the radius of curvature for r = asin(nt) at t = pi/2 and n = 1.
from sympy import *
t ,r ,a ,= symbols ('t r a') r=a*sin( t ) r1= Derivative (r , t ).doit () r2= Derivative ( r1 , t ) . doit () rho =(r**2+r1**2 )**1.5/(r**2+2*r1**2-r*r2) ; rho1 = rho.subs (t ,pi/2 ) print ("The radius of curvature is") display ( simplify ( rho1 ) )
5.Find radius of curvature of x = acos(t), y = asin(t).
from sympy import *
from sympy . abc import rho , x ,y ,r ,K ,t ,a ,b ,c , alpha y=(sqrt(x)-4)**2 y=a*sin(t) x=a*cos(t) dydx=simplify(Derivative(y,t).doit())/simplify(Derivative(x,t).doit()) rho=simplify((1+dydx**2)**1.5/(Derivative(dydx,t).doit()/(Derivative(x,t).doit()))) print('Radius of curvature is') display(ratsimp(rho)) t1=pi/2 r1=5 rho1=rho.subs(t,t1); rho2=rho1.subs(a,r1); print('\n\n Radius of curvature at r=5 and t= pi/2 is',simplify(rho2)); curvature =1/rho2; print ('\n\n Curvature at (5,pi/2) is',float(curvature))
LAB 3: Finding partial derivatives and Jacobian of functions of several variables.
1.Prove that mixed partial derivatives , uxy = uyx for u = exp(x)(xcos(y) −ysin(y)).
from sympy import *
x,y=symbols('x y') u=exp(x)*(x*cos(y)-y*sin(y)) dux=diff(u,x) duy=diff(u,y) duxy=diff(dux,y) duyx=diff(duy,x) if duxy==duyx: print('Mixed partial derivatives are equal') else: print('Mixed partial derivatives are not equal') 2.Prove that if u = exp(x)(x cos(y) − y sin(y)) then uxx + uyy = 0.