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?

    Best,
    Niles.
     
  2. jcsd
  3. Feb 1, 2010 #2

    Hurkyl

    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook