Message Boards Message Boards

GROUPS:

Problems with Piecewise function

Posted 6 months ago
618 Views
|
2 Replies
|
0 Total Likes
|

Hey guys, I have the following function

f[x_, y_ ] = 
 Piecewise[{{x^2/y^(-4)*Exp[-(x^2/y^(-4)], y !=  0}, {0,y = 0}}]

Mathematica's output is just a simple 0. For an unknown reason Mathematica "thinks" that y=0. Anybody an idea how I could fix this? I have honestly no idea where the problem could be.

2 Replies
Anonymous User
Anonymous User
Posted 6 months ago

I see a typo in the post. Does this work for you?

Piecewise[{{x^2/y^(-4)*Exp[-(x^2/y^(-4))], y != 0}, {0, y == 0}}]
POSTED BY: Anonymous User
Answer
Posted 6 months ago

Hi Dezső,

Because of the y = 0 in the second condition. Should be y == 0. There is a ) missing in the expression above. Also better to use SetDelayed rather than Set. Please check that I added the ) in the right place.

f[x_, y_] := Piecewise[{{x^2/y^(-4)*Exp[-(x^2/y^(-4))], y != 0}, {0, y == 0}}]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract