You are on page 1of 11

Exam Seat No:

Satish Pradhan Dnyanasadhana College


Thane

Certificate
This is to certify that Mr.:Mayuresh Kasar of FYBSc Computer Science
(Semester-II) Class has successfully completed all the practical work in subject
Calculus, under the guidance of Prof. Meenakshi Kulawade (subject in charge)
during Year 2021-22 in partial fulfillment of Computer Science Practical
Examination conducted by University of Mumbai.

Subject in charge Head of the Department

Date
Satish Pradhan Dnyanasadhana College, Thane [ A. Y. 2021 – 2022]
Name: Mayuresh Kasar Roll No.: 35
Program: FY B.Sc. CS (sem II) Subject: Calculus (PR)

Sr.
Index Date Sign
No.
Continuty of functions, Derivative of
1
functions
Relative maxima, relative minima,
2
absolute maxima, absolute minima
Newton’s method to find approximate
3
solution of an equation
Numerical integration using Simpson’s
4
rule
Solution of a first order first degree
5
differential equation, Euler’s method
Calculation of Partial derivative of
6
functions
Maxima and minima of function of two
7
variables
Satish Pradhan Dnyanasadhana College, Thane [ A. Y. 2021 – 2022]
Name: Mayuresh Kasar Roll No.: 35
Program: FY B.Sc. CS (sem II) Subject: Calculus (PR)

1.Continuty of functions, Derivative of functions


1.1) Continuity of functions
Code:
sage: p1 = plot(x^2, x, 0, 1)
sage: p2 = plot(-x+2, x, 1, 2)
sage: p3 = plot(x^2-3*x+2, x, 2, 3)
sage: pt1 = point((0, 0), rgbcolor='black', pointsize=30)
sage: pt2 = point((0, 0), rgbcolor='black', pointsize=30)
sage: (p1+p2+p3+pt1+pt2).show(xmin=0, xmax=3, ymin=0, ymax=2)
Output:
Satish Pradhan Dnyanasadhana College, Thane [ A. Y. 2021 – 2022]
Name: Mayuresh Kasar Roll No.: 35
Program: FY B.Sc. CS (sem II) Subject: Calculus (PR)

1.2) Derivative of functions


Code:
sage: var('t')
sage: plot(3^t^2/2+20^t, t, 0, 6)+plot(3^t+20, t, 0, 6,
rgbcolor='red')+line([(0, 3), (6, 3)], rgbcolor='green')
Output:
Satish Pradhan Dnyanasadhana College, Thane [ A. Y. 2021 – 2022]
Name: Mayuresh Kasar Roll No.: 35
Program: FY B.Sc. CS (sem II) Subject: Calculus (PR)

2.Relative maxima, relative minima, absolute maxima, absolute


minima
2.1) Relative maxima and minima
A. Relative maxima
Code:
sage: max(x, x^2)
sage: max(3, 5, x)
sage: max_symbolic(3, 5, x)
sage: f(x) = max_symbolic(x, x^2); f(1/2)
sage: max_symbolic(3, 5, x).subs(x=5)
Output:
x #First output
5 #Second output
max(x, 5) #Third output
½ #Fourth output
5 #Fifth output
B. Relative manima
Code:
sage: min(x, x^2)
sage: min(3, 5, x)
sage: min_symbolic(3, 5, x)
sage: f(x) = min_symbolic(x, x^2); f(1/2)
sage: mai_symbolic(3, 5, x).subs(x=5)
Output:
x #First output
3 #Second output
max(x, 3) #Third output
¼ #Fourth output
3 #Fifth output
Satish Pradhan Dnyanasadhana College, Thane [ A. Y. 2021 – 2022]
Name: Mayuresh Kasar Roll No.: 35
Program: FY B.Sc. CS (sem II) Subject: Calculus (PR)

2.2) Absolut maxima and minima


Code:
sage: var('x y')
sage: abs(x)
sage: abs(x^2 + y^2)
sage: abs(-2)
sage: sqrt(x^2)
sage: abs(sqrt(x))
sage: complex(abs(3*i))
Output:
(x, y) #First output
abs(x) #Second output
abs(x^2 + y^2) #Third output
2 #Fourth output
sqrt(x^2) #Fifth output
sqrt(abs(x)) #Sixth output
(3+0j) #Sevent output
Satish Pradhan Dnyanasadhana College, Thane [ A. Y. 2021 – 2022]
Name: Mayuresh Kasar Roll No.: 35
Program: FY B.Sc. CS (sem II) Subject: Calculus (PR)

3.Newton’s method to find approximate solution of an equation


Code:
sage: var('x,f')
sage: f(x) = log(6-x^2)-x
sage: g = plot(f(x), x, 0, 4, ymin=-5, ymax=5, figsize=3)
sage: var('x,newton')
sage: newton(x) = x-f(x)/(diff(f(x)))
sage: xzero = float(15/10)
sage: for i in range(8):
….: xzero = newton(xzero)
….: xzero = newton(xzero) #now hit enter twice
Output:
0.6521947999778994
-0.5520293896560877
0.7910585342713328
-0.2904512064567639
1.9743726508760446
1.305195822995791
0.4127720072643871
-1.2611561595965748
Satish Pradhan Dnyanasadhana College, Thane [ A. Y. 2021 – 2022]
Name: Mayuresh Kasar Roll No.: 35
Program: FY B.Sc. CS (sem II) Subject: Calculus (PR)

4.Numerical integration using Simpson’s rule


A. Left-hand Riemann sum approx.
Code:
sage: def lefthand_rs(fcn,a,b,n):
….: deltax = (b-1)*1.0/n
….: return deltax*sum([fcn(a+deltax*i) for i in range(n)])
sage: n = 6
sage: a = 0
sage: b = 1
sage: f(x) = sin(x)
sage: print(lefthand_rs(f,a,b,n).n());
Output:

0.388510504059924
B. Right-hand Riemann sum approx.
Code:
sage: def righthand_rs(fcn,a,b,n):
….: deltax = (b-1)*1.0/n
….: return deltax*sum([fcn(a+deltax*(i+1)) for i in
range(n)])
sage: n = 20
sage: a = 0
sage: b = 1
sage: f(x) = sin(x)
sage: print(righthand_rs(f,a,b,n).n());
Output:

0.388510504059924
Satish Pradhan Dnyanasadhana College, Thane [ A. Y. 2021 – 2022]
Name: Mayuresh Kasar Roll No.: 35
Program: FY B.Sc. CS (sem II) Subject: Calculus (PR)

5.Solution of a first order first degree differential equation, Euler’s


method
A.
Code:
sage: t = var('t')
sage: x = function('x')(t)
sage: DE = diff(x, t) + x – 1
sage: desolve(DE, [x,t])
Output:

(_C + e^t)*e^(-t)
B.
Code:
sage:
point([(0,1),(2/5,1),(4/5,29/25),(6/5,957/625),(8/5,35409/15635),(2,145
1769/390625)])
Output:
Satish Pradhan Dnyanasadhana College, Thane [ A. Y. 2021 – 2022]
Name: Mayuresh Kasar Roll No.: 35
Program: FY B.Sc. CS (sem II) Subject: Calculus (PR)

6.Calculation of Partial derivative of functions


Code:
sage: var('w, tau_t0, tau_t1, s_t0, s_t1, r, n')
sage: u0 = function('u0')
sage: u1 = function('u1')
sage: u2 = function('u2')
sage: a = diff(u0(w*(1-tau_t0) - s_t0), s_t0)
sage: b = diff(u1(w*(1-tau_t1) - s_t1), s_t1)
sage: c =
diff(u2((1+n)^2*w*tau_t0+(1+n)*w*tau_t0+(1+r)^2*s_t0+(1+r)*s_t1),
s_t0)
sage: U = diff(u0+u1+u2, s_t0)
sage: print(U)
Output:
(r + 1)^4*D[0, 0](u2)((n + 1)^2*tau_t0*w + (r + 1)^2*s_t0 + (n +
1)*tau_t0*w + (r + 1)*s_t1) + D[0, 0](u0)(-(tau_t0 - 1)*w - s_t0)
Satish Pradhan Dnyanasadhana College, Thane [ A. Y. 2021 – 2022]
Name: Mayuresh Kasar Roll No.: 35
Program: FY B.Sc. CS (sem II) Subject: Calculus (PR)

7. Maxima and minima of function of two variables


Code:
sage: max(3, 5, x)
sage: min(3, 5, x)
sage: max_symbolic(3, 5, x)
sage: min_symbolic(3, 5, x)
Output:
5 #First output
3 #Second output
max(x, 5) #Third output
min(x, 3) #Fourth output

You might also like