summaryrefslogtreecommitdiff
path: root/getting-started-with-symbolics
diff options
context:
space:
mode:
Diffstat (limited to 'getting-started-with-symbolics')
-rw-r--r--getting-started-with-symbolics/script.rst101
-rw-r--r--getting-started-with-symbolics/slides.org166
-rw-r--r--getting-started-with-symbolics/slides.tex258
3 files changed, 473 insertions, 52 deletions
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}