CU SEC-B-2.1 Scientific Computing with SageMath, 2025

University of Calcutta question paper, B.Sc. Honours Semester IV, 2025. Scientific Computing with SageMath. Typed in LaTeX, searchable, with a printable PDF.

Open this paper in MathQP

  1. What will be the output of the following Sage code? texttt exp(10//4) - e textasciicircum (10%4).n(digits = 2)
  2. Which SageMath function computes the numerical approximation of pi ?
  3. What is the result of texttt sum([k textasciicircum 2 for k in range(1, 6)]) ?
  4. Find the correct SageMath code that computes the second derivative of f(x) = x 3 sin (x) .
  5. What will be the output of the following Sage code? texttt steps = 10 texttt steps = 20 texttt steps /= 5 texttt print("steps =", steps)
  6. What will be the output of texttt ln(32) - log(32) ?
  7. Which of the following Sage codes gives the output x 2 + 2x + 1 = 0 ?
  8. What will be the output of the following Sage code? texttt for i in range(3): texttt for j in range(3): texttt if i == j: texttt print(i, j)
  9. What is the correct SageMath code to compute int limits 0 infty x e -x 2 ,dx ?
  10. Which SageMath command plots the polar curve r = 1 + cos ( theta ) in [0, 2 pi ] ? (Let texttt theta = var('theta’) .)
  11. Write Sage commands to compute left ( sqrt 2 + log (e 3) right ) 5 and simplify the result.
  12. Give the output of the Sage commands : texttt 10 textasciicircum (1/2) , texttt sin(60) .
  13. Explain how the number of digits in 22 22 can be evaluated using Sage commands.
  14. Write Sage commands to find the number of factors of 4321765 .
  15. Rewrite the Sage expression texttt (((2-4)*(4-3)+4) textasciicircum 10)/(2 textasciicircum 20) in three lines of code.
  16. Use Sage code to find the value of tan -1 sqrt 3 in radians.
  17. Find the number of digits of 2 2 100 using Sage code.
  18. Find the output of the Sage code : qmarks 3+2+3+2 texttt s = 0 texttt for i in range(1, 10): texttt if i % 2 == 0: texttt s = s + i textasciicircum 2 texttt print(s)
  19. Write Sage code to plot the graph of f(x) = x + e x for x in [-2, 2] , its tangent at x = 0 , and a big dot of size 40 at that point.
  20. Write Sage code to plot the parametric curve x = 2t y = 4t 2 , t in [1, 2] .
  21. Write Sage code to plot f(x) = dfrac 1 x 2 - 1 on [-3, 3] and its asymptotes, if any.
  22. Let f(x) = ln (x) . Write SageMath code to : (i) plot f(x) over x in [0.5, 4] , (ii) plot the tangent line to f(x) at x = 2 on the same graph, (iii) use a different colour for the tangent line.
  23. Write Sage code to plot r = 1 + 2 cos 3 theta on [0, 2 pi ] .
  24. Write Sage code to plot the piecewise function f(x) = 1 + x, -1 le x le 0 1 + x 3, 0 < x < 1.
  25. Write Sage code to find the second- and third-order derivatives of f(t) = sin (3 t) and plot them on the same graph.
  26. int s log s ,ds
  27. int limits 0 infty dfrac x 4 + 1 x 5 + 1 ,dx
  28. int limits -1 1 x 3 cos x ,dx .
  29. Write Sage code to find the second- and third-order derivatives of g(x) = e x 3 and plot them on the same graph.
  30. Define m(x) = dfrac 1 1 + x 2 in SageMath and write code to find int limits 0 1 m(x) ,dx .
  31. Use Sage code to evaluate int dfrac dx (3 + 5 cos x) 2 .
  32. Use SageMath to find the definite integral of g(x) = sin (x) from x = 0 to x = pi .
  33. Display A and B .
  34. Find A - B t and AB , if possible.
  35. Find det B and B -1 .
  36. Express A as a sum of a symmetric and a skew-symmetric matrix.
  37. Find the eigenvalues of A .
  38. Write SageMath code to display the 3 times 3 matrix A = 1 2 3 0 4 5 0 0 6 .
  39. Compute the transpose of A .
  40. Compute the determinant of A .
  41. Find the inverse of A .
  42. Compute the product A cdot A T ( A T = transpose of A ).
  43. Write Sage code to solve the differential equation dfrac dy dx + y = e x .
  44. Write Sage commands to solve the IVP dfrac dy dx = 1 + x log (x + 1) , y(0) = 1 .
  45. Write Sage code to solve the linear system 2x + y + 3z = 1 , 4x + 2y + 6z = 2 , x - y = 3 .
  46. Write Sage code to solve dfrac dy dx = dfrac 2x 3 - 1 x 2 + 1 + 2y tan (x) .
  47. Write Sage commands to solve the BVP dfrac d 2 y dx 2 - 3 dfrac dy dx + y = x 3 , y(0) = 1 , y(1) = 0 .
  48. Write Sage code to solve the nonlinear equation x 3 - 3 coth (x) + 9 log (x 2 + 1) = 10 .
  49. Write a Sage program to find sum limits n=1 100 dfrac n n + 1 .
  50. Without using inbuilt functions, write a program in Sage to find the primes between 100 and 500 .
  51. Write a program in Sage to find the greatest of three given integers a, b, c .
  52. Without using inbuilt functions, write a program in Sage to find the GCD of two given integers.
  53. Without using inbuilt functions, write a program in Sage to determine the factorial of 10 .
  54. Without using inbuilt functions, write a program in Sage to find the arithmetic mean and geometric mean of the given data: 12, 18, 25, 38, 42 .