<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Python%2FC2%2FUsing-sage-to-teach%2FGujarati</id>
		<title>Python/C2/Using-sage-to-teach/Gujarati - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Python%2FC2%2FUsing-sage-to-teach%2FGujarati"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python/C2/Using-sage-to-teach/Gujarati&amp;action=history"/>
		<updated>2026-04-27T15:48:47Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Python/C2/Using-sage-to-teach/Gujarati&amp;diff=6779&amp;oldid=prev</id>
		<title>Krupali: Created page with '{| border=1 !Timing !Narration |- |0:02 | Hello friends and welcome to the tutorial on 'Using SAGE to teach'.  |- |  0:07 | At the end of this tutorial, you will be able to,  # U…'</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python/C2/Using-sage-to-teach/Gujarati&amp;diff=6779&amp;oldid=prev"/>
				<updated>2013-10-28T06:42:31Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;{| border=1 !Timing !Narration |- |0:02 | Hello friends and welcome to the tutorial on &amp;#039;Using SAGE to teach&amp;#039;.  |- |  0:07 | At the end of this tutorial, you will be able to,  # U…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:02&lt;br /&gt;
| Hello friends and welcome to the tutorial on 'Using SAGE to teach'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:07&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Use @interact  feature of SAGE for better demonstration.&lt;br /&gt;
# Share, publish and edit SAGE worksheets for collaborative learning.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:19&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with Sage&amp;quot; and &amp;quot;Getting started with Symbolics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:30&lt;br /&gt;
| Let us start by looking at a typical example of demonstrating a damped oscillation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:40&lt;br /&gt;
|So you can type t=var('t') ,then next line you can type p1=plot (e raised to minus (-t)into sin of (2 into t),(t,0,15))&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:06&lt;br /&gt;
|then third line you can type show(p1)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:17&lt;br /&gt;
| Now let us reduce the damping factor by half&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:23&lt;br /&gt;
|so for that you have to type t=var('t')&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:33&lt;br /&gt;
|then p1=plot(e raised to (-t by 2) * sin(2 into t),(t,0,15))&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:48&lt;br /&gt;
|then third line you can type show(p1)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:53&lt;br /&gt;
| Now, if we want to reduce the damping factor even more, we would be using e charat to (-t by 3).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:04&lt;br /&gt;
| We can observe that every time we have to change, all we do is change something very small and re-evaluate the cell.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:10&lt;br /&gt;
|This process can be simplified, using the  @interact  feature of SAGE.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:17&lt;br /&gt;
|So you can type  @interact  ,then def plot_damped(n-1):&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:32&lt;br /&gt;
|Then, t=var('t')&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:49&lt;br /&gt;
|p1=plot (e raised to(-t/n) * sin(2*t),(t,0,20))&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:01&lt;br /&gt;
|then type show(p1)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:11&lt;br /&gt;
| We can see that the function is evaluated and the plot is shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:15&lt;br /&gt;
| We can also see that there is a field to enter the value of n  and it is currently set to  1 .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:21&lt;br /&gt;
| Let us change it to 2 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:23&lt;br /&gt;
|So you type 2 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:29&lt;br /&gt;
| We see that the new plot with reduced damping factor is shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:33&lt;br /&gt;
| Similarly we can change  n to any desired value and hit enter and the function will be evaluated.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:41&lt;br /&gt;
|This is a very handy tool while demonstrating or teaching.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:45&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:50&lt;br /&gt;
| '''Plot the sine curve and vary its frequency using the @interact'' feature.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:57&lt;br /&gt;
| Now, switch to your worksheet for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:03&lt;br /&gt;
|You can type @interact&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:08&lt;br /&gt;
|then def sine_plot(n=1):&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:12&lt;br /&gt;
|then x=var('x')&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:18&lt;br /&gt;
|then p2=plot (sin(n*x),(x,0,2*pi))&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:27&lt;br /&gt;
|then finally you can type show(p2)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:43&lt;br /&gt;
|So often we would want to vary a parameter over range instead of taking it as an input from the user.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:51&lt;br /&gt;
| For instance we would not want the user to give  n as 0 for the damping oscillation we discussed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:56&lt;br /&gt;
| In such cases we use a range of values as the default argument.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:02&lt;br /&gt;
|at the rate interact&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:10&lt;br /&gt;
|should be typed in the worksheet so in the worksheet you can type&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:14&lt;br /&gt;
|@interact then def plot underscore damped(n=(1..10)):&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:28&lt;br /&gt;
|then next line you can type t=var('t')&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:36&lt;br /&gt;
|then p1=plot(e raised to (-t/n) * sin(2*t)),(t,0,20))&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:52&lt;br /&gt;
|then you can type show(p1)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:08&lt;br /&gt;
|Now we had seen an error&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:12&lt;br /&gt;
|So the error that we have rectified is after sin(2*t) we have accidentally placed an extra bracket.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:25&lt;br /&gt;
| So we get similar plot but the only difference is the input widget.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:30&lt;br /&gt;
| Here it is a slider unlike an input field.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:35&lt;br /&gt;
| We can see that the slider is moved, the function is evaluated and plotted accordingly.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:48&lt;br /&gt;
|Pause the video here,and try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:52&lt;br /&gt;
| '''Take a string as input from user and circular shift it to the left and''' vary the shift length using a slider.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:03&lt;br /&gt;
| For this problem, again we will use the  @interact  feature of sage. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:09&lt;br /&gt;
|We shall first assign a string say 'MADAM' to a variable and then shift the alphabets one by one.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:17&lt;br /&gt;
|So we can type @interact&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:21&lt;br /&gt;
|def str_shift(s=&amp;quot;MADAM&amp;quot;, shift=(0..8)) colon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:33&lt;br /&gt;
|then you can type shift_len=shift modulus len(s)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:40&lt;br /&gt;
|then chars=list(s)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:46&lt;br /&gt;
|then shifted_chars=chars[shift_len:]+chars[: shift_len]&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:03&lt;br /&gt;
|then print &amp;quot;Actual String:&amp;quot;,s&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:11&lt;br /&gt;
|then print &amp;quot;Shifted String:&amp;quot;, &amp;quot;&amp;quot;.join(shifted_chars)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:28&lt;br /&gt;
| As we move the slider, we see that shifting is taking place.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:40&lt;br /&gt;
| Sometimes we want the user to have only a given set of options.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:44&lt;br /&gt;
| We use a list of items as the default argument in such situations.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:50&lt;br /&gt;
|So we can type @interact&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:57&lt;br /&gt;
|then def str_shift(s=&amp;quot;STRING&amp;quot;,shift=(0..8), direction=[&amp;quot;Left&amp;quot;,&amp;quot;Right&amp;quot;]):&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:10&lt;br /&gt;
|then next line shift_len=shift modulus len(s)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:24&lt;br /&gt;
|then chars=list(s)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:26&lt;br /&gt;
|if direction==&amp;quot;Right&amp;quot; colon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:32&lt;br /&gt;
|then shifted_chars=chars[-shift_len colon]+chars[colon -shift_len]&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:01&lt;br /&gt;
|else colon shifted_chars=chars[shift_len colon]+chars[colon shift_len]&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:26&lt;br /&gt;
|then type print &amp;quot;Actual String:&amp;quot;,s&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:32&lt;br /&gt;
|then print &amp;quot;Shifted String:&amp;quot;, &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:52&lt;br /&gt;
|then dot join(shifted_chars)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:01&lt;br /&gt;
| We can see that buttons are displayed which enables us to select from a given set of options.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:11&lt;br /&gt;
| We see that, as we select left or right button, the shifting takes place appropriately.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:18&lt;br /&gt;
|Thus, we have learnt how to use the  @interact  feature of SAGE for better demonstration.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:24&lt;br /&gt;
| Now we shall look at how to use SAGE worksheets for collaborative learning.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:30&lt;br /&gt;
| The first feature we shall see is the  publish  feature.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:34&lt;br /&gt;
| Open a worksheet and in the top right, we can see a button called publish&lt;br /&gt;
|-&lt;br /&gt;
|11:40&lt;br /&gt;
|Click on that and we get a confirmation page with an option for re-publishing.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:52&lt;br /&gt;
| For now lets forget that option and simply publish by clicking  yes . &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:58&lt;br /&gt;
|The worksheet is now published.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:59&lt;br /&gt;
|Now lets sign out and go to the sage notebook home. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:04&lt;br /&gt;
|We see link to browse published worksheets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:08&lt;br /&gt;
| Lets click on it and we can see the worksheet.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:12&lt;br /&gt;
| This does not require login and anyone can view the worksheet.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:17&lt;br /&gt;
|Alternatively, if one wants to edit the sheet, there is a link on top left corner that enables the user to download a copy of the sheet onto their home. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:36&lt;br /&gt;
|This way they can edit a copy of the worksheet.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:41&lt;br /&gt;
|We have learnt how to publish the worksheets to enable users to edit a copy.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:45&lt;br /&gt;
|Next, we shall look at how to enable users to edit the actual worksheet itself.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:51&lt;br /&gt;
| Let us open the worksheet and we see a link called share  on the top right corner of the worksheet. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:03&lt;br /&gt;
|Click the link and we get a box where we can type the usernames of users whom we want to share the worksheet with.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:10&lt;br /&gt;
| We can even specify multiple users by separating their names using commas.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:15&lt;br /&gt;
| Once we have shared the worksheet, the worksheet appears on the home of shared users.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:22&lt;br /&gt;
| This brings us to the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:24&lt;br /&gt;
|In this tutorial, we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:25&lt;br /&gt;
| Use interactive features of SAGE using @interact .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:30&lt;br /&gt;
| then publishing our work.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:32&lt;br /&gt;
|then edit a copy of one of the published worksheets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:35&lt;br /&gt;
|then share the worksheets with fellow users.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  13:39&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:44&lt;br /&gt;
|1. Which default argument, when used with @interact gives a slider starting at 0 and ending in 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:52&lt;br /&gt;
| options are (0..11)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:54&lt;br /&gt;
| then range(0, 11)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:55&lt;br /&gt;
|Then [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]  separated by comma &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:01&lt;br /&gt;
| then in brackets (0..10)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:05&lt;br /&gt;
|2. What is the input widget resulted by using n = [2, 4, 5, 9]\ in the default arguments along with @interact.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:23&lt;br /&gt;
| options are input field,  set of buttons, slider, None&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:29&lt;br /&gt;
| Now we will look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:31&lt;br /&gt;
|1.The default argument, used with @interact  which gives a slider starting at 0 and ending in 10 is (0..10).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:42&lt;br /&gt;
|2. The input widget resulted by using  n = [2, 4, 5, 9]  in the default arguments along with  @interact  will be a set of buttons that is the second one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:57&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:01&lt;br /&gt;
|Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Krupali</name></author>	</entry>

	</feed>