diff -r af48ecb4dc11 -r 04fc3e7a0480 using-sage/questions.rst --- a/using-sage/questions.rst Mon Oct 11 22:52:06 2010 +0530 +++ b/using-sage/questions.rst Mon Oct 11 23:32:30 2010 +0530 @@ -1,17 +1,81 @@ Objective --------- -.. A mininum of 8 questions here. +1. How do you find the limit of the function ``x/sin(x)`` as ``x`` tends to + ``0`` from the negative side. + + Answer: lim(x/sin(x), x=0, dir="below") + +#. Find the third differential of the function ``exp(sin(x)*cos(x^2))`` + + Answer: diff(exp(sin(x)*cos(x^2), x, 3) + +#. Solve the system of linear equations:: + + x-2y+3z = 7 + 2x+3y-z = 5 + x+2y+4z = 9 + + Answer:: + + A = Matrix([[1, -2, 3], + [2, 3, -1], + [1, 2, 4]]) + + b = vector([7, 5, 9]) + + solve_right(A, b) + +#. How do you get the factorized form of ``x^4 - 4x^2 + x^3 + 2x + 7`` + + Answer:: -1. Question 1 -2. Question 2 -3. Question 3 + factor( x^4 + x^3 - 4*x^2 + 2*x + 7 ) + +#. list all the primes between 2009 and 2900 + + Answer: prime_range(2009, 2901) + +#. Which function is used to check primality + + a. isPrime + #. isprime + #. is_prime + #. prime + + Answer: is_prime + +#. How do you list all the combinations of ``[1, 2, 3, 4]`` + + + Answer:: + + c1 = Combinations([1, 2, 3, 4]) + c1.list() + +#. How do you list all the permutations of ``[1, 3, 2, 3]`` + + Answer:: + + p1 = Permutations([1, 3, 2, 3]) + p2.list() Programming ----------- -.. A minimum of 2 questions here. +1. What is the out put of the following code:: + + c1 = Combinations([1, 2, 3, 4]) + c2 = Combinations([1, 2, 4, 3]) + + l1 = c1.list() + l2 = c2.list() -1. Programming Assignment 1 -2. Programming Assignment 2 + for i in l2: + l1.remove(i) + + print l2 + + Answer: [] +