Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Solution with condition using range' topicStudent Support Forum > General > Archives > "Solution with condition using range"

Next Comment >Help | Reply To Topic
Author Comment/Response
Martin
08/11/12 12:34pm

Hi all

I'm new with mathematica, and I just started to use it.

I have a problem related to giving a condition for a certain range.

let say that I want to have a variable m1 where is m = 1 for x <100 and m = 2 for x>=100 where x is moving from 0 to 300.

What I do now is:
x = Range[0,300,50];
m = If[x<100,1,2]

I expect the result to be m = [1,1,2,2,2,2,2]
but what I get is If[{0, 50, 100, 150, 200, 250, 300} < 100, 1, 2]

which I don't understand why...

Can Anyone gives me help how to solve it?

URL: ,

Subject (listing for 'Solution with condition using range')
Author Date Posted
Solution with condition using range Martin 08/11/12 12:34pm
Re: Solution with condition using range yehuda 08/11/12 4:56pm
Re: Solution with condition using range Michael 08/11/12 6:57pm
Re: Solution with condition using range Bill Simpson 08/12/12 01:06am
Re: Re: Solution with condition using range Peter Pein 08/12/12 3:50pm
Re: Solution with condition using range Nasser M. Ab... 08/12/12 11:39am
Re: Solution with condition using range jf 08/12/12 2:20pm
Re: Solution with condition using range Martin 08/14/12 10:34pm
Next Comment >Help | Reply To Topic