Changes to using sage.
authorPuneeth Chaganti <punchagan@fossee.in>
Mon, 08 Nov 2010 11:39:07 +0530
changeset 408 8f4c369a41f1
parent 405 ae4bcaff1dde
child 409 43a24f7ab183
Changes to using sage.
using-sage/questions.rst
using-sage/script.rst
--- a/using-sage/questions.rst	Mon Nov 08 11:00:08 2010 +0530
+++ b/using-sage/questions.rst	Mon Nov 08 11:39:07 2010 +0530
@@ -64,21 +64,36 @@
 Programming
 -----------
 
-1. What is the out put of the following code::
+1. Obtain the sum of primes between 1 million and 2 million. 
+
+   Answer::
 
-     c1 = Combinations([1, 2, 3, 4])
-     c2 = Combinations([1, 2, 4, 3])
+     prime_sum = 0
+     for i in range(1000001, 2000000, 2):
+         if is_prime(i):
+         prime_sum += i
+        
+     prime_sum
 
-     l1 = c1.list()
-     l2 = c2.list()
+   OR
+   ::
+
+     sum(prime_range(1000000, 2000000))
 
-     for i in l2:
-         l1.remove(i)
+2. ``graphs.WorldMap()`` gives the world map in the form of a
+   graph. ::
 
-     print l2
+       G = graphs.WorldMap()
+       G.vertices()
 
-   Answer: []
+  
+   Suppose, I wish to go from India to France by Road, find out the
+   least number of Visas that I'll have to obtain. 
+
+   Answer::
 
-.. #[[Anoop: add one more question to this part, probably a small
-   problem asking them to solve it, project euler has problems on
-   combinations and all]]
+      G.distance("India", "France")
+
+      
+
+
--- a/using-sage/script.rst	Mon Nov 08 11:00:08 2010 +0530
+++ b/using-sage/script.rst	Mon Nov 08 11:39:07 2010 +0530
@@ -28,12 +28,8 @@
 
 {{{ show the slide with outline }}} 
 
-In this tutorial we shall quickly look at a few examples of the areas
-(name the areas, here) in which Sage can be used and how it can be
-used.
-
-.. #[[Anoop: add name of areas and further introduction if needed for
-   a smooth switch]]
+In this tutorial we shall quickly look at a few examples of using Sage
+for Linear Algebra, Calculus, Graph Theory and Number theory.
 
 {{{ show the slide with Calculus outline }}} 
 
@@ -62,9 +58,7 @@
 To find the limit from the negative side, we say,
 ::
 
-    lim(1/x, x=0, dir='above')   
-
-.. #[[Anoop: both the above codes are going the same thing isn't it?]]
+    lim(1/x, x=0, dir='below')   
 
 Let us now see how to differentiate, using Sage. We shall find the
 differential of the expression ``exp(sin(x^2))/x`` w.r.t ``x``. We