MuPAD - Demo

# ... Calculus via MuPAD

This chapter shows how algebraic problems and problems of higher analysis can be solved by symbolic computations in MuPAD.

## Contents

1. Differentation and Integration
2. Definite and indefinite summation
3. Series expansion and limit computation
4. Solving equations and systems of equations
5. Complex Expressions - Rectangular form
6. Index of algebraic examples

### Differentation and Integration

The function diff computes the partial derivative of expressions.

- `>> diff( sin(x)*ln(x),x );`
  `

      sin(x)
      ------ + ln(x) cos(x)
      x

  `

- `>> diff( poly(sin(a)*x^3 + 2*x, [x]),a,x );`
  `

           /    2             \
      poly \ 3 x  cos(a), [x] /

  `

  You can differentiate any function and proof well known rules like:

- `>> diff( f(x)*g(x),x );`
  `f(x) diff(g(x), x) + g(x) diff(f(x), x)`

- `>> diff( f(g(h(x))),x );`
  `D(g)(h(x)) D(f)(g(h(x))) diff(h(x), x)`

  The differential operator D is used to represent the differentiation of functions.

- `>> D( sin );`
  `cos`

- `>> D( f @ (g+h) );`
  `(D(g) + D(h)) D(f)@(g + h)`

  Use the function int to compute the indefinite integral of functions.

- `>> int( (4-2*t)^5,t );`
  `

                               3                        6
                     2   2560 t         4       5   16 t
      1024 t - 1280 t  + ------- - 320 t  + 64 t  - -----
                            3                         3

  `

- `>> int( 1/(x*ln(x)),x );`
  `ln(ln(x))`

### Definite and indefinite summation

MuPAD provides the function sum to compute definite or indefinite sums of expressions.

- `>> sum( n^2,n );`
  `

           2    3
      n   n    n
      - - -- + --
      6   2    3

  `

- `>> sum( 1/k/(k+2)^2,k );`
  `

        1    psi(k + 2, 1)       1
      - --- + ------------- + ----------
      4 k         2         - 4 k - 4

  `

- `>> sum( 1/(n^2+21*n),n=1..infinity );`
  `18858053/108636528`

- `>> sum( binomial(n,k)/2^n-binomial(n+1,k)/2^(n+1),k );`
  `

      - 2 k binomial(n, k) + k binomial(n + 1, k)
      --------------------------------------------
      	     n        n        n
      	- 2 2  + 4 k 2  - 2 n 2

  `

### Series expansion and limit computation

Important parts of higher analysis consist of series expansions and also on limit computations. In MuPAD you can do Taylor, Laurent, Puiseux or a more general series expansion.

- `>> taylor( 1/(x^2-a),x );`
  `

        1    - 2  2    - 3  4     /  6 \
      - - - a    x  - a    x  + O \ x  /
        a

  `

- `>> series( 1/x + y + x^3,x=0 );`
  `

      1        3     /  4 \
      - + y + x  + O \ x  /
      x

  `

- `>> series( sin(x+a),a=0,4 );`
  `

                           3           2
                          a  cos(x)   a  sin(x)     /  4 \
      sin(x) + a cos(x) - --------- - --------- + O \ a  /
                              6           2

  `

  This is an example for the generalized series expansion.

- `>> series( ln(x), x=0 );`
  `

                /  5 \
      ln(x) + O \ x  /

  `

  The following example shows the possibility for manipulating series expansions by using arithmetic operations.

- `>> s:= series( sin(x),x=0,4 );`
  `

           3
          x      /  4 \
      x - -- + O \ x  /
          6

  `

- `>> 1/s+2*s;`
  `

      1   13 x     /  2 \
      - + ---- + O \ x  /
      x    6

  `

- `>> s^3;`
  `

            5
       3   x      /  6 \
      x  - -- + O \ x  /
           2

  `

  The function limit can be used to compute limits of expressions.

- `>> limit( (sin(x+h)-sin(x))/h, h=0 );`
  `cos(x)`

