Ad
Saturday, December 31, 2022
Home
Unlabelled
SLIP 9
SLIP 9
In [1]:
#Q1-1
In [2]:
#a.
In [3]:
30%2+7-(3+9)*20/5
Out[3]:
-41.0
In [4]:
30*10//3+30%3
Out[4]:
100
In [5]:
5**5-5**3+7//7
Out[5]:
3001
In [6]:
#Q1-2
In [7]:
#a.
from math import*
sin(30*pi/180)
Out[7]:
0.49999999999999994
In [8]:
#b.
pi
Out[8]:
3.141592653589793
In [9]:
#c.
e
Out[9]:
2.718281828459045
In [10]:
#d.
cos(30*pi/180)
Out[10]:
0.8660254037844387
In [11]:
#Q1-3
In [12]:
abs(-10)
Out[12]:
10
In [13]:
abs(10)
Out[13]:
10
In [14]:
abs(-1)
Out[14]:
1
In [15]:
abs(1)
Out[15]:
1
In [16]:
abs(0)
Out[16]:
0
In [17]:
#Q2-1
In [18]:
string='MATHEMATICS'
print('Second:',string[1],'Fifth:',string[4],'Eighth:',string[7])
Second: A Fifth: E Eighth: T
In [19]:
#Q2-2
from sympy import*
In [20]:
A=Matrix([[3,-2],[6,-4]])
In [21]:
A.eigenvals()
Out[21]:
{-1: 1, 0: 1}
In [22]:
A.eigenvects()
Out[22]:
[(-1, 1, [Matrix([ [1/2], [ 1]])]), (0, 1, [Matrix([ [2/3], [ 1]])])]
In [23]:
#Q2-3
In [24]:
A=Matrix([[1,4,5],[5,4,3],[8,10,2]])
In [25]:
B=Matrix([[5,1,1],[4,2,7],[2,1,4]])
In [26]:
(A*B).inv()
Out[26]:
$\displaystyle \left[\begin{matrix}\frac{13}{186} & \frac{133}{186} & - \frac{77}{186}\\- \frac{131}{186} & - \frac{725}{186} & \frac{227}{93}\\\frac{11}{62} & \frac{41}{62} & - \frac{27}{62}\end{matrix}\right]$
In [27]:
B.inv()*A.inv()
Out[27]:
$\displaystyle \left[\begin{matrix}\frac{13}{186} & \frac{133}{186} & - \frac{77}{186}\\- \frac{131}{186} & - \frac{725}{186} & \frac{227}{93}\\\frac{11}{62} & \frac{41}{62} & - \frac{27}{62}\end{matrix}\right]$
In [28]:
#Q3-a.1
In [30]:
def f(x):
return x**2+5*x
a=float(input("Enter the lower limit:"))
b=float(input("Enter the upper limit:"))
n=int(input("Enter the number of intervals:"))
h=(b-a)/n
sum1=0.0
sum2=0.0
for i in range(1,n,2):
x=a+i*h
sum1=sum1+f(x)
for i in range(2,n-1,2):
x=a+i*h
sum2=sum2+f(x)
simp=h*(f(a)+4*sum1+2*sum2+f(b))/3
print("Integrated value is:",simp)
Enter the lower limit:1 Enter the upper limit:10 Enter the number of intervals:5 Integrated value is: 374.112
In [ ]:
#Q3-b.1
In [ ]:
About Abhishek Dhamdhere
Qna Library Is a Free Online Library of questions and answers where we want to provide all the solutions to problems that students are facing in their studies. Right now we are serving students from maharashtra state board by providing notes or exercise solutions for various academic subjects
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment