Final Graphs
Final Graphs
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import matplotlib . pyplot as plt
x = np . arange (-10 , 10 , 0 . 001 )
y1 = np .sin ( x )
y2=np .cos ( x )
plt . plot (x , y1 ,x , y2 ) # plotting sine and cosine function together with
same values of x
plt . title (" sine curve and cosine curve ")
plt . xlabel (" Values of x")
plt . ylabel (" Values of sin (x) and cos(x) ")
plt . grid ()
plt . show ()
print(" Deeksha.V AI&DS 2024BEAIDS014")
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import matplotlib . pyplot as plt
plt . axes ( projection = 'polar ')
r = 3
rads = np . arange (0 , ( 2 * np .pi) , 0 . 01 )
# plotting the circle
for i in rads :
plt . polar (i , r , 'g.')
plt . show ()
print("Deeksha.V AI&DS 2024BEAIDS014")
import numpy as np
import matplotlib . pyplot as plt
plt . axes ( projection = 'polar ')
r = 3
rads = np . arange (0 , ( 2 * np .pi) , 0 . 01 )
# plotting the circle
for i in rads :
plt . polar (i , r , 'g.')
plt . show ()
print("Deeksha.V AI&DS 2024BEAIDS014")
# Calculate derivatives
dr1 = diff(r1, t)
dr2 = diff(r2, t)
import numpy as np
A=np . matrix ([[1 ,2 ,-1],[2 ,1 , 4],[3 ,3 , 4]])
B=np . matrix ([[0],[0],[0]])
r=np . linalg . matrix_rank ( A )
n=A . shape [1]
if ( r==n ):
print (" System has trivial solution ") # Indented this line
else :
print (" System has", n-r , "non - trivial solution (s)") # Indented this line
print(" Deeksha. V AI&DS 2024BEAIDS024")
import sympy
from sympy import Symbol, solve, Derivative
# Define variables and function
x = Symbol('x')
y = Symbol('y')
f = x**2 + x*y + y**2 + 3*x - 3*y + 4
# Compute first derivatives
d1 = Derivative(f, x).doit()
d2 = Derivative(f, y).doit()
# Find critical points by solving the system of equation
critical_points = solve([d1, d2], (x, y))
# Compute second derivatives
s1 = Derivative(f, x, 2).doit()
s2 = Derivative(f, y, 2).doit()
s3 = Derivative(Derivative(f, y), x).doit()
print("Function value and critical point analysis:")
# Access the single critical point from the dictionary
x_val = critical_points[x]
y_val = critical_points[y]
# Substitute critical points into second derivatives
q1 = s1.subs({x: x_val, y: y_val}).evalf()
q2 = s2.subs({x: x_val, y: y_val}).evalf()
q3 = s3.subs({x: x_val, y: y_val}).evalf()
# Compute delta
delta = q1 * q2 - q3**2
print(f"\nCritical Point: ({x_val}, {y_val})")
print(f"Delta: {delta}, q1: {q1}")
# Determine the nature of the critical point
if delta > 0 and q1 < 0:
print("f takes a maximum at this point") # Indented by 4 spaces
elif delta > 0 and q1 > 0:
print("f takes a minimum at this point") # Indented by 4 spaces
elif delta < 0:
print("The point is a saddle point") # Indented by 4 spaces
else: