# defining multivariate piecewise function

I need to define some function like `f(x,y) = x * sin(y)/y if y != 0, x otherwise`

, such that `f`

can be differentiated. Is there a way to do so? Thanks!

defining multivariate piecewise function

`f(x,y) = x * sin(y)/y if y != 0, x otherwise`

, such that `f`

can be differentiated. Is there a way to do so? Thanks!

add a comment

1

`piecewise`

currently only supports a single variable, but in your case you could factor out the `x`

and define

```
f(x,y) = x * piecewise([[(-oo,0), sin(y)/y], [[0,0], 1], [(0,oo), sin(y)/y]])
```

The square brackets around the origin denote a closed domain to ensure that point is included.

Asked: **
2017-02-11 07:24:14 -0600
**

Seen: **186 times**

Last updated: **Feb 11 '17**

Piecewise Symbolic Function with Conditional Statement

How do I define a piecewise function?

How to declare variable for a function with other variable?

plot issue with a self-defined piecewise function

automatic substitution within functions?

Define vector valued function of a vector of symbolic variables?

Display x-intercept of a plot, involving x raised to the 3rd power.

def f(x): evaluvates individually but not inside plot

How to evaluate polynomial in a polynomial ring at a particular value

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.