Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'Possible bug in unitstep function' topicStudent Support Forum > General > Archives > "Possible bug in unitstep function"

Next Comment >Help | Reply To Topic
Author Comment/Response
07/30/10 05:46am


I'm fairly new to Mathematica, so maybe I'm misinterpreting something here.

The UnitStep[x] Function is defined as
=0 if x < 0 and
=1 if x >= 0

My code is rather simple:

f := UnitStep[(0.5*Abs[x] - Abs[(y - x)])]
a = f[x = 1.0, y = 1.61]

which gives me: 0[1., 1.61] (correct)

but when I type now:
a = f[x = 1.0, y = 1.3]
it gives me: 0[1., 1.3] (incorrect)

Re-evaluating this line gives me: 1[1., 1.3] (correct).
Another re-evaluation gives me again: 1[1., 1.3]

And that's why I'm confused. How is it possible that the same function with the same arguments can have two different values!? And why is the result only incorrect for the first evaluation?

My Mathematica version is and I'm using Windows 7.

Thanks for any suggestions!

URL: ,

Subject (listing for 'Possible bug in unitstep function')
Author Date Posted
Possible bug in unitstep function Nils 07/30/10 05:46am
Re: Possible bug in unitstep function yehuda ben-s... 08/03/10 01:35am
Re: Re: Possible bug in unitstep function Nils 08/05/10 4:00pm
Next Comment >Help | Reply To Topic