diff options
-rw-r--r-- | getting-started-with-lists/script.rst.orig | 521 | ||||
-rw-r--r-- | getting-started-with-symbolics/script.rst | 101 | ||||
-rw-r--r-- | getting-started-with-symbolics/slides.org | 166 | ||||
-rw-r--r-- | getting-started-with-symbolics/slides.tex | 258 | ||||
-rw-r--r-- | symbolics/slides.org | 33 |
5 files changed, 665 insertions, 414 deletions
diff --git a/getting-started-with-lists/script.rst.orig b/getting-started-with-lists/script.rst.orig index 754693e..3f068eb 100644 --- a/getting-started-with-lists/script.rst.orig +++ b/getting-started-with-lists/script.rst.orig @@ -1,361 +1,224 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" /> -<title></title> -<style type="text/css"> - -/* -:Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 5951 2009-05-18 18:03:10Z milde $ -:Copyright: This stylesheet has been placed in the public domain. - -Default cascading style sheet for the HTML output of Docutils. - -See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to -customize this style sheet. -*/ - -/* used to remove borders from tables and images */ -.borderless, table.borderless td, table.borderless th { - border: 0 } - -table.borderless td, table.borderless th { - /* Override padding for "table.docutils td" with "! important". - The right padding separates the table cells. */ - padding: 0 0.5em 0 0 ! important } - -.first { - /* Override more specific margin styles with "! important". */ - margin-top: 0 ! important } - -.last, .with-subtitle { - margin-bottom: 0 ! important } - -.hidden { - display: none } - -a.toc-backref { - text-decoration: none ; - color: black } - -blockquote.epigraph { - margin: 2em 5em ; } - -dl.docutils dd { - margin-bottom: 0.5em } - -/* Uncomment (and remove this text!) to get bold-faced definition list terms -dl.docutils dt { - font-weight: bold } -*/ - -div.abstract { - margin: 2em 5em } - -div.abstract p.topic-title { - font-weight: bold ; - text-align: center } - -div.admonition, div.attention, div.caution, div.danger, div.error, -div.hint, div.important, div.note, div.tip, div.warning { - margin: 2em ; - border: medium outset ; - padding: 1em } - -div.admonition p.admonition-title, div.hint p.admonition-title, -div.important p.admonition-title, div.note p.admonition-title, -div.tip p.admonition-title { - font-weight: bold ; - font-family: sans-serif } - -div.attention p.admonition-title, div.caution p.admonition-title, -div.danger p.admonition-title, div.error p.admonition-title, -div.warning p.admonition-title { - color: red ; - font-weight: bold ; - font-family: sans-serif } - -/* Uncomment (and remove this text!) to get reduced vertical space in - compound paragraphs. -div.compound .compound-first, div.compound .compound-middle { - margin-bottom: 0.5em } - -div.compound .compound-last, div.compound .compound-middle { - margin-top: 0.5em } -*/ - -div.dedication { - margin: 2em 5em ; - text-align: center ; - font-style: italic } - -div.dedication p.topic-title { - font-weight: bold ; - font-style: normal } - -div.figure { - margin-left: 2em ; - margin-right: 2em } - -div.footer, div.header { - clear: both; - font-size: smaller } +.. Objectives +.. ---------- -div.line-block { - display: block ; - margin-top: 1em ; - margin-bottom: 1em } +.. By the end of this tutorial, you will be able to -div.line-block div.line-block { - margin-top: 0 ; - margin-bottom: 0 ; - margin-left: 1.5em } +.. Create Lists. +.. Access List elements. +.. Append elemets to list +.. Delete list elemets -div.sidebar { - margin: 0 0 0.5em 1em ; - border: medium outset ; - padding: 1em ; - background-color: #ffffee ; - width: 40% ; - float: right ; - clear: right } +.. 1. getting started with ipython -div.sidebar p.rubric { - font-family: sans-serif ; - font-size: medium } -div.system-messages { - margin: 5em } -div.system-messages h1 { - color: red } +.. Prerequisites +.. ------------- -div.system-message { - border: medium outset ; - padding: 1em } +.. 1. getting started with strings +.. #. getting started with lists +.. #. basic datatypes + +.. Author : Amit + Internal Reviewer : Anoop Jacob Thomas <anoop@fossee.in> + External Reviewer : + Checklist OK? : <put date stamp here, if OK> [2010-10-05] -div.system-message p.system-message-title { - color: red ; - font-weight: bold } +.. #[[Anoop: Slides contain only outline and summary -div.topic { - margin: 2em } +Script +------ + {{{ Show the slide containing title }}} -h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, -h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { - margin-top: 0.4em } - -h1.title { - text-align: center } +Hello friends and welcome to the tutorial on getting started with +lists. -h2.subtitle { - text-align: center } + {{{ Show the slide containing the outline slide }}} -hr.docutils { - width: 75% } +In this tutorial we will be getting acquainted with a python data +structure called lists. We will learn :: + + * How to create lists + * Structure of lists + * Access list elements + * Append elements to lists + * Delete elements from lists -img.align-left, .figure.align-left{ - clear: left ; - float: left ; - margin-right: 1em } +List is a compound data type, it can contain data of other data +types. List is also a sequence data type, all the elements are in +order and the order has a meaning. -img.align-right, .figure.align-right { - clear: right ; - float: right ; - margin-left: 1em } +.. #[[Anoop: "all the elements are in order and **there** order has a + meaning." - I guess something is wrong here, I am not able to + follow this.]] -.align-left { - text-align: left } +We will first create an empty list with no elements. On your IPython +shell type :: -.align-center { - clear: both ; - text-align: center } + empty = [] + type(empty) + -.align-right { - text-align: right } +This is an empty list without any elements. -/* reset inner alignment in figures */ -div.align-right { - text-align: left } +.. #[[Anoop: the document has to be continous, without any + subheadings, removing * Filled lists]] -/* div.align-center * { */ -/* text-align: left } */ +Lets now see how to define a non-empty list. We do it as,:: -ol.simple, ul.simple { - margin-bottom: 1em } + nonempty = ['spam', 'eggs', 100, 1.234] -ol.arabic { - list-style: decimal } +Thus the simplest way of creating a list is typing out a sequence +of comma-separated values (items) between square brackets. +All the list items need not be of the same data type. -ol.loweralpha { - list-style: lower-alpha } +As we can see lists can contain different kinds of data. In the +previous example 'spam' and 'eggs' are strings and 100 and 1.234 are +integer and float. Thus we can put elements of heterogenous types in +lists including list itself. -ol.upperalpha { - list-style: upper-alpha } +.. #[[Anoop: the sentence "Thus list themselves can be one of the + element types possible in lists" is not clear, rephrase it.]] -ol.lowerroman { - list-style: lower-roman } +Example :: -ol.upperroman { - list-style: upper-roman } + listinlist=[[4,2,3,4],'and', 1, 2, 3, 4] -p.attribution { - text-align: right ; - margin-left: 50% } +We access list elements using the index. The index begins from 0. So +for list nonempty, nonempty[0] gives the first element, nonempty[1] +the second element and so on and nonempty[3] the last element. :: -p.caption { - font-style: italic } + nonempty[0] + nonempty[1] + nonempty[3] -p.credits { - font-style: italic ; - font-size: smaller } +Following is an exercise that you must do. -p.label { - white-space: nowrap } +%% %% What happens when you do nonempty[-1]. -p.rubric { - font-weight: bold ; - font-size: larger ; - color: maroon ; - text-align: center } +Please, pause the video here. Do the exercise and then continue. -p.sidebar-title { - font-family: sans-serif ; - font-weight: bold ; - font-size: larger } +.. #[[Anoop: was negative indices introduced earlier, if not may be we + can ask them to try out nonempty[-1] and see what happens and then + tell that it gives the last element in the list.]] -p.sidebar-subtitle { - font-family: sans-serif ; - font-weight: bold } - -p.topic-title { - font-weight: bold } - -pre.address { - margin-bottom: 0 ; - margin-top: 0 ; - font: inherit } - -pre.literal-block, pre.doctest-block { - margin-left: 2em ; - margin-right: 2em } - -span.classifier { - font-family: sans-serif ; - font-style: oblique } - -span.classifier-delimiter { - font-family: sans-serif ; - font-weight: bold } - -span.interpreted { - font-family: sans-serif } - -span.option { - white-space: nowrap } - -span.pre { - white-space: pre } - -span.problematic { - color: red } - -span.section-subtitle { - /* font-size relative to parent (h1..h6 element) */ - font-size: 80% } - -table.citation { - border-left: solid 1px gray; - margin-left: 1px } - -table.docinfo { - margin: 2em 4em } - -table.docutils { - margin-top: 0.5em ; - margin-bottom: 0.5em } - -table.footnote { - border-left: solid 1px black; - margin-left: 1px } - -table.docutils td, table.docutils th, -table.docinfo td, table.docinfo th { - padding-left: 0.5em ; - padding-right: 0.5em ; - vertical-align: top } - -table.docutils th.field-name, table.docinfo th.docinfo-name { - font-weight: bold ; - text-align: left ; - white-space: nowrap ; - padding-left: 0 } - -h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, -h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { - font-size: 100% } - -ul.auto-toc { - list-style-type: none } - -</style> -</head> -<body> -<div class="document"> - - -<div class="section" id="objective-questions"> -<h1>Objective Questions</h1> -<!-- A mininum of 8 questions here (along with answers) --> -<ol class="arabic"> -<li><p class="first">How do you create an empty list?</p> -<pre class="literal-block"> -empty=[] -</pre> -</li> -<li><p class="first">What is the most important property of sequence data types like lists?</p> -<p>The elements are in order and can be accessed by index numbers.</p> -</li> -<li><p class="first">Can you have a list inside a list ?</p> -<p>Yes,List can contain all the other data types, including list.</p> -<p>Example: -list_in_list=[2.3,[2,4,6],'string,'all datatypes can be there']</p> -</li> -<li><p class="first">What is the index number of the first element in a list?</p> -<p>0 -nonempty = ['spam', 'eggs', 100, 1.234] -nonempty[0]</p> -</li> -<li><p class="first">How would you access the end of a list without finding its length?</p> -<p>Using negative indices. We can the list from the end using negative indices.</p> -<p>:: -nonempty = ['spam', 'eggs', 100, 1.234] -nonempty[-1]</p> -</li> -<li><p class="first">What is the function to find the length of a list?</p> -<p>len</p> -</li> -<li><p class="first">Delete the last element from list sq=[5,4,3,2,1,0]</p> -<p>del(sq[-1])</p> -</li> -<li><p class="first">How many will you have to use remove function to remove all 6's from the given list sq=[2,5,6,7,6,4,6]?</p> -<p>3</p> -</li> -</ol> -</div> -<div class="section" id="larger-questions"> -<h1>Larger Questions</h1> -<!-- A minimum of 2 questions here (along with answers) --> -<p>1. Add all elemets of seq1=['e','f','g','h'] -to the sequence seq=['a','b','c','d']</p> -<ol class="arabic simple" start="2"> -<li>Delete all elements of seq1=[3,5,6] from sequence -seq=[1,2,3,4,5,6,7,8,9]</li> -</ol> -</div> -</div> -</body> -</html> +As you can see you get the last element which is 1.234. + + +In python negative indices are used to access elements from the end:: + + nonempty[-1] + nonempty[-2] + nonempty[-4] + +-1 gives the last element which is the 4th element , -2 second to last +and -4 gives the fourth from last element which is first element. + +We can append elements to the end of a list using append command. :: + + nonempty.append('onemore') + nonempty + nonempty.append(6) + nonempty + +Following are exercises that you must do. + +%% %% What is the syntax to get the element 'and' +in the list,listinlist ? + + +%% %% How would you get 'and' using negative indices? + +Please, pause the video here. Do the exercise and then continue. + +The solution is on your screen + + +As we can see non empty appends 'onemore' and 6 at the end. + +Using len function we can check the number of elements in the list +nonempty. In this case it 6 :: + + len(nonempty) + + + +Just like we can append elements to a list we can also remove them. +There are two ways of doing it. One is by using index. :: + + del(nonempty[1]) + + + +deletes the element at index 1, 'eggs' which is the second element of +the list. The other way is removing element by content. Lets say one +wishes to delete 100 from nonempty list the syntax of the command +should be + +.. #[[Anoop: let x = [1,2,1,3] + now x.remove(x[2]) + still x is [2,1,3] so that is not the way to remove + element by index, it removed first occurrence of 1(by + content) and not based on index, so make necessary + changes]] + +:: + + nonempty.remove(100) + +but what if there were two 100's. To check that lets do a small +experiment. :: + + nonempty.append('spam') + nonempty + nonempty.remove('spam') + nonempty + +If we check now we will see that the first occurence 'spam' is removed +thus remove removes the first occurence of the element in the sequence +and leaves others untouched. + + + + + +.. #[[Anoop: does it have two spams or two pythons?]] + +.. #[[Anoop: there are no exercises/solved problems in this script, + add them]] + +Following are exercises that you must do. + +%% %% Remove the third element from the list, listinlist. + +%% %% Remove 'and' from the list, listinlist. + +Please, pause the video here. Do the exercise and then continue. + + + +{{{Slide for Summary }}} + + +In this tutorial we came across a sequence data type called lists. :: + + * We learned how to create lists. + * How to access lists. + * Append elements to list. + * Delete Element from list. + * And Checking list length. + + + +{{{ show Sponsored by Fossee Slide }}} + +This tutorial was created as a part of FOSSEE project. + +I hope you found this tutorial useful. + +Thank You + +.. + * Author : Amit Sethi + * First Reviewer : + * Second Reviewer : Nishanth diff --git a/getting-started-with-symbolics/script.rst b/getting-started-with-symbolics/script.rst index b41ab87..e03d85c 100644 --- a/getting-started-with-symbolics/script.rst +++ b/getting-started-with-symbolics/script.rst @@ -4,7 +4,7 @@ .. By the end of this tutorial, you will be able to .. 1. Defining symbolic expressions in sage. -.. # Using built-in costants and functions. +.. # Using built-in constants and functions. .. # Performing Integration, differentiation using sage. .. # Defining matrices. .. # Defining Symbolic functions. @@ -37,7 +37,7 @@ During the course of the tutorial we will learn {{{ Show outline slide }}} * Defining symbolic expressions in sage. -* Using built-in costants and functions. +* Using built-in constants and functions. * Performing Integration, differentiation using sage. * Defining matrices. * Defining Symbolic functions. @@ -73,26 +73,32 @@ So let us try :: var('x,alpha,y,beta') x^2/alpha^2+y^2/beta^2 -taking another example +taking another example :: var('theta') - sin^2(theta)+cos^2(theta) + sin(theta)*sin(theta)+cos(theta)*cos(theta) +Similarly, we can define many algebraic and trigonometric expressions using sage . -Similarly, we can define many algebraic and trigonometric expressions -using sage . +Following is an exercise that you must do. -Sage also provides a few built-in constants which are commonly used in -mathematics . +%% %% Define following expressions as symbolic expressions +in sage? + + 1. x^2+y^2 + #. y^2-4ax + +Please, pause the video here. Do the exercise and then continue. + +The solution is on your screen. + + +Sage also provides a few built-in constants which are commonly used in mathematics . -example : pi,e,infinity , Function n gives the numerical values of all these - constants. +example : pi,e,infinity , Function n gives the numerical values of all these constants. -{{{ Type n(pi) - n(e) - n(oo) - On the sage notebook }}} +{{{ Type n(pi) n(e) n(oo) On the sage notebook }}} @@ -131,6 +137,24 @@ lets try some of them out on the sage notebook. log(e,e) +Following is are exercises that you must do. + +%% %% Find the values of the following constants upto 6 digits precision + + 1. pi^2 + #. euler_gamma^2 + + +%% %% Find the value of the following. + + 1. sin(pi/4) + #. ln(23) + +Please, pause the video here. Do the exercises and then continue. + +The solutions are on your screen. + + Given that we have defined variables like x,y etc .. , We can define an arbitrary function with desired name in the following way.:: @@ -157,13 +181,16 @@ screen var('x') - h(x)=x^2 g(x)=1 + h(x)=x^2 + g(x)=1 f=Piecewise(<Tab> {{{ Show the documentation of Piecewise }}} :: - f=Piecewise([[(0,1),h(x)],[(1,2),g(x)]],x) f + f=Piecewise([[(0,1),h(x)],[(1,2),g(x)]],x) + f + @@ -184,9 +211,7 @@ For a convergent series , f(n)=1/n^2 we can say :: var('n') function('f', n) - f(n) = 1/n^2 - sum(f(n), n, 1, oo) @@ -200,6 +225,18 @@ Lets us now try another series :: This series converges to pi/4. +Following are exercises that you must do. + +%% %% Define the piecewise function. + f(x)=3x+2 + when x is in the closed interval 0 to 4. + f(x)=4x^2 + between 4 to 6. + +%% %% Sum of 1/(n^2-1) where n ranges from 1 to infinity. + +Please, pause the video here. Do the exercise(s) and then continue. + Moving on let us see how to perform simple calculus operations using Sage For example lets try an expression first :: @@ -267,6 +304,22 @@ correct :: as we can see when we substitute the value the answer is almost = 0 showing the solution we got was correct. +Following is an (are) exercise(s) that you must do. + +%% %% Differentiate the following. + + 1. sin(x^3)+log(3x) , degree=2 + #. x^5*log(x^7) , degree=4 + +%% %% Integrate the given expression + + sin(x^2)+exp(x^3) + +%% %% Find x + cos(x^2)-log(x)=0 + Does the equation have a root between 1,2. + +Please, pause the video here. Do the exercises and then continue. @@ -286,8 +339,18 @@ Now lets do some of the matrix operations on this matrix A.inverse() +Following is an (are) exercise(s) that you must do. + +%% %% Find the determinant and inverse of : + + A=[[x,0,1][y,1,0][z,0,y]] + +Please, pause the video here. Do the exercise(s) and then continue. + + + -{{{ Part of the notebook with summary }}} +{{{ Show the summary slide }}} So in this tutorial we learnt how to diff --git a/getting-started-with-symbolics/slides.org b/getting-started-with-symbolics/slides.org new file mode 100644 index 0000000..5ac2471 --- /dev/null +++ b/getting-started-with-symbolics/slides.org @@ -0,0 +1,166 @@ +#+LaTeX_CLASS: beamer +#+LaTeX_CLASS_OPTIONS: [presentation] +#+BEAMER_FRAME_LEVEL: 1 + +#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} +#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra) +#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC + +#+LaTeX_CLASS: beamer +#+LaTeX_CLASS_OPTIONS: [presentation] + +#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl} +#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet} + +#+LaTeX_HEADER: \usepackage{listings} + +#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries, +#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, +#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries} + +#+TITLE: Getting started with symbolics +#+AUTHOR: FOSSEE +#+EMAIL: +#+DATE: + +#+DESCRIPTION: +#+KEYWORDS: +#+LANGUAGE: en +#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t +#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc + +* Outline + - Defining symbolic expressions in sage. + - Using built-in constants and functions. + - Performing Integration, differentiation using sage. + - Defining matrices. + - Defining Symbolic functions. + - Simplifying and solving symbolic expressions and functions. + +* Questions 1 + - Define the following expression as symbolic + expression in sage. + + - x^2+y^2 + - y^2-4ax + +* Solutions 1 +#+begin_src python + var('x,y') + x^2+y^2 + + var('a,x,y') + y^2-4*a*x +#+end_src python +* Questions 2 + - Find the values of the following constants upto 6 digits precision + + - pi^2 + + + - Find the value of the following. + + - sin(pi/4) + - ln(23) + +* Solutions 2 +#+begin_src python + n(pi^2,digits=6) + n(sin(pi/4)) + n(log(23,e)) +#+end_src python +* Question 2 + - Define the piecewise function. + f(x)=3x+2 + when x is in the closed interval 0 to 4. + f(x)=4x^2 + between 4 to 6. + + - Sum of 1/(n^2-1) where n ranges from 1 to infinity. + +* Solution Q1 +#+begin_src python + var('x') + h(x)=3*x+2 + g(x)= 4*x^2 + f=Piecewise([[(0,4),h(x)],[(4,6),g(x)]],x) + f +#+end_src python +* Solution Q2 +#+begin_src python + var('n') + f=1/(n^2-1) + sum(f(n), n, 1, oo) +#+end_src python + + +* Questions 3 + - Differentiate the following. + + - x^5*log(x^7) , degree=4 + + - Integrate the given expression + + - x*sin(x^2) + + - Find x + - cos(x^2)-log(x)=0 + - Does the equation have a root between 1,2. + +* Solutions 3 +#+begin_src python + var('x') + f(x)= x^5*log(x^7) + diff(f(x),x,5) + + var('x') + integral(x*sin(x^2),x) + + var('x') + f=cos(x^2)-log(x) + find_root(f(x)==0,1,2) +#+end_src + +* Question 4 + - Find the determinant and inverse of : + + A=[[x,0,1][y,1,0][z,0,y]] + +* Solution 4 +#+begin_src python + var('x,y,z') + A=matrix([[x,0,1],[y,1,0],[z,0,y]]) + A.det() + A.inverse() +#+end_src +* Summary + - We learnt about defining symbolic + expression and functions. + - Using built-in constants and functions. + - Using <Tab> to see the documentation of a + function. + +* Summary + - Simple calculus operations . + - Substituting values in expression + using substitute function. + - Creating symbolic matrices and + performing operation on them . + +* Thank you! +#+begin_latex + \begin{block}{} + \begin{center} + This spoken tutorial has been produced by the + \textcolor{blue}{FOSSEE} team, which is funded by the + \end{center} + \begin{center} + \textcolor{blue}{National Mission on Education through \\ + Information \& Communication Technology \\ + MHRD, Govt. of India}. + \end{center} + \end{block} +#+end_latex + + + diff --git a/getting-started-with-symbolics/slides.tex b/getting-started-with-symbolics/slides.tex index 4fc3634..6ae2851 100644 --- a/getting-started-with-symbolics/slides.tex +++ b/getting-started-with-symbolics/slides.tex @@ -1,21 +1,34 @@ -% Created 2010-10-21 Thu 00:06 +% Created 2010-11-10 Wed 17:18 \documentclass[presentation]{beamer} -\usetheme{Warsaw}\useoutertheme{infolines}\usecolortheme{default}\setbeamercovered{transparent} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} +\usepackage{fixltx2e} \usepackage{graphicx} \usepackage{longtable} \usepackage{float} \usepackage{wrapfig} \usepackage{soul} +\usepackage{t1enc} +\usepackage{textcomp} +\usepackage{marvosym} +\usepackage{wasysym} +\usepackage{latexsym} \usepackage{amssymb} \usepackage{hyperref} +\tolerance=1000 +\usepackage[english]{babel} \usepackage{ae,aecompl} +\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet} +\usepackage{listings} +\lstset{language=Python, basicstyle=\ttfamily\bfseries, +commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, +showstringspaces=false, keywordstyle=\color{blue}\bfseries} +\providecommand{\alert}[1]{\textbf{#1}} - -\title{Plotting Data } +\title{Getting started with symbolics} \author{FOSSEE} -\date{2010-09-14 Tue} +\date{} +\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} \begin{document} \maketitle @@ -25,43 +38,222 @@ + + + \begin{frame} -\frametitle{Tutorial Plan} +\frametitle{Outline} \label{sec-1} + +\begin{itemize} +\item Defining symbolic expressions in sage. +\item Using built-in constants and functions. +\item Performing Integration, differentiation using sage. +\item Defining matrices. +\item Defining Symbolic functions. +\item Simplifying and solving symbolic expressions and functions. +\end{itemize} +\end{frame} +\begin{frame} +\frametitle{Questions 1} +\label{sec-2} + +\begin{itemize} +\item Define the following expression as symbolic + expression in sage. + +\begin{itemize} +\item x$^2$+y$^2$ +\item y$^2$-4ax +\end{itemize} + +\end{itemize} + + +\end{frame} +\begin{frame}[fragile] +\frametitle{Solutions 1} +\label{sec-3} + +\begin{verbatim} +var('x,y') +x^2+y^2 + +var('a,x,y') +y^2-4*a*x +\end{verbatim} +\end{frame} +\begin{frame} +\frametitle{Questions 2} +\label{sec-4} + +\begin{itemize} +\item Find the values of the following constants upto 6 digits precision + +\begin{itemize} +\item pi$^2$ +\end{itemize} + +\item Find the value of the following. + +\begin{itemize} +\item sin(pi/4) +\item ln(23) +\end{itemize} + +\end{itemize} +\end{frame} +\begin{frame}[fragile] +\frametitle{Solutions 2} +\label{sec-5} + +\begin{verbatim} +n(pi^2,digits=6) +n(sin(pi/4)) +n(log(23,e)) +\end{verbatim} +\end{frame} +\begin{frame} +\frametitle{Question 2} +\label{sec-6} + +\begin{itemize} +\item Define the piecewise function. + f(x)=3x+2 + when x is in the closed interval 0 to 4. + f(x)=4x$^2$ + between 4 to 6. +\item Sum of 1/(n$^2$-1) where n ranges from 1 to infinity. +\end{itemize} +\end{frame} +\begin{frame}[fragile] +\frametitle{Solution Q1} +\label{sec-7} + +\begin{verbatim} +var('x') +h(x)=3*x+2 +g(x)= 4*x^2 +f=Piecewise([[(0,4),h(x)],[(4,6),g(x)]],x) +f +\end{verbatim} +\end{frame} +\begin{frame}[fragile] +\frametitle{Solution Q2} +\label{sec-8} + +\begin{verbatim} +var('n') +f=1/(n^2-1) +sum(f(n), n, 1, oo) +\end{verbatim} + +\end{frame} +\begin{frame} +\frametitle{Questions 3} +\label{sec-9} + +\begin{itemize} +\item Differentiate the following. + +\begin{itemize} +\item x$^5$*log(x$^7$) , degree=4 +\end{itemize} + +\item Integrate the given expression + +\begin{itemize} +\item x*sin(x$^2$) +\end{itemize} + +\item Find x + \begin{itemize} +\item cos(x$^2$)-log(x)=0 +\item Does the equation have a root between 1,2. +\end{itemize} + +\end{itemize} +\end{frame} +\begin{frame}[fragile] +\frametitle{Solutions 3} +\label{sec-10} + +\begin{verbatim} +var('x') +f(x)= x^5*log(x^7) +diff(f(x),x,5) + +var('x') +integral(x*sin(x^2),x) -\item Defining symbolic expressions in sage.\\ -\label{sec-1.1}% -\item Using built-in costants and functions.\\ -\label{sec-1.2}% -\item Performing Integration, differentiation using sage.\\ -\label{sec-1.3}% -\item Defining matrices.\\ -\label{sec-1.4}% -\item Defining Symbolic functions.\\ -\label{sec-1.5}% -\item Simplifying and solving symbolic expressions and functions.\\ -\label{sec-1.6}% -\end{itemize} % ends low level +var('x') +f=cos(x^2)-log(x) +find_root(f(x)==0,1,2) +\end{verbatim} +\end{frame} +\begin{frame} +\frametitle{Question 4} +\label{sec-11} + +\begin{itemize} +\item Find the determinant and inverse of : + + A=[[x,0,1][y,1,0][z,0,y]] +\end{itemize} +\end{frame} +\begin{frame}[fragile] +\frametitle{Solution 4} +\label{sec-12} + +\begin{verbatim} +var('x,y,z') +A=matrix([[x,0,1],[y,1,0],[z,0,y]]) +A.det() +A.inverse() +\end{verbatim} \end{frame} \begin{frame} \frametitle{Summary} -\label{sec-2} +\label{sec-13} + \begin{itemize} +\item We learnt about defining symbolic + expression and functions. +\item Using built-in constants and functions. +\item Using <Tab> to see the documentation of a + function. +\end{itemize} + + +\end{frame} +\begin{frame} +\frametitle{Summary} +\label{sec-14} + +\begin{itemize} +\item Simple calculus operations . +\item Substituting values in expression + using substitute function. +\item Creating symbolic matrices and + performing operation on them . +\end{itemize} +\end{frame} +\begin{frame} +\frametitle{Thank you!} +\label{sec-15} -\item We learnt about defining symbolic expression and functions.\\ -\label{sec-2.1}% -\item Using built-in constants and functions.\\ -\label{sec-2.2}% -\item Using <Tab> to see the documentation of a function.\\ -\label{sec-2.3}% -\item Simple calculus operations .\\ -\label{sec-2.4}% -\item Substituting values in expression using substitute function.\\ -\label{sec-2.5}% -\item Creating symbolic matrices and performing operation on them .\\ -\label{sec-2.6}% -\end{itemize} % ends low level + \begin{block}{} + \begin{center} + This spoken tutorial has been produced by the + \textcolor{blue}{FOSSEE} team, which is funded by the + \end{center} + \begin{center} + \textcolor{blue}{National Mission on Education through \\ + Information \& Communication Technology \\ + MHRD, Govt. of India}. + \end{center} + \end{block} \end{frame} \end{document} diff --git a/symbolics/slides.org b/symbolics/slides.org deleted file mode 100644 index 9e49d37..0000000 --- a/symbolics/slides.org +++ /dev/null @@ -1,33 +0,0 @@ -#+LaTeX_CLASS: beamer -#+LaTeX_CLASS_OPTIONS: [presentation] -#+BEAMER_FRAME_LEVEL: 1 - -#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\useoutertheme{infolines}\usecolortheme{default}\setbeamercovered{transparent} -#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra) -#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC -#+OPTIONS: H:5 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t - -#+TITLE: Plotting Data -#+AUTHOR: FOSSEE -#+DATE: 2010-09-14 Tue -#+EMAIL: info@fossee.in - -# \author[FOSSEE] {FOSSEE} - -# \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -# \date{} - -* Tutorial Plan -** Defining symbolic expressions in sage. -** Using built-in costants and functions. -** Performing Integration, differentiation using sage. -** Defining matrices. -** Defining Symbolic functions. -** Simplifying and solving symbolic expressions and functions. -* Summary -** We learnt about defining symbolic expression and functions. -** Using built-in constants and functions. -** Using <Tab> to see the documentation of a function. -** Simple calculus operations . -** Substituting values in expression using substitute function. -** Creating symbolic matrices and performing operation on them . |