0% found this document useful (0 votes)
21 views2 pages

Micromax 1

Uploaded by

labowa2044
Copyright
© © All Rights Reserved
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
0% found this document useful (0 votes)
21 views2 pages

Micromax 1

Uploaded by

labowa2044
Copyright
© © All Rights Reserved
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/ 2

1) Plot the Cardioids r = a + acos(θ) and r = a − a cos(θ)

5) Prove that mixed partial derivatives uxy=uyx for u=exp(x)(xcos(y)-ysin(y)).


import numpy as np
import matplotlib . pyplot as plt
import math
from sympy import *
x, y = symbols( ' x y')
plt. axes( projection = ' polar ')
a= 3
u=exp ( x) *( x* cos( y)- y* sin ( y)) # input mutivar iable function u=u(x, y)
dux= diff (u, x) # Di ffer ent at e u w. r. t x
rad = np. arange (0 , ( 2 * np. pi), 0 . 01 )
duy = diff (u, y) # Di fferent at e u w. r. t. y
# plo tting the cardioid duxy = diff ( dux , y) # or du xy= di f f( u,x , y)
for i in rad : duyx = diff ( duy , x) # or du yx= di f f( u,y, x)
r = a + ( a* np. cos ( i))
# Check the con dtion uxy= uy x
plt. po lar( i,r, 'g. ')
if duxy== duyx:
r1 = a- ( a* np. cos( i))
prin t ( ' Mixed partial derivatives are equal ')
plt. polar( i, r1 ,'r. ') else :
# display the polar plot
prin t ( ' Mixed partial derivatives are not equal ')
plt. show ()

2) Plot the curve y2(a − x) = x2(a + x), a > 0


6) If u = xy/z, v = yz/x, w = zx/y then prove that J = 4.
p3 = plo t_ im pli ci t (
Eq (( y ** 2 )*( 2 - x), (x ** 2 )*( 2 +x) ), (x, -5 , 5 ), (y, -5 , 5 ), from sympy import *
title = ' Strophoid : $y^ 2 (a- x) =x^ 2 ( a+x), a> 0$ ') # a= 2
x,y, z= symbols ( ' x,y, z')
3) Find the angle between the curves r = 4(1 + cos t) and r = 5(1 − cos t).
u=x* y/ z
v=y* z/ x
from sympy import * w=z* x/ y
# find the all first order partial derivates
r, t = symb ols( 'r, t') # Define the varia bles required as symbols dux= diff(u, x)
duy = diff(u, y)
r1 = 4 *( 1 +co s ( t)); # Input first polar curve
duz= diff (u, z)
r2 =5 *( 1- cos( t)); # Input first polar curve
dr1 = diff ( r1 , t) # find the derivat ive of first function
dvx = diff(v, x)
dr2 = diff ( r2 ,t) # find the derivative of secodn function
dvy = diff(v, y)
t1 =r1 / dr1
dvz= diff(v, z)
t2 =r2 / dr2
q= solve ( r1 - r2 , t) # solve r1 ==r2 , to find the point of intersection
dwx= dif f(w, x)
between curves
dwy = diff(w, y)
w1 =t1 . subs( { t: float( q[ 1 ])}) # su bstitut e the value of " t" in t1
dwz = dif f(w, z)
w2 =t2 . subs( { t: float( q[ 1 ])}) # substitute the value of " t" in t2
y1 = atan ( w1 ) # to find the inverse tan of w1
# const ru ct the Jacobia n matrix
y2 = atan ( w2 ) # to find the inverse tan of w2
J= Matrix( [[ dux , duy , duz ],[ dvx , dvy , dvz],[ dwx , dwy , dwz]]);
w =abs ( y1 - y2 ) # angle between two curves is abs( w1 - w2 )
pr int (' Angle between curves in radians is % 0 . 3f '%( w))
print (" The Jacobian matrix is \ n" )
display ( J)
4) Find the radius of curvature, r = 4(1 + cos t) at t=π/2.
# Find the de term ina t of Jacobi an Matrix
Jac =det ( J). doit ()
from sympy import *
pri n t ('\ n\ n J = ', Jac)
t= Symb ol('t') # define t as symbol
r= Sym bol( 'r')
r= 4 *( 1 +co s ( t))
r1 = Der iva tive (r, t). doit () # find the first deri va tive of r w. r. t " t"
r2 = Derivative ( r1 ,t). doit () # find the second derivative of r w. r. t "t"
rho =( r ** 2 +r1 ** 2 ) ** ( 1 . 5 )/( r ** 2 + 2 * r1 ** 2 - r* r2 ); # Substitute r1 and r2 in
formula
rho1 = rho . subs(t, pi/ 2) # substitute t in rho
print (' The radius of curvature is % 3 . 4f units '% rho1 )