- `>> limit( (1+1/n)^n, n=infinity );`
  `E`

  The function limit is also able to handle expressions of a high complicated structure.

- `>> limit( (exp(x*exp(-x)/(exp(-x)+exp(-2*x^2/(x+1))))-exp(x))/x, x=infinity );`
  `

         2
      - E

  `

- `>> limit( exp(exp(n))*(exp(sin(1/n+1/exp(exp(n))))-exp(sin(1/n))), n=infinity );`
  `

       1

  `

### Solving equations and systems of equations

In MuPAD the function solve can be used to solve systems of equations.

- `>> solve( x^4-5*x^2+6*x=2,x );`
  `

      --  1/2         1/2            --
      |  3    - 1, - 3    - 1 , 1, 1  |
      --                             --

  `

- `>> solve( a*x^2+b*x+c,x );`
  `

      --       /            2  \1/2         /            2  \1/2  --
      |  - b + \ - 4 a c + b   /      - b - \ - 4 a c + b   /      |
      |  ---------------------------, ---------------------------  |
      --             2 a                          2 a             --

  `

- `>> solve( x^3=-1,x );`
  `

      --               1/2                   1/2         --
      |  - 1, (1/2 I) 3    + 1/2, (- 1/2 I) 3    + 1/2    |
      --                                                 --

  `

- `>> solve( {u+v+w=1, 3*u+v=3, u-2*v-w=0},{u,v,w} );`
  `[{u = 4/5, v = 3/5, w = - 2/5}]`

- `>> solve( {u+v+w=1, 3*u+v=3, u^2-2*v-w=0},{u,v,w} );`
  `

      -- --                                         /        2     \ -- --
      |  |  v = - 3 u + 3 , w = 2 u - 2, u = RootOf \ 4 u + u  - 4 /  |  |
      -- --                                                          -- --

  `

### Complex Expressions - Rectangular form

For complex expressions the function Re and Im return the real and the imaginary part respectivly.

- `>> Re( sin(2+3*I)+exp(2-I) + (2+3*I)^(1/3) );`
  `

                                         1/6     / atan(3/2) \
      cos(1) exp(2) + sin(2) cosh(3) + 13    cos | --------- |
                                                 \     3     /

  `

- `>> Im( tan(x) );`
  `Im(tan(x))`

  For expressions involving unknowns the function rectform is usefull.

- `>> rectform( tan(x) );`
  `

              sin(2 Re(x))                 I sinh(2 Im(x))
      ---------------------------- + ----------------------------
      cos(2 Re(x)) + cosh(2 Im(x))   cos(2 Re(x)) + cosh(2 Im(x))

  `

- `>> Re(%), Im(%);`
  `

              sin(2 Re(x))                 sinh(2 Im(x))
      ----------------------------, ----------------------------
      cos(2 Re(x)) + cosh(2 Im(x))  cos(2 Re(x)) + cosh(2 Im(x))

  `

  Standard arithmetical operations can be performed for complex expressions in rectangular form.

- `>> a:= rectform( exp(x) );`
  `cos(Im(x)) exp(Re(x)) + I sin(Im(x)) exp(Re(x))`

- `>> PI*a, a^2;`
  `

      PI cos(Im(x)) exp(Re(x)) + I PI sin(Im(x)) exp(Re(x)), 2

                                        2   /           2
      I cos(Im(x)) sin(Im(x)) exp(Re(x))  + \ cos(Im(x))  exp(

                      2             2           2 \
                Re(x))  - sin(Im(x))  exp(Re(x))  /

  `

- `>> sin(x)*a;`
  `

      (cos(Im(x)) sin(Re(x)) exp(Re(x)) cosh(Im(x)) - cos(Re(x))

      sin(Im(x)) exp(Re(x)) sinh(Im(x))) + I (cos(Im(x)) cos(Re(

      x)) exp(Re(x)) sinh(Im(x)) + sin(Im(x)) sin(Re(x)) exp(Re(

                           x)) cosh(Im(x)))

  `