Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica: Conditionals

  1. Feb 1, 2010 #1
    Hi all

    I'm am looking for a smart way to make the following conditional in Mathematica:

    Code (Text):
    if[i == 3*{1,2,3,4,5,N}, ....]

    ï.e. if the variable i is a multiple of 3 up to some integer N. How can I do this smartest in Mathematica?

  2. jcsd
  3. Feb 1, 2010 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Er, what are you asking?

    How to make a conditional statement? Check the documentation for If. (Or the guide section on programming)

    How to make a range of integers? Check the documentation for Table. (Or the guide section on lists and sequences)
  4. Feb 1, 2010 #3
    Ok, my answers were both answered looking at the documentation. Thanks.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook