getting-started-with-symbolics/slides.org
changeset 458 9a1c5d134feb
parent 442 a9b71932cbfa
equal deleted inserted replaced
446:2ce824b5adf4 458:9a1c5d134feb
    35   - Performing Integration, differentiation using sage. 
    35   - Performing Integration, differentiation using sage. 
    36   - Defining matrices. 
    36   - Defining matrices. 
    37   - Defining Symbolic functions.  
    37   - Defining Symbolic functions.  
    38   - Simplifying and solving symbolic expressions and functions.
    38   - Simplifying and solving symbolic expressions and functions.
    39 
    39 
    40 * Questions 1
    40 * Question 1
    41   - Define the following expression as symbolic
    41   - Define the following expression as symbolic
    42     expression in sage.
    42     expression in sage.
    43 
    43 
    44     - x^2+y^2
    44     - x^2+y^2
    45     - y^2-4ax
    45     - y^2-4ax
    46   
    46   
    47 * Solutions 1
    47 * Solution 1
    48 #+begin_src python
    48 #+begin_src python
    49   var('x,y')
    49   var('x,y')
    50   x^2+y^2
    50   x^2+y^2
    51 
    51 
    52   var('a,x,y')
    52   var('a,x,y')
    53   y^2-4*a*x
    53   y^2-4*a*x
    54 #+end_src python
    54 #+end_src python
    55 * Questions 2
    55 * Question 2
    56   - Find the values of the following constants upto 6 digits  precision 
    56   - Find the values of the following constants upto 6 digits  precision 
    57    
    57    
    58     - pi^2
    58     - pi^2
       
    59     - euler_gamma^2
    59    
    60    
    60       
    61       
    61   - Find the value of the following.
    62   - Find the value of the following.
    62 
    63 
    63    - sin(pi/4)
    64    - sin(pi/4)
    64    - ln(23)  
    65    - ln(23)  
    65 
    66 
    66 * Solutions 2
    67 * Solution 2
    67 #+begin_src python
    68 #+begin_src python
    68   n(pi^2,digits=6)
    69   n(pi^2,digits=6)
    69   n(sin(pi/4))
    70   n(sin(pi/4))
    70   n(log(23,e))
    71   n(log(23,e))
    71 #+end_src python
    72 #+end_src python
    72 * Question 2
    73 * Question 3
    73   - Define the piecewise function. 
    74   - Define the piecewise function. 
    74    f(x)=3x+2 
    75    f(x)=3x+2 
    75    when x is in the closed interval 0 to 4.
    76    when x is in the closed interval 0 to 4.
    76    f(x)=4x^2
    77    f(x)=4x^2
    77    between 4 to 6. 
    78    between 4 to 6. 
    78    
    79    
    79   - Sum  of 1/(n^2-1) where n ranges from 1 to infinity. 
    80   - Sum  of 1/(n^2-1) where n ranges from 1 to infinity. 
    80 
    81 
    81 * Solution Q1
    82 * Solution 3
    82 #+begin_src python
    83 #+begin_src python
    83   var('x') 
    84   var('x') 
    84   h(x)=3*x+2 
    85   h(x)=3*x+2 
    85   g(x)= 4*x^2
    86   g(x)= 4*x^2
    86   f=Piecewise([[(0,4),h(x)],[(4,6),g(x)]],x)
    87   f=Piecewise([[(0,4),h(x)],[(4,6),g(x)]],x)
    87   f
    88   f
    88 #+end_src python
    89 #+end_src python
    89 * Solution Q2
    90 
    90 #+begin_src python  
    91 #+begin_src python  
    91   var('n')
    92   var('n')
    92   f=1/(n^2-1) 
    93   f=1/(n^2-1) 
    93   sum(f(n), n, 1, oo)
    94   sum(f(n), n, 1, oo)
    94 #+end_src python  
    95 #+end_src python  
    95  
       
    96 
    96 
    97 * Questions 3
    97 * Question 4
    98   - Differentiate the following. 
    98   - Differentiate the following. 
    99       
    99       
   100     - x^5*log(x^7)  , degree=4 
   100     - sin(x^3)+log(3x), to the second order
       
   101     - x^5*log(x^7), to the fourth order
   101 
   102 
   102   - Integrate the given expression 
   103   - Integrate the given expression 
   103       
   104       
   104     - x*sin(x^2) 
   105     - x*sin(x^2) 
   105 
   106 
   106   - Find x
   107   - Find x
   107     - cos(x^2)-log(x)=0
   108     - cos(x^2)-log(x)=0
   108     - Does the equation have a root between 1,2. 
   109     - Does the equation have a root between 1,2. 
   109 
   110 
   110 * Solutions 3
   111 * Solution 4
   111 #+begin_src python
   112 #+begin_src python
   112   var('x')
   113   var('x')
   113   f(x)= x^5*log(x^7) 
   114   f(x)= x^5*log(x^7) 
   114   diff(f(x),x,5)
   115   diff(f(x),x,5)
   115 
   116 
   119   var('x')
   120   var('x')
   120   f=cos(x^2)-log(x)
   121   f=cos(x^2)-log(x)
   121   find_root(f(x)==0,1,2)
   122   find_root(f(x)==0,1,2)
   122 #+end_src
   123 #+end_src
   123 
   124 
   124 * Question 4
   125 * Question 5
   125   - Find the determinant and inverse of :
   126   - Find the determinant and inverse of :
   126 
   127 
   127       A=[[x,0,1][y,1,0][z,0,y]]
   128       A=[[x,0,1][y,1,0][z,0,y]]
   128 
   129 
   129 * Solution 4
   130 * Solution 5
   130 #+begin_src python  
   131 #+begin_src python  
   131   var('x,y,z')
   132   var('x,y,z')
   132   A=matrix([[x,0,1],[y,1,0],[z,0,y]])
   133   A=matrix([[x,0,1],[y,1,0],[z,0,y]])
   133   A.det()
   134   A.det()
   134   A.inverse()
   135   A.inverse()
   135 #+end_src
   136 #+end_src
   136 * Summary
   137 * Summary
   137  - We learnt about defining symbolic 
   138  - We learnt about defining symbolic expression and functions.
   138    expression and functions.  
   139  - Using built-in constants and functions.
   139  - Using built-in constants and functions.  
   140  - Using <Tab> to see the documentation of a function.
   140  - Using <Tab>  to see the documentation of a 
   141  - Simple calculus operations .
   141    function.  
   142  - Substituting values in expression using substitute function.
   142  
   143  - Creating symbolic matrices and performing operation on them .
   143 * Summary 
       
   144  - Simple calculus operations .  
       
   145  - Substituting values in expression 
       
   146    using substitute function.
       
   147  - Creating symbolic matrices and 
       
   148    performing operation on them .
       
   149 
       
   150 * Thank you!
   144 * Thank you!
   151 #+begin_latex
   145 #+begin_latex
   152   \begin{block}{}
   146   \begin{block}{}
   153   \begin{center}
   147   \begin{center}
   154   This spoken tutorial has been produced by the
   148   This spoken tutorial has been produced by the