1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica,Pattern matching and ReplaceRepeated.

  1. Apr 21, 2012 #1
    1. The problem statement, all variables and given/known data

    Given a list of integers, use pattern matching and //.to create a rule that generates an ordered list of integers that are larger than the previous numbers in the list, eg given {3,5,2,0,6,1,8,4,9}, you should get {3,5,6,8,9}

    2. Relevant equations



    3. The attempt at a solution

    Well calling our arbitrary list L, I tried
    rules={___,x_,y_,___}/;x>y :→{___,x,___}; then
    L //. rules . From this I just get {5}?
    I haven't used pattern matching alot, so what else am I meant to do?
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?



Similar Discussions: Mathematica,Pattern matching and ReplaceRepeated.
  1. Mathematica Hw (Replies: 0)

  2. Mathematica plot (Replies: 0)

Loading...