Message Boards Message Boards

0
|
2254 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Problems with Piecewise function

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.

POSTED BY: Dezső Babai
2 Replies
Anonymous User
Anonymous User
Posted 4 years 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
Posted 4 years 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}}]
POSTED BY: Rohit Namjoshi
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