Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 57

Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.

8
votes
You were very close. All it takes is turning your function to be mapped into a pure function: Map[lexicalRules[grammarTerminal, #] &, words] (* {{{D, "the"}}, {{N, "man"}}, {{V, "hit"}}, {{D, "the"}} …
answered Dec 12 '15 by Sjoerd C. de Vries
17
votes
Just to show that there are always a zillion ways to do things in Mathematica, here is my version. Actually, I myself would have used Flatten and its mind-shattering second argument after having learn …
answered Mar 28 '12 by Sjoerd C. de Vries
12
votes
list = {1, 2, 2, 3}; (Ordering@Ordering@# + Reverse@Ordering@Ordering@Reverse@#)/2 &@list {1, 5/2, 5/2, 4} As requested, here as a function: rank[list_] := (Ordering@Ordering@list + Reverse@O …
answered Sep 28 '13 by Sjoerd C. de Vries
13
votes
In version 10.0 you have DisjointQ (and conversely IntersectingQ) to test this. 10.2 adds the Contains* family of function with ContainsNone being equivalent to DisjointQ. For earlier versions you cou …
answered Jul 6 '15 by Sjoerd C. de Vries
2
votes
Outer[List, {1, 2, 3}, {4, 5, 6}, 1] (* {{{1, 4}, {1, 5}, {1, 6}}, {{2, 4}, {2, 5}, {2, 6}}, {{3, 4}, {3, 5}, {3, 6}}} *)
answered Jul 8 '16 by Sjoerd C. de Vries
6
votes
In my timings with a=Range[100000] ++a[[-1]] a[[-1]] += 1 a[[-1]] = a[[-1]] + 1 and ++a[[100000]] a[[100000]] += 1 a[[100000]] = a[[100000]] + 1 all evaluate in the same time.
answered Dec 7 '15 by Sjoerd C. de Vries
1
vote
RandomChoice[Flatten[Position[{1, 2, 2, 2, 1, 1, 2, 2, 1, 2, 2, 2, 1}, 1]]]
answered Jan 19 '14 by Sjoerd C. de Vries
0
votes
First, you should know that you don't need Normal to index the LeviCivitaTensor: LeviCivitaTensor[3][[1, 2, 3]] (* 1 *) Now to your first problem. This can be solved with Apply (shorthand form @@): …
answered Jun 7 '15 by Sjoerd C. de Vries
21
votes
A combination of Map and MapAt perhaps? Map[MapAt[f, #, 1] &, A, {2}] (* ===> {{{f["15"], "CG"}, {f["391"], "CG"}, {f["412"], "CC3"}}, {{f["3"], "CG"}, {f["16"], "CG"}, {f["392"], "CG"}}} …
answered May 18 '12 by Sjoerd C. de Vries
1
vote
It is not entirely clear what you want, especially with the requirement that i−1<x<i with x integer. There is no integer that will fit between two successive integers, so I shall take it you intended …
answered Oct 8 '15 by Sjoerd C. de Vries
8
votes
data = {{-3 a, 3 a}, {-a, a}, {-a, a}, {-a, a}}; rm-rf's comment: data /. {a_, b_} :> a^2 + b^2 {18 a^2, 2 a^2, 2 a^2, 2 a^2} Power is Listable, meaning: data^2 {{9 a^2, 9 a^2}, {a^2, …
answered May 15 '13 by Sjoerd C. de Vries
17
votes
One solution that is three to four times as fast as the fastest solution so far (halirutan's compiled Do loop) is: data[[Ordering[data[[All, 2]], 1], 1]] The obligatory timings: MinimalBy[data, L …
answered Jun 22 '15 by Sjoerd C. de Vries
2
votes
Bill s' answer is fully correct, but just in case you insist on using a pass by reference, you could do it by adding a single line to your code: SetAttributes[FindRootsOfResult, HoldRest]; FindRoots …
answered Apr 30 '13 by Sjoerd C. de Vries
1
vote
e = {0.129454, 0.160294, 0.140456, 0.152359, 0.174006, 0.186969}; w = {2.12373*10^-6, 0.00029488, 5.68648*10^-6, 0.000100244, 2.28126*10^-6, 6.74131*10^-6}; Total /@ (BinLists[e, {0.12, .22, 0.03}] / …
answered Jun 26 '14 by Sjoerd C. de Vries
3
votes
(* generate some example data *) data = RandomInteger[{1, 100}, {100, 5}]; (* find quantiles of the kth column; must include the zeroth quantile, but not the upper limit (1) *) k = 1; quants = …
answered May 28 '15 by Sjoerd C. de Vries

15 30 50 per page