# math – How do you input piecewise functions into wolfram alpha?

## math – How do you input piecewise functions into wolfram alpha?

As @ogerard has pointed out you can often input Mathematica expressions to Wolfram Alpha. In your case you may be interested in the `SquareWave`

function. For example, the expression

```
Plot[2.5 + 2.5 (SquareWave[x/(2 [Pi])]), {x, -1, 6}]
```

produces the plot

which, rather unhelpfully, obscures half the graphic along the x-axis.

In your case, it is easy to build your driving function from elementary ones, such as integer part and modulo.

Also with Wolfram Alpha, you can use Mathematica notation to be explicit.

To visualize your function f, just try

```
5 *Mod[Ceiling[x/Pi], 2]
```

or

```
5 ceiling(x/pi) mod 2
```

in Wolfram Alpha.

By entering

```
plot | 5 ceiling(x/pi) mod 2 | x = -3 pi to 3 pi
```

You will get something like this: