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/quickref.tex8
-rw-r--r--getting-started-with-symbolics/script.rst340
-rw-r--r--getting-started-with-symbolics/slides.org160
-rw-r--r--getting-started-with-symbolics/slides.tex252
4 files changed, 0 insertions, 760 deletions
diff --git a/getting-started-with-symbolics/quickref.tex b/getting-started-with-symbolics/quickref.tex
deleted file mode 100644
index b26d168..0000000
--- a/getting-started-with-symbolics/quickref.tex
+++ /dev/null
@@ -1,8 +0,0 @@
-Creating a linear array:\\
-{\ex \lstinline| x = linspace(0, 2*pi, 50)|}
-
-Plotting two variables:\\
-{\ex \lstinline| plot(x, sin(x))|}
-
-Plotting two lists of equal length x, y:\\
-{\ex \lstinline| plot(x, y)|}
diff --git a/getting-started-with-symbolics/script.rst b/getting-started-with-symbolics/script.rst
deleted file mode 100644
index 4f714d4..0000000
--- a/getting-started-with-symbolics/script.rst
+++ /dev/null
@@ -1,340 +0,0 @@
-.. Objectives
-.. ----------
-
-.. By the end of this tutorial, you will be able to
-
-.. 1. 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.
-
-
-.. Prerequisites
-.. -------------
-
-.. 1. getting started with sage notebook
-
-
-.. Author : Amit
- Internal Reviewer :
- External Reviewer :
- Language Reviewer : Bhanukiran
- Checklist OK? : <, if OK> [2010-10-05]
-
-Symbolics with Sage
--------------------
-
-Hello friends and welcome to the tutorial on Symbolics with Sage.
-
-{{{ Show welcome slide }}}
-
-During the course of the tutorial we will learn
-
-{{{ Show outline slide }}}
-
-* 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.
-
-In addtion to a lot of other things, Sage can do Symbolic Math and we shall
-start with defining symbolic expressions in Sage.
-
-Have your Sage notebook opened. If not, pause the video and
-start you Sage notebook right now.
-
-On the sage notebook type::
-
- sin(y)
-
-It raises a name error saying that ``y`` is not defined. We need to
-declare ``y`` as a symbol. We do it using the ``var`` function.
-::
-
- var('y')
-
-Now if you type::
-
- sin(y)
-
-Sage simply returns the expression.
-
-Sage treats ``sin(y)`` as a symbolic expression. We can use this to do
-symbolic math using Sage's built-in constants and expressions.
-
-Let us try out a few examples. ::
-
- var('x,alpha,y,beta')
- x^2/alpha^2+y^2/beta^2
-
-We have defined 4 variables, ``x``, ``y``, ``alpha`` and ``beta`` and
-have defined a symbolic expression using them.
-
-Here is an expression in ``theta`` ::
-
- var('theta')
- sin(theta)*sin(theta)+cos(theta)*cos(theta)
-
-Now that you know how to define symbolic expressions in Sage, here is
-an exercise.
-
-{{ show slide showing question 1 }}
-
-%% %% 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.
-
-{{ show slide showing solution 1 }}
-
-Sage also provides built-in constants which are commonly used in
-mathematics, for instance pi, e, infinity. The function ``n`` gives
-the numerical values of all these constants.
-::
- n(pi)
- n(e)
- n(oo)
-
-If you look into the documentation of function ``n`` by doing
-
-::
- n(<Tab>
-
-You will see what all arguments it takes and what it returns. It will
-be very helpful if you look at the documentation of all functions
-introduced in the course of this script.
-
-Also we can define the number of digits we wish to have in the
-constants. For this we have to pass an argument -- digits. Type
-
-::
-
- n(pi, digits = 10)
-
-Apart from the constants Sage also has a lot of built-in functions
-like ``sin``, ``cos``, ``log``, ``factorial``, ``gamma``, ``exp``,
-``arcsin`` etc ...
-
-Lets try some of them out on the Sage notebook.
-::
-
- sin(pi/2)
-
- arctan(oo)
-
- log(e,e)
-
-Following are exercises that you must do.
-
-{{ show slide showing question 2 }}
-
-%% %% 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
-
-{{ show slide showing solution 2 }}
-
-Given that we have defined variables like x, y etc., we can define an
-arbitrary function with desired name in the following way.::
-
- var('x')
- function('f',x)
-
-Here f is the name of the function and x is the independent variable .
-Now we can define f(x) to be ::
-
- f(x) = x/2 + sin(x)
-
-Evaluating this function f for the value x=pi returns pi/2.::
-
- f(pi)
-
-We can also define functions that are not continuous but defined
-piecewise. Let us define a function which is a parabola between 0
-to 1 and a constant from 1 to 2 . Type the following
-::
-
-
- var('x')
- h(x)=x^2
- g(x)=1
-
- f=Piecewise([[(0,1),h(x)],[(1,2),g(x)]],x)
- f
-
-We can also define functions convergent series and other series.
-
-We first define a function f(n) in the way discussed above.::
-
- var('n')
- function('f', n)
-
-
-To sum the function for a range of discrete values of n, we use the
-sage function sum.
-
-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)
-
-
-Lets us now try another series ::
-
-
- f(n) = (-1)^(n-1)*1/(2*n - 1)
- sum(f(n), n, 1, oo)
-
-This series converges to pi/4.
-
-Following are exercises that you must do.
-
-{{ show slide showing question 3 }}
-
-%% %% 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.
-
-{{ show slide showing solution 3 }}
-
-Moving on let us see how to perform simple calculus operations using Sage
-
-For example lets try an expression first ::
-
- diff(x**2+sin(x),x)
-
-The diff function differentiates an expression or a function. It's
-first argument is expression or function and second argument is the
-independent variable.
-
-We have already tried an expression now lets try a function ::
-
- f=exp(x^2)+arcsin(x)
- diff(f(x),x)
-
-To get a higher order differential we need to add an extra third argument
-for order ::
-
- diff(f(x),x,3)
-
-in this case it is 3.
-
-Just like differentiation of expression you can also integrate them ::
-
- x = var('x')
- s = integral(1/(1 + (tan(x))**2),x)
- s
-
-Many a times we need to find factors of an expression, we can use the
-"factor" function
-
-::
-
- y = (x^100 - x^70)*(cos(x)^2 + cos(x)^2*tan(x)^2)
- f = factor(y)
-
-One can simplify complicated expression ::
-
- f.simplify_full()
-
-This simplifies the expression fully. We can also do simplification of
-just the algebraic part and the trigonometric part ::
-
- f.simplify_exp()
- f.simplify_trig()
-
-One can also find roots of an equation by using ``find_root`` function::
-
- phi = var('phi')
- find_root(cos(phi)==sin(phi),0,pi/2)
-
-Let's substitute this solution into the equation and see we were
-correct ::
-
- var('phi')
- f(phi)=cos(phi)-sin(phi)
- root=find_root(f(phi)==0,0,pi/2)
- f.substitute(phi=root)
-
-as we can see when we substitute the value the answer is almost = 0 showing
-the solution we got was correct.
-
-Following are a few exercises 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.
-
-
-Lets us now try some matrix algebra symbolically ::
-
- var('a,b,c,d')
- A=matrix([[a,1,0],[0,b,0],[0,c,d]])
- A
-
-Now lets do some of the matrix operations on this matrix
-::
- A.det()
- 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.
-
-
-{{{ Show the summary slide }}}
-
-That brings us to the end of this tutorial. In this tutorial we learnt
-how to
-
-* define symbolic expression and functions
-* use built-in constants and functions
-* use <Tab> to see the documentation of a function
-* do simple calculus
-* substitute values in expressions using ``substitute`` function
-* create symbolic matrices and perform operations on them
-
diff --git a/getting-started-with-symbolics/slides.org b/getting-started-with-symbolics/slides.org
deleted file mode 100644
index 5d9391e..0000000
--- a/getting-started-with-symbolics/slides.org
+++ /dev/null
@@ -1,160 +0,0 @@
-#+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.
-
-* Question 1
- - Define the following expression as symbolic
- expression in sage.
-
- - x^2+y^2
- - y^2-4ax
-
-* Solution 1
-#+begin_src python
- var('x,y')
- x^2+y^2
-
- var('a,x,y')
- y^2-4*a*x
-#+end_src python
-* Question 2
- - Find the values of the following constants upto 6 digits precision
-
- - pi^2
- - euler_gamma^2
-
-
- - Find the value of the following.
-
- - sin(pi/4)
- - ln(23)
-
-* Solution 2
-#+begin_src python
- n(pi^2,digits=6)
- n(sin(pi/4))
- n(log(23,e))
-#+end_src python
-* Question 3
- - 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 3
-#+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
-
-#+begin_src python
- var('n')
- f=1/(n^2-1)
- sum(f(n), n, 1, oo)
-#+end_src python
-
-* Question 4
- - Differentiate the following.
-
- - sin(x^3)+log(3x), to the second order
- - x^5*log(x^7), to the fourth order
-
- - 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.
-
-* Solution 4
-#+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 5
- - Find the determinant and inverse of :
-
- A=[[x,0,1][y,1,0][z,0,y]]
-
-* Solution 5
-#+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.
- - 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
deleted file mode 100644
index 51e8997..0000000
--- a/getting-started-with-symbolics/slides.tex
+++ /dev/null
@@ -1,252 +0,0 @@
-% Created 2010-11-11 Thu 02:03
-\documentclass[presentation]{beamer}
-\usepackage[latin1]{inputenc}
-\usepackage[T1]{fontenc}
-\usepackage{fixltx2e}
-\usepackage{graphicx}
-\usepackage{longtable}
-\usepackage{float}
-\usepackage{wrapfig}
-\usepackage{soul}
-\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{Getting started with symbolics}
-\author{FOSSEE}
-\date{}
-
-\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
-\begin{document}
-
-\maketitle
-
-
-
-
-
-
-
-
-
-\begin{frame}
-\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{Question 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{Solution 1}
-\label{sec-3}
-
-\lstset{language=Python}
-\begin{lstlisting}
-var('x,y')
-x^2+y^2
-
-var('a,x,y')
-y^2-4*a*x
-\end{lstlisting}
-\end{frame}
-\begin{frame}
-\frametitle{Question 2}
-\label{sec-4}
-
-
-\begin{itemize}
-\item Find the values of the following constants upto 6 digits precision
-
-\begin{itemize}
-\item pi$^2$
-\item euler$_{\mathrm{gamma}}$$^2$
-\end{itemize}
-
-\end{itemize}
-
-\begin{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{Solution 2}
-\label{sec-5}
-
-\lstset{language=Python}
-\begin{lstlisting}
-n(pi^2,digits=6)
-n(sin(pi/4))
-n(log(23,e))
-\end{lstlisting}
-\end{frame}
-\begin{frame}
-\frametitle{Question 3}
-\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 3}
-\label{sec-7}
-
-\lstset{language=Python}
-\begin{lstlisting}
-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{lstlisting}
-
-\lstset{language=Python}
-\begin{lstlisting}
-var('n')
-f=1/(n^2-1)
-sum(f(n), n, 1, oo)
-\end{lstlisting}
-\end{frame}
-\begin{frame}
-\frametitle{Question 4}
-\label{sec-8}
-
-\begin{itemize}
-\item Differentiate the following.
-
-\begin{itemize}
-\item sin(x$^3$)+log(3x), to the second order
-\item x$^5$*log(x$^7$), to the fourth order
-\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{Solution 4}
-\label{sec-9}
-
-\lstset{language=Python}
-\begin{lstlisting}
-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{lstlisting}
-\end{frame}
-\begin{frame}
-\frametitle{Question 5}
-\label{sec-10}
-
-\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 5}
-\label{sec-11}
-
-\lstset{language=Python}
-\begin{lstlisting}
-var('x,y,z')
-A=matrix([[x,0,1],[y,1,0],[z,0,y]])
-A.det()
-A.inverse()
-\end{lstlisting}
-\end{frame}
-\begin{frame}
-\frametitle{Summary}
-\label{sec-12}
-
-\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.
-\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-13}
-
- \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}