# Am I not inside the domain ?

```
x=var('x')
f = Piecewise([[(0,pi/2),-1],[(pi/2,pi),2]])
plot(f(x),(x,0,pi))
```

**?

```
ValueError: Value not defined outside of domain.
```

?**

Am I not inside the domain ?

```
x=var('x')
f = Piecewise([[(0,pi/2),-1],[(pi/2,pi),2]])
plot(f(x),(x,0,pi))
```

**?

```
ValueError: Value not defined outside of domain.
```

?**

add a comment

1

Plotting a piecewise function is different to plotting 'normal' functions.

```
f = Piecewise([[(0,pi/2),-1],[(pi/2,pi),2]])
f.plot()
```

Asked: **
2014-11-11 01:33:58 -0500
**

Seen: **95 times**

Last updated: **Nov 12 '14**

Piece-wise functions and plotting

Determine domain and range of linear equation?

Substitute piecewise function variable

desolve_rk4 cannot handle a piecewise function

Coercion problem while defining piecewise function

Integrate piecewise function with change of variable

Is there a way to relabel the domain of a permutation group?

plot issue with a self-defined piecewise function

Plot every piece of a piecewise defined function in another color?

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.