Skip to main content
Tweeted twitter.com/StackMma/status/1006778024392609793
deleted 585 characters in body
Source Link
OkkesDulgerci
  • 10.9k
  • 1
  • 19
  • 40

I have a data as following. I want to add two random time points, one for birth one for death.

   data={{1, 10}, {1.06117, 11}, {1.21241, 12}, {1.33893, 13}, {1.41358, 14}, {2, 14}};

ListLinePlot[data, Mesh -> Full, MeshStyle -> {Red, PointSize[0.01]},
  Frame -> True, PlotTheme -> "Detailed", 
 FrameLabel -> {"Time", "Population"}, ImageSize -> Medium, 
 InterpolationOrder -> 0]

enter image description here

Here is one desired output

   data2={{1, 10}, {1.06117, 11}, {1.10169, 11}, {1.21241, 12}, {1.33893, 
  13}, {1.41358, 14}, {1.51463, 14}, {2, 14}};

ListLinePlot[{data, data2}, Mesh -> Full, 
 MeshStyle -> {Red, PointSize[0.01]}, Frame -> True, 
 PlotTheme -> "Detailed", FrameLabel -> {"Time", "Population"}, 
 ImageSize -> Medium, InterpolationOrder -> 0]

enter image description here

birth is added at {1.10169, 11} and death is added at {1.51463, 14}. I wanna keep both path, i.e. blue and yellow paths. Second path (yellow path ) must also start at {1,10} and finish at {2,14}. Population size can increase or decrease only by 1. Any idea?

Edit: Let me generalized the algorithm.

Given interval [i,i+1] ,in this case [1,2], we have 3 types of move (equal probability, 1/3 each ).

Choose one of the move.

  1. Type 1 move: Add 1 birth and 1 death randomly on the interval [1,2] which is done successfully by @Carl and @kglr.
  2. Type 2 move: Select 1 birth and 1 death from interval and remove them. If there is no birth, don't do anything, and similarly if there is no death, don't do anything.
  3. Type 3 move: Select 1 reaction time, birth OR death, and shifted somewhere else between [1,2]

I have a data as following. I want to add two random time points, one for birth one for death.

   data={{1, 10}, {1.06117, 11}, {1.21241, 12}, {1.33893, 13}, {1.41358, 14}, {2, 14}};

ListLinePlot[data, Mesh -> Full, MeshStyle -> {Red, PointSize[0.01]},
  Frame -> True, PlotTheme -> "Detailed", 
 FrameLabel -> {"Time", "Population"}, ImageSize -> Medium, 
 InterpolationOrder -> 0]

enter image description here

Here is one desired output

   data2={{1, 10}, {1.06117, 11}, {1.10169, 11}, {1.21241, 12}, {1.33893, 
  13}, {1.41358, 14}, {1.51463, 14}, {2, 14}};

ListLinePlot[{data, data2}, Mesh -> Full, 
 MeshStyle -> {Red, PointSize[0.01]}, Frame -> True, 
 PlotTheme -> "Detailed", FrameLabel -> {"Time", "Population"}, 
 ImageSize -> Medium, InterpolationOrder -> 0]

enter image description here

birth is added at {1.10169, 11} and death is added at {1.51463, 14}. I wanna keep both path, i.e. blue and yellow paths. Second path (yellow path ) must also start at {1,10} and finish at {2,14}. Population size can increase or decrease only by 1. Any idea?

Edit: Let me generalized the algorithm.

Given interval [i,i+1] ,in this case [1,2], we have 3 types of move (equal probability, 1/3 each ).

Choose one of the move.

  1. Type 1 move: Add 1 birth and 1 death randomly on the interval [1,2] which is done successfully by @Carl and @kglr.
  2. Type 2 move: Select 1 birth and 1 death from interval and remove them. If there is no birth, don't do anything, and similarly if there is no death, don't do anything.
  3. Type 3 move: Select 1 reaction time, birth OR death, and shifted somewhere else between [1,2]

I have a data as following. I want to add two random time points, one for birth one for death.

   data={{1, 10}, {1.06117, 11}, {1.21241, 12}, {1.33893, 13}, {1.41358, 14}, {2, 14}};

ListLinePlot[data, Mesh -> Full, MeshStyle -> {Red, PointSize[0.01]},
  Frame -> True, PlotTheme -> "Detailed", 
 FrameLabel -> {"Time", "Population"}, ImageSize -> Medium, 
 InterpolationOrder -> 0]

enter image description here

Here is one desired output

   data2={{1, 10}, {1.06117, 11}, {1.10169, 11}, {1.21241, 12}, {1.33893, 
  13}, {1.41358, 14}, {1.51463, 14}, {2, 14}};

ListLinePlot[{data, data2}, Mesh -> Full, 
 MeshStyle -> {Red, PointSize[0.01]}, Frame -> True, 
 PlotTheme -> "Detailed", FrameLabel -> {"Time", "Population"}, 
 ImageSize -> Medium, InterpolationOrder -> 0]

enter image description here

birth is added at {1.10169, 11} and death is added at {1.51463, 14}. I wanna keep both path, i.e. blue and yellow paths. Second path (yellow path ) must also start at {1,10} and finish at {2,14}. Population size can increase or decrease only by 1. Any idea?

deleted 2 characters in body
Source Link
OkkesDulgerci
  • 10.9k
  • 1
  • 19
  • 40

I have a data as following. I want to add two random time points, one for birth one for death.

   data={{1, 10}, {1.06117, 11}, {1.21241, 12}, {1.33893, 13}, {1.41358, 14}, {2, 14}};

ListLinePlot[data, Mesh -> Full, MeshStyle -> {Red, PointSize[0.01]},
  Frame -> True, PlotTheme -> "Detailed", 
 FrameLabel -> {"Time", "Population"}, ImageSize -> Medium, 
 InterpolationOrder -> 0]

enter image description here

Here is one desired output

   data2={{1, 10}, {1.06117, 11}, {1.10169, 11}, {1.21241, 12}, {1.33893, 
  13}, {1.41358, 14}, {1.51463, 14}, {2, 14}};

ListLinePlot[{data, data2}, Mesh -> Full, 
 MeshStyle -> {Red, PointSize[0.01]}, Frame -> True, 
 PlotTheme -> "Detailed", FrameLabel -> {"Time", "Population"}, 
 ImageSize -> Medium, InterpolationOrder -> 0]

enter image description here

birth is added at {1.10169, 11} and death is added at {1.51463, 14}. I wanna keep both path, i.e. blue and yellow paths. Second path (yellow path ) must also start at {1,10} and finish at {2,14}. Population size can increase or decrease only by 1. Any idea?

Edit: Let me generalized the algorithm.

Given interval [i,i+1] ,in this case [1,2], we have 3 types of move (equal probability, 1/3 each ).

Choose one of the move.

  1. Type 1 move: Add 1 birth and 1 death randomly on the interval [1,2] which is done successfully by @Carl and @kglr.
  2. Type 2 move: Select 1 birth and 1 death from interval and remove them. If there is no birth remove only 1 death, don't do anything, and similarly if there is no death remove only 1 birth, don't do anything.
  3. Type 3 move: Select 1 reaction time, birth OR death, and shifted somewhere else between [1,2]

I have a data as following. I want to add two random time points, one for birth one for death.

   data={{1, 10}, {1.06117, 11}, {1.21241, 12}, {1.33893, 13}, {1.41358, 14}, {2, 14}};

ListLinePlot[data, Mesh -> Full, MeshStyle -> {Red, PointSize[0.01]},
  Frame -> True, PlotTheme -> "Detailed", 
 FrameLabel -> {"Time", "Population"}, ImageSize -> Medium, 
 InterpolationOrder -> 0]

enter image description here

Here is one desired output

   data2={{1, 10}, {1.06117, 11}, {1.10169, 11}, {1.21241, 12}, {1.33893, 
  13}, {1.41358, 14}, {1.51463, 14}, {2, 14}};

ListLinePlot[{data, data2}, Mesh -> Full, 
 MeshStyle -> {Red, PointSize[0.01]}, Frame -> True, 
 PlotTheme -> "Detailed", FrameLabel -> {"Time", "Population"}, 
 ImageSize -> Medium, InterpolationOrder -> 0]

enter image description here

birth is added at {1.10169, 11} and death is added at {1.51463, 14}. I wanna keep both path, i.e. blue and yellow paths. Second path (yellow path ) must also start at {1,10} and finish at {2,14}. Population size can increase or decrease only by 1. Any idea?

