Recent content by Sarah rob

  1. S

    Mathematica Mathematica: Position of elements in a list

    Thanks for that SredniVashtar with regards to position I need to make some kind of rule for n, I tried liss = 7 - li to get {-11, -15, 3, -3} But I come up with difficulties because if I had 11 -li which gives me {-7, -11, 7, 1} I need to find the position of the smallest positive number
  2. S

    Mathematica Mathematica: Position of elements in a list

    If I have a list say li = {18, 22, 4, 10} and I want to add for example 7 to this list Join[li, {7}] to get {18, 22, 4, 10, 7}, can I insert the 7 after the 4, to get {18, 22, 4, 7, 10}, I can't just use Sort[ {18, 22, 5, 10, 7}] as I don' t want to change the order of the whole list?
  3. S

    Mathematica Can I Create a Pattern with Alternating 1's and 0's in Mathematica?

    I am using co = 0; co++ If[Mod[co, 20, 1] > 10, 1, 0]; which is used in an iterative function which produces 10 1' s 10 0' s, 10 1' s 10 0' s and so on ... Could I use a similar method to produce 10 1' s then 5 0' s, 10 1's 5 0' s and so on...
  4. S

    If I have a list that contains 16 sublist (enclosed in 2 curly

    Sorry, didn't make it very clear sublist 1 = {{1, 1}, {1, 5}, {1, 8}} sublist 2 = {{2, 6}, {1, 10}, {0, 12}} ... so I want a new list that will be {sublist 1,sublist 2,sublist 3,sublist 4,sublist 9,sublist 10, sublist 11,sublist 12} And another {sublist 5,sublist 6,sublist 7,sublist...
  5. S

    If I have a list that contains 16 sublist (enclosed in 2 curly

    If I have a list that contains 16 sublist (enclosed in 2 curly bracets), L1 = {{{1, 1}, {1, 5}, {1, 8}}, {{2, 6}, {1, 10}, {0, 12}}, {{3, 2}, {1, 4}, {0, 15}}, {{1, 8}, {1, 14}, {2, 17}}, {{1, 2}, {2, 8}, {3, 12}}, {{2, 6}, {2, 11}, {2, 18}}, {{3, 6}, {1...
  6. S

    Mathematica Can You Exclude a Specific Number When Generating Random Numbers in Mathematica?

    I am trying to create a list of 5 random numbers between 1 and 20 In[62]:= RandomInteger[{1, 20}, 5] Out[62]:= {10, 11, 9, 8, 1} But is it possible to exclude the number 10 from appearing?
  7. S

    Mathematica Mathematica: Reversing sublist

    lis= {{{2, 1}, {3, 2}, {8, 2}}, {{9, 6}, {1, 0}, {0, 2}}} I am trying to reverse the subsublist so {2,1} becomes {1,2}, {3,2} becomes {2,3}... I have tried Map[Reverse, Flatten[lis, 1]] but this creates {{1,2},{2,3},{2,8},{6,9},{0,1},{2,0}} which erases my sublist Is there a way I...
  8. S

    Mathematica Create a Colorful Plot with Mathematica's ListPlot Function"

    If I have a list; list={ {{1, 2}, {1, 3}, {1, 5}}, {{2, 2}, {2, 4}, {2, 1}}, {{3, 3}, {3, 5}, {3, 2}} } and want to plot it using ListPlot[list] Is it possibe to colour all the 1st pairs of the list e.g. {1,2}, {2,2}, {3,3} blue, {1,3}, {2,4},{3,5} green and {1,5}, {2,1}, {3,2} red using...
  9. S

    Mathematica Mathematica: Iterating with 2 Lists

    If I have 2 list which are made up of pairs of numbers e.g. list1 = {{4, 5}, {2, 10}, {0, 15}} list2 = {{5, 2}, {3, 7}, {1, 12}} is there a way I can apply a function (that I have already created, f[x_]) on the lists which runs for e.g. 5 iterative steps with list1 then apply the same...
  10. S

    Mathematica Mathematica: If statment for lists

    I want to create an If statement that states; if the elements in, list1>0 , true subtract list2, false keep value from list1 so that i end up with ans: {0,2,5,4} list1 = {0, 2, 8, 9} list2 = {1, 0, 3, 5} I don't know how to represent the elements in the lists so that my If statement works
  11. S

    Mathematica Mathematica:Plotting an iterative list on one graph

    { {{1, 2}, {1, 3}, {1, 5}}, {{2, 2}, {2, 4}, {2, 1}}, {{3, 3}, {3, 5}, {3, 2}} } Is it possibe to colour all the 1st terms of the list e.g. {1,2}, {2,2}, {3,3} blue, {1,3}, {2,4},{3,5} green and {1,5}, {2,1}, {3,2} red using PlotMarker or a simular function Also, can i find the mean of...
  12. S

    Mathematica Mathematica:Plotting an iterative list on one graph

    Thank you CompuChip Can I change the y-axis so that it goes (bottom to top) from say 3 to 0 rather that the usual 0 to 3
  13. S

    Mathematica Mathematica:are nonrepeatative random numbers possible?

    I am trying to create 2 list of random numbers of the same length The 1st list random list i can do RandomIntegerRandomInteger[{1, 7}, 10] to get {6, 5, 4, 7, 2, 1, 5, 5, 2, 6} the 2nd list however i want 10 numbers from 1-30 that are all different and in order, what do i need to add to...
  14. S

    Mathematica Mathematica:Plotting an iterative list on one graph

    Hi i want the x -axis to go from 1 to 5, then plot the 2nd element of each pair, (so that they appear in a horizontal row ) for lis = {{4, 2}, {1, 3}, {2, 5}} I' ve been playing around with ListPlot and using it with Map[Last, lis] but not getting what i want my goal is to repeat...
  15. S

    Mathematica Mathematica:Iteration of pairs in a list

    Thanks for that. Using one of the codes you suggested, is there a way to implement it with initial conditions, so starting with pairs of nuumbers and applying a function to all the 1st elements and another function to and the 2nd elements in the list.
Back
Top