Tag Info

Hot answers tagged

16

This method only returns a few of them, hopefully including some undocumented ones. It's not intended to be a complete answer. fnames = FileNames[ "*.nb" | "*.tr", {FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "StyleSheets"}], FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "TextResources"}], ...


13

I got a request to post here the undocumented tokens I already posted in an old answer on SO. For completion, I merged my list (which is also in the link provided by @Chris) with @Rojo's list, so to have here a repository of all known FE tokens. Please feel free to update this answer as new tokens are found. { {"AlignBottoms"}, ...


10

There is a list posted in 2009 from John Fultz on the MathGroup here. No version information. Rojo's list has some new ones. Length@RojosList 56 Length@JohnsList 266 Length@Intersection[RojosList, JohnsList] 35


8

The code given by Rojo and sunt05 is almost surely the cleanest: Cases[Tally @ list, {x_, 4} :> x] However, here are some other possibilities: Cases[Split @ Sort @ list, {x_, _, _, _} :> x] Cases[Split @ Sort @ list, {Repeated[x_, {4}]} :> x] Cases[Last @ Reap[Sow[1, list], _, {#, Tr@#2} &], {x_, 4} :> x] Module[{c}, c[_] = 0; ...


7

Something like v /. Dispatch[Thread[both[[All, 1]] -> both]] should operate much faster, especially on large lists. Surround with something like cases, e.g., Cases[v /. Dispatch[Thread[both[[All, 1]] -> both]], {{__}, _}] For only "changed" to be in list. Many, many ways to do this, btw... e.g., if the output desired is always in order of both ...


6

Is this what you are looking for? data = {b (a/bc t)^r, a/b (b t)^r, a (c/d t)^r}; sums = data /. Power[x_, r] -> x/(1 - x) $\left\{\frac{a b t}{\text{bc} \left(1-\frac{a t}{\text{bc}}\right)},\frac{a t}{1-b t},\frac{a c t}{d \left(1-\frac{c t}{d}\right)}\right\}$


3

This is an easy application of Gather and replacement rules. Assuming your two lists are: list1 = {{a, b, c, {d, e, f}, g, h}, {l, m, n, {o, p, q}, r, s}, {u, v, w, {x, y, z}, a, b}}; list2 = {{a, b, c, {d, e, f}, i, j}, {u, v, w, {x, y, z}, d, e}}; then you can join them as desired with Gather[list1 ~Join~ list2, #1[[;; 4]] == #2[[;; 4]] &] /. ...


3

I propose two different solutions with comparable speed. Some input set n = 20; SeedRandom[0]; L = Sort[RandomSample[Subsets[Range[n], {2}], RandomInteger[{1, Binomial[n, 2]}]]]; Length[L] 168 The main idea: let's recursively look for all possible non-duplicated subsets and count them. It is relatively fast and it does not require a lot of ...


3

Usually, there are efficiency advantages to generating all of your random numbers in one go, but in this instance, it makes little difference if you generate all in one go, or in tuples of 5 (million of times). I am not sure what you are doing with them, but usually one is doing something like computing a sample mean, or adding them up or similar: ALL IN ...


2

Posting this because I was a but surprised by the result.. n = 10^6 Last@Last@Reap[Do[ Sow[2 i + j - 2], {i, n}, {j, 2}]] == Range[2 n] // Timing -> {3.307221, True} Table[Unevaluated@Sequence[2 i + 1 - 2, 2 i + 2 - 2], {i, n}] == Range[2 n] // Timing -> {1.918812, True} Flatten@Table[ 2 i + j - 2, {i, n}, {j, 2}] == Range[2 n] // Timing -> ...


2

Here is a fairly general solution for the infinite sum of a real geometric term in an arbitrary variable var from var = n0 to Infinity. There may be some expressions involving special functions that can be simplified to a geometric term that Simplify might miss, and the use of PowerExpand may be omitted if Complex bases are to be used. It was included here ...


1

I present this for illustrative purposes. Here is a toy data set: samp = RandomReal[{23, 32}, 365 8 ]; This is just 365 days of 8 samples per day. You can get daily mean using: Mean /@ Partition[samp, 8]; You can visualize by just wrapping in ListPlot and with option Joined->True: You can also use TemporalData: td = TemporalData[samp]; td2 = ...



Only top voted, non community-wiki answers of a minimum length are eligible