1 2
def f( x):
7) Find the Maxima and minima of f (x, y) = x2 + y2 + 3x − 3y + 4. return np. sin ( 1 * x)

import sympy x = np. linspac e (- 10 , 10 )


from sympy import Symbol , solve , Derivative , pprint
x= Sym bol ( 'x' ) plt. plot (x, yat( x), co lor =' red ')
y= Symb ol( 'y') plt. plot(x, f( x), co lor =' green ')
f=x ** 2 +x* y+y ** 2 + 3 * x- 3 *y+ 4 plt. ylim ([- 3 , 3 ])
plt. grid ()
d1 = Derivative (f, x). doit () plt. show ()
d2 = Deriv at ive (f, y). doit ()
critical poi nt s1 = solve ( d1 )
critical poi nt s2 = solve ( d2 ) 9) Solve: dy
+ tanx − y3secx = 0.
s1 = Derivat ive (f,x, 2 ). doit ()
s2 = Derivative (f,y, 2 ). doit () from sympy import *
s3 = Derivat ive ( Derivative (f, y),x). doit ()
pr int (' function value is ') x, y= symb o ls( 'x, y')
y= Functi on (" y")( x)
q1 =s1 . subs( { y: criticalpoints1 , x: criticalpoints2 }). evalf ()
q2 =s2 . subs( { y: criticalpoints1 , x: criticalpoints2 }). evalf () y1 = Derivati ve (y, x)
q3 =s3 . subs( { y: criticalpoints1 , x: criticalpoints2 }). evalf () z1 = dsolve ( Eq( y1 +y* tan ( x)- y ** 3 * sec( x)),y)
delta =s1 * s2 - s3 ** 2
print ( delta , q1 ) display ( z1 )

if( delta >0 and s1 <0 ):


Q1) Solution
print (" f takes maximum ")
elif ( delta > 0 and s1 >0 ):
print(" f takes minim um ")
if ( delta < 0 ):
prin t (" The point is a saddle point")
if ( delta == 0 ):
print (" further tests required ")

8) Expand sin(x) as Taylor series about x = pi/2 upto 3rd degree term.

import numpy as np
from matplotlib import pyplot as plt
from sympy import *
x= Symb ol( 'x')

y=sin ( 1 * x)
format Q2) Solution
x0 = float ( pi / 2 )
dy= diff (y, x)
d2y = diff (y ,x, 2 )
d3y = di ff (y ,x , 3 )
yat= lambdify (x, y)
dyat = lambdify (x, dy)
d2yat= lambdify (x, d2y)
d3yat= lambdify (x, d3y)
y=yat( x0 ) +(( x- x0 )/ 2 )* dyat( x0 ) +(( x- x0 ) ** 2 / 6 )* d2yat( x0 ) +(( x- x0 ) ** 3 / 24 )*
d3yat( x0 )
print( simplify ( y))
yat= lambdify (x, y)
print ( "%. 3f" % yat( pi/ 2 + 10 *( pi/ 180 )))

3 4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy