author | Puneeth Chaganti <punchagan@fossee.in> |
Wed, 01 Dec 2010 16:51:35 +0530 | |
changeset 522 | d33698326409 |
permissions | -rw-r--r-- |
522
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
1 |
Objective |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
2 |
--------- |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
3 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
4 |
1. How do you find the limit of the function ``x/sin(x)`` as ``x`` tends to |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
5 |
``0`` from the negative side. |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
6 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
7 |
Answer: lim(x/sin(x), x=0, dir="below") |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
8 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
9 |
#. Find the third differential of the function ``exp(sin(x)*cos(x^2))`` |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
10 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
11 |
Answer: diff(exp(sin(x)*cos(x^2), x, 3) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
12 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
13 |
#. Solve the system of linear equations:: |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
14 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
15 |
x-2y+3z = 7 |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
16 |
2x+3y-z = 5 |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
17 |
x+2y+4z = 9 |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
18 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
19 |
Answer:: |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
20 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
21 |
A = Matrix([[1, -2, 3], |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
22 |
[2, 3, -1], |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
23 |
[1, 2, 4]]) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
24 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
25 |
b = vector([7, 5, 9]) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
26 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
27 |
solve_right(A, b) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
28 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
29 |
#. How do you get the factorized form of ``x^4 - 4x^2 + x^3 + 2x + 7`` |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
30 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
31 |
Answer:: |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
32 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
33 |
factor( x^4 + x^3 - 4*x^2 + 2*x + 7 ) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
34 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
35 |
#. list all the primes between 2009 and 2900 |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
36 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
37 |
Answer: prime_range(2009, 2901) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
38 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
39 |
#. Which function is used to check primality |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
40 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
41 |
a. isPrime |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
42 |
#. isprime |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
43 |
#. is_prime |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
44 |
#. prime |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
45 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
46 |
Answer: is_prime |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
47 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
48 |
#. How do you list all the combinations of ``[1, 2, 3, 4]`` |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
49 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
50 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
51 |
Answer:: |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
52 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
53 |
c1 = Combinations([1, 2, 3, 4]) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
54 |
c1.list() |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
55 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
56 |
#. How do you list all the permutations of ``[1, 3, 2, 3]`` |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
57 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
58 |
Answer:: |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
59 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
60 |
p1 = Permutations([1, 3, 2, 3]) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
61 |
p2.list() |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
62 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
63 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
64 |
Programming |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
65 |
----------- |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
66 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
67 |
1. Obtain the sum of primes between 1 million and 2 million. |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
68 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
69 |
Answer:: |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
70 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
71 |
prime_sum = 0 |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
72 |
for i in range(1000001, 2000000, 2): |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
73 |
if is_prime(i): |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
74 |
prime_sum += i |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
75 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
76 |
prime_sum |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
77 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
78 |
OR |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
79 |
:: |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
80 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
81 |
sum(prime_range(1000000, 2000000)) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
82 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
83 |
2. ``graphs.WorldMap()`` gives the world map in the form of a |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
84 |
graph. :: |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
85 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
86 |
G = graphs.WorldMap() |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
87 |
G.vertices() |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
88 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
89 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
90 |
Suppose, I wish to go from India to France by Road, find out the |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
91 |
least number of Visas that I'll have to obtain. |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
92 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
93 |
Answer:: |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
94 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
95 |
G.distance("India", "France") |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
96 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
97 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
98 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
99 |