CU SEC-B-2 Scientific Computing with SageMath/R, 2021
University of Calcutta question paper, B.Sc. Honours Semester IV, 2021. Scientific Computing with SageMath/R. Typed in LaTeX, searchable, with a printable PDF.
Open this paper in MathQP
- What is the correct code in Sage to evaluate the value of pi correct up to 100 digits?
- What will be the result of the following Sage code: texttt exp(11*8+5) - e (11*8+5) ?
- What will be your code in Sage to find the natural logarithm of 100 in decimal approximation?
- What will be your code in Sage, if you want all the square roots of 4 ?
- The output of the Sage code : texttt 4*(10//4) + 10%4 == 10, 3*3<3 is
- Which of the following is NOT the correct option for a b c in sage?
- What will be the output of the following sage code? ttfamily a=4 b=2 print(a+b*2)
- What will be the output of the following sage code? ttfamily a =[1, 3] b=[10, 20, a] print(b)
- What is the correct code in Sage to plot the function x 3 - x in -2 < x < 2 ?
- What will be the code in Sage to compute displaystyle int 0 1 frac x x 2+1 ,dx ?
- What are open source softwares? “Sage is a free and open source mathematical software.” — Explain in brief.
- Write sage codes to find the difference between golden ratio and dfrac f 42 f 41 using 20 digits where f n is the n th term of the Fibonacci sequence.
- What will be the output of the following sage commands? Explain your answer : texttt y = 3; y = 3 * y + 1; y = 3 * y + 1; y
- What will be the output of the following sage commands?
- Give the output of the following sage commands texttt 10 (1/2), sin(60)
- graph of the function f(x) = x 2 + 1 in the range (-2, 2) .
- graph of the tangent line to the above curve : f'(x) = 2x in the range (-2, 2) with gridlines.
- one big dot at (1, 2) with size = 40 .
- Write sage code to plot the graph of the function given by the polar curve r = 1 + 2 cos 3 theta , quad 0 leq theta leq 2 pi .
- Write sage code to plot the graph of the following function : f(x) = 1+x, -1 leq x leq 0 1+x 3, 0 < x < 1 .
- Write sage code to plot the function f(x) = dfrac 1 x - x in [-1, 1] . Write also the equation of the asymptote (if it exists).
- find f''(x) .
- find f'''(x) .
- draw the graph of f(x) where -5 < x < 5 with colour blue.
- draw the graph of f''(x) where -5 < x < 5 with colour green.
- draw the graph of f'''(x) where -5 < x < 5 with colour red.
- Evaluate displaystyle int x n ,dx
- Evaluate displaystyle int frac cos x sqrt 1+ sin x ,dx
- Evaluate displaystyle int 0 1 3x 2 ,dx
- Evaluate displaystyle int 0 infty frac 2 sqrt pi e -x 2 ,dx
- Evaluate displaystyle int 0 infty frac sin x x ,dx to display 10 digits.
- Without using inbuilt functions write a program in sage to determine the total number of primes less than x , print the list of such primes and get an output for x = 98 .
- Without using inbuilt function write a program in sage to determine factorial of 10 .
- Without using inbuilt functions write a program in Sage to determine in decimal approximation the arithmetic mean and geometric mean of a list of numbers and get an output for the list 20, 15, 24, 31, 45, 17 .
- Write the Sage codes (without using inbuilt functions) to find and print the median of the numbers 11, 23, -34, 40, 50 .
- Define a matrix in sage whose rows are (1, -3, 4, 7) , (3, 4, 7, 9) , (3, 7, 0, 11) , (1, 3, -4, 8) . Give sage code to find the row reduced echelon form of the matrix.
- Write code in sage to find det A and A -1 where A = 1 2 3 4 5 6 7 8 10 .
- Assuming the non-trivial solution exists, write sage commands to solve the following system of equations with matrices : 3x - 4y + 5z = 14 x + y - 8z = -5 2x + y + z = 7.
- Write sage code to solve the differential equation dfrac dy dx = cos x .
- Write sage commands to solve the following Initial Value Problem and plot the solution : frac dy dx = 1 - y, quad y(10) = 2
- Write sage commands to solve the following differential equation with the boundary conditions : x 0 = 0, ; y(x 0) = 1, ; x 1 = frac pi 2 , ; y(x 1) = 4 frac d 2 y dx 2 + y = 0.
- Write a program in sage to find the GCD of two numbers a, b using Euclidean Algorithm.
- Write sage code for the following : Find the number of digits in 2021! and compute the number of zeros and the number of ones present in 2021! . [Here 2021! means factorial of 2021.]
- Write your code in sage to find the root of the polynomial f(x) = x 5 + x 4 + x 3 - x 2 + x - 1 between -1 and 1 .
- Write a program in sage to find the greatest of three given integers a, b, c .
- Write a program in sage to find the sum of the following series for any finite n : 2 cdot 3 + 4 cdot 5 + 6 cdot 7 + cdots + 2n(2n+1).
- Consider the following program : ttfamily i=0 while i < 5: print(i) i=i+1 if i==3: break else: print(0) What will be the output of the program segment?
- What should we type to get the value of tan (90 circ ) in R?
- The value of factorial of 3 91 in R is
- Which of the following R codes will print “Hello, world”?
- What will be the output of the following R code? ttfamily > f <- function (a, b) + a 2 + > f (2)
- What will be the output of the following R code snippet? ttfamily > paste (“a”, “b”, se = “:”)
- The output of the following R program will be : ttfamily > n <- 0 > square <- 0 > while (square <= 100) + n <- n + 1 + square <- n 2 + > print(n) > print(square)
- What will be the output of the following R code? ttfamily options (digits = 16) 20/6
- Which one of the following is the correct command to obtain the following matrix? A = 20 25 30 20 15 10
- How does a vector differ from a list?
- What is the output of the code given below? ttfamily A=10 B=20 print(A,B)
- texttt x=5;y=2; x=x 2+y 2; y=(x+1)/5; y
- texttt x=1:7; x=x+3; x
- texttt x=8; x=(x+1)**2; x=sqrt(x); x
- texttt A=matrix(c(1,2,3,4), nrow=2);B=matrix(c(4,3,2,1), nrow=2) texttt X=A*B+2; X
- texttt x=7:2 ; x=x 2+1; x
- texttt x=7:2; x=x 2+2; x=length(x);x
- texttt A=matrix(c(1,2,3,4), nrow=2);B=matrix(c(-4,3,-2,1), nrow=2) texttt X=A%*%B+2; X
- graph of the function f(x) = x 2 + 1 in range (-2, 2)
- graph of the tangent line f'(x) = 2x in range (-2, 2) at the point (1, 2) .
- the graph of polar curve r = 1 + 2 cos ( theta ), quad 0 leq theta leq 2 pi
- f(x) = |x| + 1 , in -2 leq x leq 2 with blue color
- g(x) = sin (x) + 2 cos (x) , in -2 leq x leq 2 with red color.
- find f'(x)
- find f''(x)
- plot f'(x) and f''(x) in [-2, 2] with blue and green colors respectively.
- displaystyle int - infty + infty e -x 2 ,dx
- displaystyle int - pi + pi sin (5x) ,dx
- displaystyle int - pi /4 + pi /4 tan (x) ,dx
- displaystyle int - pi /4 + pi /4 e x cdot tan (x) ,dx
- displaystyle int -1 +1 frac (1+x 3) (1+x 2) ,dx .
- Without using inbuilt functions, write R code to find the mean and median of the data set texttt c(3,4,7,1,7,4,8,9,10,11,2,12).
- Without using inbuilt functions, write R code to find GCD and LCM of the numbers 12 and 75.
- to find A 3
- to find the determinant and the inverse of A
- to find the inverse of A as well as to check whether the result is correct.
- Solve the following system of equations by a R program : 4x + y - z = 3 2x + 7y + z = 19 x - 3y + 12z = 31.
- Write a R program to find roots of the polynomial x 7 + 3x 4 + 8x + 9 .
- Write a R program to print first n non-Fibonacci positive integers.
- Write a R program to print all the prime numbers in the interval [131, 291] .
- Write a R program to find the sum of the series : 1 2 + 2 2 + 3 2 + cdots + N 2.
- Discuss how we can solve the differential equation : dfrac dx dt = 1 - x using R commands. Also write the code for plotting the solution in a specific range.