# sech

Symbolic hyperbolic secant function

## Syntax

``sech(X)``

## Description

example

````sech(X)` returns the hyperbolic secant function of `X`.```

## Examples

### Hyperbolic Secant Function for Numeric and Symbolic Arguments

Depending on its arguments, `sech` returns floating-point or exact symbolic results.

Compute the hyperbolic secant function for these numbers. Because these numbers are not symbolic objects, `sech` returns floating-point results.

`A = sech([-2, -pi*i, pi*i/6, 0, pi*i/3, 5*pi*i/7, 1])`
```A = 0.2658 -1.0000 1.1547 1.0000 2.0000 -1.6039 0.6481```

Compute the hyperbolic secant function for the numbers converted to symbolic objects. For many symbolic (exact) numbers, `sech` returns unresolved symbolic calls.

`symA = sech(sym([-2, -pi*i, pi*i/6, 0, pi*i/3, 5*pi*i/7, 1]))`
```symA = [ 1/cosh(2), -1, (2*3^(1/2))/3, 1, 2, -1/cosh((pi*2i)/7), 1/cosh(1)]```

Use `vpa` to approximate symbolic results with floating-point numbers:

`vpa(symA)`
```ans = [ 0.26580222883407969212086273981989,... -1.0,... 1.1547005383792515290182975610039,... 1.0,... 2.0,... -1.6038754716096765049444092780298,... 0.64805427366388539957497735322615]```

### Plot Hyperbolic Secant Function

Plot the hyperbolic secant function on the interval from -10 to 10.

```syms x fplot(sech(x),[-10, 10]) grid on```

### Handle Expressions Containing Hyperbolic Secant Function

Many functions, such as `diff`, `int`, `taylor`, and `rewrite`, can handle expressions containing `sech`.

Find the first and second derivatives of the hyperbolic secant function:

```syms x diff(sech(x), x) diff(sech(x), x, x)```
```ans = -sinh(x)/cosh(x)^2 ans = (2*sinh(x)^2)/cosh(x)^3 - 1/cosh(x)```

Find the indefinite integral of the hyperbolic secant function:

`int(sech(x), x)`
```ans = 2*atan(exp(x))```

Find the Taylor series expansion of `sech(x)`:

`taylor(sech(x), x)`
```ans = (5*x^4)/24 - x^2/2 + 1```

Rewrite the hyperbolic secant function in terms of the exponential function:

`rewrite(sech(x), 'exp')`
```ans = 1/(exp(-x)/2 + exp(x)/2)```

## Input Arguments

collapse all

Input, specified as a symbolic number, variable, expression, or function, or as a vector or matrix of symbolic numbers, variables, expressions, or functions.

## Version History

Introduced before R2006a