Edit: Let me generalized the algorithm.

Given interval [i,i+1] ,in this case [1,2], we have 3 types of move (equal probability, 1/3 each ).

Choose one of the move.

  1. Type 1 move: Add 1 birth and 1 death randomly on the interval [1,2] which is done successfully by @Carl and @kglr.
  2. Type 2 move: Select 1 birth and 1 death from interval and remove them. If there is no birth remove only 1 death, and similarly if there is no death remove only 1 birth.
  3. Type 3 move: Select 1 reaction time, birth OR death, and shifted somewhere else between [1,2]

I have a data as following. I want to add two random time points, one for birth one for death.

   data={{1, 10}, {1.06117, 11}, {1.21241, 12}, {1.33893, 13}, {1.41358, 14}, {2, 14}};

ListLinePlot[data, Mesh -> Full, MeshStyle -> {Red, PointSize[0.01]},
  Frame -> True, PlotTheme -> "Detailed", 
 FrameLabel -> {"Time", "Population"}, ImageSize -> Medium, 
 InterpolationOrder -> 0]

enter image description here

Here is one desired output

   data2={{1, 10}, {1.06117, 11}, {1.10169, 11}, {1.21241, 12}, {1.33893, 
  13}, {1.41358, 14}, {1.51463, 14}, {2, 14}};

ListLinePlot[{data, data2}, Mesh -> Full, 
 MeshStyle -> {Red, PointSize[0.01]}, Frame -> True, 
 PlotTheme -> "Detailed", FrameLabel -> {"Time", "Population"}, 
 ImageSize -> Medium, InterpolationOrder -> 0]

enter image description here

birth is added at {1.10169, 11} and death is added at {1.51463, 14}. I wanna keep both path, i.e. blue and yellow paths. Second path (yellow path ) must also start at {1,10} and finish at {2,14}. Population size can increase or decrease only by 1. Any idea?

Edit: Let me generalized the algorithm.

Given interval [i,i+1] ,in this case [1,2], we have 3 types of move (equal probability, 1/3 each ).

Choose one of the move.

  1. Type 1 move: Add 1 birth and 1 death randomly on the interval [1,2] which is done successfully by @Carl and @kglr.
  2. Type 2 move: Select 1 birth and 1 death from interval and remove them. If there is no birth, don't do anything, and similarly if there is no death, don't do anything.
  3. Type 3 move: Select 1 reaction time, birth OR death, and shifted somewhere else between [1,2]
edited body
Source Link
OkkesDulgerci
  • 10.9k
  • 1
  • 19
  • 40

I have a data as following. I want to add two random time points, one for birth one for death.

   data={{1, 10}, {1.06117, 11}, {1.21241, 12}, {1.33893, 13}, {1.41358, 14}, {2, 14}};

ListLinePlot[data, Mesh -> Full, MeshStyle -> {Red, PointSize[0.01]},
  Frame -> True, PlotTheme -> "Detailed", 
 FrameLabel -> {"Time", "Population"}, ImageSize -> Medium, 
 InterpolationOrder -> 0]

enter image description here

Here is one desired output

   data2={{1, 10}, {1.06117, 11}, {1.10169, 11}, {1.21241, 12}, {1.33893, 
  13}, {1.41358, 14}, {1.51463, 14}, {2, 14}};

ListLinePlot[{data, data2}, Mesh -> Full, 
 MeshStyle -> {Red, PointSize[0.01]}, Frame -> True, 
 PlotTheme -> "Detailed", FrameLabel -> {"Time", "Population"}, 
 ImageSize -> Medium, InterpolationOrder -> 0]

enter image description here

birth is added at {1.10169, 11} and death is added at {1.51463, 14}. I wanna keep both path, i.e. blue and yellow paths. Second path (yellow path ) must also start at {1,10} and finish at {2,14}. Population size can increase or decrease only by 1. Any idea?

Edit: Let me generalized the algorithm.

Given interval [i,i+1] ,in this case [1,2], we have 3 types of move (equal probability, 1/3 each ).

Choose one of the move.

  1. Type 1 move: Add 1 birth and 1 death randomly on the interval [1,2] which is done successfully by @Carl and @kglr.
  2. Type 2 move: Select 1 birth and 1 death from interval and remove them. If there is no birth remove only 1 death, and similarly if there is no death remove only 1 birth.
  3. Type 23 move: Select 1 reaction time, birth OR death, and shifted somewhere else between [1,2]

