Skip to main content
15 events
when toggle format what by license comment
Nov 28, 2020 at 3:06 comment added creidhne @user75507 - Riffle[list, x, {imin, imax, n}] creates a new list in which x appears if possible at positions imin, imin + n, imin + 2 n, ... , imax. Try va = Table[Subscript[a, i], {i, Range[5]}]; Riffle[va, x, {1, -3, 2}]. Riffle inserts x starting at position 1 and stops 3 positions from the end (the negative number says: count from the end of the list). When x is a list, Riffle uses items from the second list in place of x. With two identical lists, the result is the same as using Most@Riffle[list, list].
Nov 27, 2020 at 15:00 comment added user75507 Could you please explain that what does exactly these {1, -3, 2} numbers represents here ?
Nov 26, 2020 at 4:44 comment added kglr using the third argument of Riffle (Riffle[ActCoorX, ActCoorX, {1, -3, 2}]) seems faster for large lists. (+1)
Nov 26, 2020 at 4:38 history edited creidhne CC BY-SA 4.0
highlight the answer after comments
Nov 25, 2020 at 13:18 history edited creidhne CC BY-SA 4.0
include information from comments
Nov 25, 2020 at 13:04 comment added user75507 Yes. {x1, f[x1]}, {x1, f[x1]}, {x2, f[x2]}, {x2, f[x2]}, ... until the end without repeating the last item, this was the aim.
Nov 25, 2020 at 13:00 comment added creidhne @user75507 - do you want {x1, f[x1]}, {x1, f[x1]}, {x2, f[x2]}, {x2, f[x2]}, ... until the end without repeating the last item? Or do you want to remove the last item like your Table example?
Nov 25, 2020 at 12:54 comment added user75507 Most@Riffle[ActCoorX, ActCoorX] this works perfectly.thank you!!
Nov 25, 2020 at 12:53 comment added user75507 yes , but then there is no repeatation of coordinates here.
Nov 25, 2020 at 12:51 history edited creidhne CC BY-SA 4.0
clarify - the list items are not coordinates
Nov 25, 2020 at 12:47 vote accept user75507
Nov 25, 2020 at 12:42 history edited creidhne CC BY-SA 4.0
reply to comment
Nov 25, 2020 at 12:34 comment added user75507 Lets say i have , Table[{x, f[x]}, {x, 0, 12000, 595}]
Nov 25, 2020 at 12:33 comment added user75507 Can i use this Riffle with Table?
Nov 25, 2020 at 12:19 history answered creidhne CC BY-SA 4.0