1 | initial version |

Ok, this should work.

```
sage: f = lambda k: Piecewise([[(-2,1),k],[(1,4),x]])
sage: P = plot(f(5))
sage: show(P)
KeyboardInterrupt
sage: A = animate([plot(f(k)) for k in [0..10]])
sage: show(A)
```

Hopefully something similar would work in an interact...

If you've never seen them, then lambda functions are mysterious, but it turns out useful for exactly this kind of thing.

I think this is probably the only reasonable way to do it, since piecewise functions automatically treat any variable in them as the function inside.

```
sage: var('y,z')
(y, z)
sage: g = Piecewise([[(-2,1),y^2],[(1,4),-z^2]])
sage: plot(g)
```

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.