New answers tagged

8

The main difference can been seen when dealing with list of lists. Consider the following list: lis = {{1, 2, 3}, {3, 4, 5}, {5, 6, 7}}; Lets create a Listable function g SetAttributes[g, Listable] Now we Map a non-listable function f and apply the listable function g Map[f, lis] (* {f[{1, 2, 3}], f[{3, 4, 5}], f[{5, 6, 7}]} *) g[lis] (* {{g[1], ...


2

One possibility is to plot the trajectories using StreamPlot: b = 0.8; StreamPlot[{-y + 2 x^2, b x}, {x, -3, 3}, {y, -1, 3}] And here you can scan through plots for different values of b: Manipulate[StreamPlot[{-y + 2 x^2, b x}, {x, -10, 10}, {y, -10, 30}], {b, 0, 1}]


3

I think you are looking for something like this: ordered = {#[[1]], StringRiffle@sort[StringSplit@#[[2]], weights]} & /@ needsreorder Export["ordered50parts.csv", ordered] (*{{"PARTNUM", "DESC"}, {"DUK175189", "Blower Hose 14"}, {"ROU4060436", "Halogen Lamp 100 120 Volt Watt"}} *)


2

Turning my comment into an answer: ClearAll[MapAccumulate]; MapAccumulate[f_, list_List] := f@Take[list, #] & /@ Range@Length@list; Now you can do stuff like this: MapAccumulate[Mean, mylist]


2

Aye carumbah - new versions lis = {x1, x2, x3, x4}; • Sol1: FoldList[Append, {}, lis] // Rest {{x1}, {x1, x2}, {x1, x2, x3}, {x1, x2, x3, x4}} • Sol2: sol = FoldList[Join, lis] /. Join->List {x1, {x1, x2}, {x1, x2, x3}, {x1, x2, x3, x4}} One can then Map any desired function, e.g. Map[Mean, sol] Above work for numerical versions ...


4

continentalcities = CityData[{Large, "UnitedStates"}] /. {_, "Alaska" | "Hawaii", _} :> Sequence[]; coords = Map[GeoGridPosition[GeoPosition[#], "Mercator"][[1]]&, {CityData[#, "Coordinates"] & /@ continentalcities}, {2}]; statestocolors = Thread[CountryData["UnitedStates", "Regions"] -> ColorData["GeologicAges", ...


3

set1 = {{38.9, -77.03}, {38.9, -87.03}}; set2 = {{36.9, -77.03}, {33.9, -87.03}}; Graphics[#, AspectRatio -> 0.65] &@{Gray,CountryData["USA", "Polygon"], Pink, PointSize[0.01], Point[GeoPosition[set1]], Green, Point[GeoPosition[set2]]} I'm not sure about aspect ratio... I cannot check MMA 8.0, but this should work for you Graphics[{Gray, ...



Top 50 recent answers are included