micro
micro
import numpy as np
im port matplotlib . pyplot as plt
import math
3) Find the angle between the curves r = 4(1 + cos t) and r = 5(1 − cos t).
1
5) Prove that mixed partial derivatives uxy=uyx for u=exp(x)(xcos(y)-ysin(y)).
u=exp ( x) *( x* cos( y)- y* sin ( y)) # input mu tiva ria bl e func tion u=u (x, y)
dux = diff (u, x) # Differen ta te u w. r. t x
duy = diff (u, y) # Dif ferenta te u w. r. t. y
dux y = diff ( dux , y) # or duxy =d if f ( u,x , y)
duy x = diff ( duy , x) # or duyx =d if f ( u,y, x)
# Check the condtion uxy =u yx
if du xy == duyx:
prin t(' Mixed partial deriv a t iv e s are equal ')
else :
prin t(' Mixed partial derivatives are not equal ')
u=x* y/ z
v=y* z/ x
w=z* x/ y
# find the all first order partial derivates
dux = diff (u , x)
duy = dif f (u, y)
duz = diff (u, z)
dvx= diff (v , x)
dvy= diff (v , y)
dvz= diff(v , z)
dwx = diff (w , x)
dwy = diff (w, y)
dwz = dif f (w , z)
2
7) Find the Maxima and minima of f (x, y) = x2 + y2 + 3x − 3y + 4.
import sympy
from sym py imp ort Symbol , solve , Derivative , pprint
x= Sym bol( 'x' )
y= Sym bo l( 'y')
f=x ** 2 +x* y+y ** 2 + 3 * x- 3 * y+ 4
8) Expand sin(x) as Taylor series about x = pi/2 upto 3rd degree term.
import numpy as np
from matplotlib im port pyplot as plt
from sym py im port *
x= Sym bo l( 'x ')
y=sin ( 1 * x)
format
x0 = float ( pi/ 2 )
dy= diff (y , x)
d2y = diff (y,x , 2 )
d3y = dif f(y,x, 3 )
yat= lambdify (x, y)
dyat= lam bdify (x, dy)
d2yat= lamb dif y (x, d2y)
d3yat= lamb dify (x , d3y)
y= ya t( x0 ) +(( x- x0 )/ 2 )* dy at( x0 ) +(( x- x0 ) ** 2 / 6 )* d2yat( x0 ) +(( x- x0 ) ** 3 / 24 )*
d3yat( x0 )
print ( simplify ( y))
yat = lamb dify (x, y)
print ( "%. 3f" % yat( pi/ 2+ 10 *( pi/ 180 )))
3
def f( x):
return np. sin ( 1 * x)
dy
9) Solve: + tanx − y3secx = 0.
display ( z1 )
Q1) Solution
Q2) Solution