# Special Mathematical Functions

Maple supports many special mathematical functions including all of the trigonometric, exponential, logarithmic, Bessel, Dirac, Gamma, and polynomial functions. There is not enough space to cover all of them here, but we will go through a number of examples.

You have already seen several examples of trigonometric, exponential, and logarithmic functions, but here are some more:

```> F:= x ->(arcsin(x)-tan(x))/(x*sin(x)+cos(2*x));

arcsin(x)- tan(x)
F := x ->-------------------
x sin(x) +cos(2 x)

> evalf(F(2*Pi));

1.570796327 -2.524630660 I

> G := x -> 2*x*exp(x))/log10((3*x^2)/(x-5)^3);

x exp(x)
G := x -> 2 -----------------

2
x
log10(3 --------)
3
(x - 5)

> G(1);

exp(1)
2  ------------
log10(-3/64)

> evalf(");

5.436563656
--------------------
log10(-.04687500000)

```

Now let us look at some special functions.
Bessel functions are a common form of equation. Maple supports Bessel functions of the first and second kind and modified Bessel functions of the first and second kind. Let us compute the value of a fourth order Bessel function (J) of the first kind with x=9.6. We shall use the `BesselJ` command:

```> BesselJ(4,9.6);

-.2632581481
```

Why not plot the entire function from -10 < x < 10?

```> plot(BesselJ(4,x),x=-10..10);

AAAA             0.4 +                AAAA
AA  AA                +               AA  AA
A     AA               +              AA     A
AA      A           0.3 +             A       AA
A        AA             +            AA        A
A          A             +            A          A
A           A        0.2 +           A           A
AA            A           +          A            AA
A             AA          +         A              A
A               AA     0.1 +        AA               A
A                AA        +       AA                A
AA                 AAA      +     AA                  A
+---+--+-*-+---+--+---+---+---***************---+---+---+--+---+-*-+--+---+
A                         0 +                           A
-10      A        -5                  0                 5         A      10
A                            +                           A
A                        -0.1 +                            A
A                             +                            A
A                              +                             A
A    AA                         -0.2 +                             AA    A
AA  AA                               +                              AA  AA
AAAA                                +                               AAAA

```

The Gamma function is defined as follows:

```> G:=t->int(t^(n-1)*e^(-t),t=0..infinity);

infinity
/
|       (n -1)  (- t)
G := t ->    |      t       e      dt
|
/
0
where n > 0
```

We can plot the discontinuous Gamma function directly without having to define it first:

```>plot(GAMMA(t),t=-10..10,-10..10,discont=true);

AA              10 *               A
AA                 *               A
AA                 *              A
AA                 *A             A
AA                 *A             A
AA               5 *A            A
AA            A    *A           AA
AA           AA    *A          AA
AA           A A   *AA        AA
AA           A A   * AAA  AAAA
*****--******--*****--+***+---**-*---*---+**+---+---+---+--+---+---+--+---+
AAA     AAA    AAAA  A    A  A 0 *
-10               -5       AAA A  A   0                  5                10
A A A  A   *
A A  A A *
AA  A AA*
A    -5A*
A    AAA*
A A*
A A*
*
-10 *

```

We can automatically derive various orthogonal polynomials with the `with(orthopoly)` command:

```> with(orthopoly);

[G, H, L, P, T,U]
```

We can now easily a third order Hermite polynomial and a ninth order Laguerre polynomial with 2x-a+b as a variable, to name two:

```> H(3,x);

3
8 x  - 12 x
> L(9,2*x-a+b);

2                  3
1 - 18 x + 9 a - 9 b + 18 (2 x - a + b)  - 14(2 x - a + b)

4    21              5                     6
+ 21/4 (2 x - a + b)  - ---- (2 x - a +b)  + 7/60 (2 x - a + b)
20

7                      8                         9
- 1/140 (2 x - a + b)  + 1/4480 (2 x - a+ b)  - 1/362880 (2 x - a + b)
```

Sometimes special functions hit us when we least expect them to:

```> K:= u -> int(exp(-u^2),u);

/
|        2
K := u ->  |  exp(-u ) du
|
/
```

This looks okay, but what happens when we try to evaluate this equation?

```> int(exp(-u^2),u);

1/2
1/2 Pi   erf(u)
```

This result called up the standard error function, erf(u):

```> error:=x-> ( 2 /sqrt(Pi) ) *int(e^(-u^2),u=0..x);

x
/     2
2          |  (- u )
error(x) =             -------       |  e      du
sqrt(Pi)      |
/
0

```

Maple will just pass the value of this equation on in all of its calculations. Of cource, we can plot this function, easily:

```> plot(erf(u),u=0..5);

1 +                      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+                  AAAAAA
+               AAA
+              AA
0.8            AA
+           AA
+          AA
+         A
0.6        AA
+       AA
+      AA
+      A
+     A
0.4    A
+    A
+   A
+  A
0.2 AA
+ A
+A
*
*--+--+--+--+--+--+--+--+--+--+--+--+-+--+--+--+--+--+--+--+--+--+--+--+--+
0 0             1              2             3              4              5

```

For more of Maples capabilities with special functions, please look at the resources page at the end of this tutorial.

This page Maintained by Dale H. Leschnitzer