RE: List operation, LabeledListPlot, Goto Statement
- To: mathgroup at smc.vnet.net
- Subject: [mg36750] RE: [mg36739] List operation, LabeledListPlot, Goto Statement
- From: "DrBob" <drbob at bigfoot.com>
- Date: Sun, 22 Sep 2002 04:32:35 -0400 (EDT)
- Reply-to: <drbob at bigfoot.com>
- Sender: owner-wri-mathgroup at wolfram.com
Oops! That should be individual1 = RandomPermutation[12] individual2 = RandomPermutation[12] cutPosition = 3; cutLength = 4; cutSequence = Take[Drop[individual1, cutPosition], cutLength] sonOne = DeleteCases[individual2, _?(MemberQ[cutSequence, #] &)] sonOne = RotateLeft[sonOne, 1] sonOne = Join[Take[ sonOne, cutLength - 1], cutSequence, Drop[sonOne, cutLength - 1]] Complement returns a sorted result, and you didn't want that. Bobby Treat -----Original Message----- From: DrBob [mailto:drbob at bigfoot.com] To: mathgroup at smc.vnet.net Subject: [mg36750] RE: [mg36739] List operation, LabeledListPlot, Goto Statement Here's an answer to Question 1: individual1 = RandomPermutation[12] individual2 = RandomPermutation[12] cutPosition = 3; cutLength = 4; cutSequence = Take[Drop[individual1, cutPosition], cutLength] sonOne = Complement[individual2, cutSequence] sonOne = RotateLeft[sonOne, 1] sonOne = Join[Take[sonOne, cutLength - 1], cutSequence, Drop[sonOne, cutLength - 1]] Bobby Treat -----Original Message----- From: Alexandre Costa [mailto:costa at fem.unicamp.br] To: mathgroup at smc.vnet.net Subject: [mg36750] [mg36739] List operation, LabeledListPlot, Goto Statement Dear Group, It is a pleasure write to you again. I have three questions to ask. Thanks for any enlightenment on these subjects. Alexandre Costa Question One: The below code is working fine but I think there are more elegant ways of doing so. Any suggestions are VERY WELCOME. << DiscreteMath`Permutations` individual1 = RandomPermutation[12] individual2 = RandomPermutation[12] CutPosition = 3 ; CutLength = 4 ; CutSequence = Take[Drop[individual1, CutPosition], CutLength] SonOne = individual2; Do[ If[MemberQ[SonOne, CutSequence[[i]]], SonOne = Delete[SonOne, Position[SonOne, CutSequence[[i]]]]], {i, 1, CutLength}]; SonOne SonOne = RotateLeft[SonOne, 1] Do[SonOne = Insert[SonOne, Reverse[CutSequence][[i]], CutPosition + 1], {i, 1, CutLength}] SonOne Question Two: How can I change points properties (such as Size and Color) for the plot below? The PlotStyle Option does not work for this LabeledListPlot << Graphics`Graphics` listcities = {{1, 5}, {4, 6}, {7, 5}, {5, 4}, {9, 4}, {2, 3}, {4, 2}, {6, 2}, {1, 1}, {5, 1}, {3, 0}, {9, 0}}; LabeledListPlot[listcities, Axes -> None, Frame -> True, GridLines -> Automatic, PlotRange -> All, DisplayFunction -> $DisplayFunction] Question Three: Why the Goto statement below is not working? q = 2; Label[start]; q = 3; Label[begin]; Print[q]; q += 1; If[q < 6, Goto[begin], Goto[start]]