I have a data as following. I want to add two random time points, one for birth one for death.

   data={{1, 10}, {1.06117, 11}, {1.21241, 12}, {1.33893, 13}, {1.41358, 14}, {2, 14}};

ListLinePlot[data, Mesh -> Full, MeshStyle -> {Red, PointSize[0.01]},
  Frame -> True, PlotTheme -> "Detailed", 
 FrameLabel -> {"Time", "Population"}, ImageSize -> Medium, 
 InterpolationOrder -> 0]

enter image description here

Here is one desired output

   data2={{1, 10}, {1.06117, 11}, {1.10169, 11}, {1.21241, 12}, {1.33893, 
  13}, {1.41358, 14}, {1.51463, 14}, {2, 14}};

ListLinePlot[{data, data2}, Mesh -> Full, 
 MeshStyle -> {Red, PointSize[0.01]}, Frame -> True, 
 PlotTheme -> "Detailed", FrameLabel -> {"Time", "Population"}, 
 ImageSize -> Medium, InterpolationOrder -> 0]

enter image description here

birth is added at {1.10169, 11} and death is added at {1.51463, 14}. I wanna keep both path, i.e. blue and yellow paths. Second path (yellow path ) must also start at {1,10} and finish at {2,14}. Population size can increase or decrease only by 1. Any idea?

Edit: Let me generalized the algorithm.

Given interval [i,i+1] ,in this case [1,2], we have 3 types of move (equal probability, 1/3 each ).

Choose one of the move.

  1. Type 1 move: Add 1 birth and 1 death randomly on the interval [1,2] which is done successfully by @Carl and @kglr.
  2. Type 2 move: Select 1 birth and 1 death from interval and remove them. If there is no birth remove only 1 death, and similarly if there is no death remove only 1 birth.
  3. Type 2 move: Select 1 reaction time, birth OR death, and shifted somewhere else between [1,2]

I have a data as following. I want to add two random time points, one for birth one for death.

   data={{1, 10}, {1.06117, 11}, {1.21241, 12}, {1.33893, 13}, {1.41358, 14}, {2, 14}};

ListLinePlot[data, Mesh -> Full, MeshStyle -> {Red, PointSize[0.01]},
  Frame -> True, PlotTheme -> "Detailed", 
 FrameLabel -> {"Time", "Population"}, ImageSize -> Medium, 
 InterpolationOrder -> 0]

enter image description here

Here is one desired output

   data2={{1, 10}, {1.06117, 11}, {1.10169, 11}, {1.21241, 12}, {1.33893, 
  13}, {1.41358, 14}, {1.51463, 14}, {2, 14}};

ListLinePlot[{data, data2}, Mesh -> Full, 
 MeshStyle -> {Red, PointSize[0.01]}, Frame -> True, 
 PlotTheme -> "Detailed", FrameLabel -> {"Time", "Population"}, 
 ImageSize -> Medium, InterpolationOrder -> 0]

enter image description here

birth is added at {1.10169, 11} and death is added at {1.51463, 14}. I wanna keep both path, i.e. blue and yellow paths. Second path (yellow path ) must also start at {1,10} and finish at {2,14}. Population size can increase or decrease only by 1. Any idea?

Edit: Let me generalized the algorithm.

Given interval [i,i+1] ,in this case [1,2], we have 3 types of move (equal probability, 1/3 each ).

Choose one of the move.

  1. Type 1 move: Add 1 birth and 1 death randomly on the interval [1,2] which is done successfully by @Carl and @kglr.
  2. Type 2 move: Select 1 birth and 1 death from interval and remove them. If there is no birth remove only 1 death, and similarly if there is no death remove only 1 birth.
  3. Type 3 move: Select 1 reaction time, birth OR death, and shifted somewhere else between [1,2]
added 561 characters in body
Source Link
OkkesDulgerci
  • 10.9k
  • 1
  • 19
  • 40
Loading
added 5 characters in body
Source Link
OkkesDulgerci
  • 10.9k
  • 1
  • 19
  • 40
Loading
Source Link
OkkesDulgerci
  • 10.9k
  • 1
  • 19
  • 40
Loading