« first day (435 days earlier)      last day (4050 days later) » 

6:46 AM
Is there a shortcut for doing something like: myList[[1]][[1]][[1]]?
(the thing I want to get is the first number in a nested list
 
7:43 AM
I have been observing relatively frequent front-end crashes on OSX with 9.0.1, especially when notebook has large amounts of images (for instance, couple hundred images in a list). Is this common, and are there any ways to make the front-end handle this issue more gracefully?
@soandos You could write a function that takes the first item from given argument when it's a list and calls itself, otherwise gives the first argument
I don't have Mma handy here, but something like FirstList[x_List] := FirstList[First@x]; FirstList[x_] := x;
 
8:06 AM
0
Q: Use of Mathematica StackExchange in Class

bill sI will be teaching a class in image processing in fall 2013, and will be using Mathematica as the primary computational tool. Hence I will be introducing 40-50 students to Mathematica, most of whom have extensive computer experience (in C, java, Matlab, python, etc.) but not in Mathematica. I hav...

 
8:22 AM
@soandos The same could be also implemented using NestWhile[First, x, Head@# === List &] ... (supposedly there's logic why there is no ListQ?)
 
8:36 AM
@soandos myList[[1,1,1]]
 
I wonder if the question was about arbitrary nesting level or just the simple case :)
 
@kirma If its always the first element then Flatten[myList][[1]] might do
 
@Matariki true, but flattening is "expensive" in contrast to extracting the first element. at least on long/deep lists.
 
Yup
 
 
5 hours later…
1:39 PM
is there a quick method (or maybe a list) of the complexity of mathematica functions ?
For example is Join[{1},{2}] faster than Union[{1},{2}] ?
 
1:58 PM
@DominicMichaelis The only consistent method I am aware of is experimentation. Use either Timing or AbsoluteTiming (and, no, I don't have a coherent rationale for one over the other) to measure. Likely, they're both input length dependent, so vary that as a paramater, in addition to number of inputs. My bet is Join is faster, as Union also sorts the result.
@MarkMcClure you may be right, and while W|A is likely the largest mma application in existence, I am of the opinion that we should be cautious on what we allow. Certainly, = plot sin (and more complex queries) should be allowed, but do we want questions along the lines of why does "mass of a cone of manganese 1.7 metres height 2.6 metres base radius" fail? Obviously, we can close them with prejudice, if need be, but I'm not sure if we should go there at all.
Hence, I urge caution. But, I am open to discussion.
 
 
1 hour later…
3:23 PM
@rcollyer I believe it's good guideline to assume that Mathematica doesn't exceed (known) limits of computation on Turing machines... :)
 
3:35 PM
posted on March 28, 2013 by Ed Pegg Jr

RootApproximant can turn an approximate solution into a perfect solution, such as for a square divided into fifty 45°-60°-75° triangles. A square can be divided into triangles, for example by connecting opposite corners. It’s possible to divide a square into seven similar but differently sized triangles or ten acute isosceles triangles. Classic puzzles involve cutting [...]

 
acl
4:01 PM
@rcollyer or, do we really want answers like "type use WA from inside mma" to be OK? I don't but it is something to discuss (admittedly it has, and the general conclusion was "no", but opinions change).
and I am not sure why WA is so important for mma. yes, the *Data functions and the = plot sin stuff depends on WA, but I think right now, and at least for me, these are even less important than the palettes (criticism of which people here thought was silly-I agree).
I mean, of course I've played with the downloadable data, but if all this was removed, I wouldn't even notice. similarly for the WA integration. does anybody really use mathematica like this? how?
I just can't picture how this would work.
 
4:18 PM
@acl yes, I agree. The data functions are nice in principle, but except for a few cases (e.g. PolyhedronData, GraphData) the fact that nobody knows where the data come from or how reliable they are is a big obstacle to using them for anything serious. As for W|A, I don't use it inside Mma at all, although the fact that you can use Mma to compose the result and tune the interpretation of queries is perhaps useful.
 
 
3 hours later…
7:10 PM
Could someone help me with something... I wanted to gather two lists in one, so I could the final result in ListPlot3D. For example, a = { {1,1,1}, {2,2,2} }; b = { {3,3,3}, {4,4,4} }; AppendTo[ a, b ]; But this gives me {{1, 1, 1}, {2, 2, 2}, {{3, 3, 3}, {4, 4, 4}}}
 
@fcpenha You should look up Join
 
Indeed
Thank you a lot
 
 
1 hour later…
8:39 PM
I have a big list of integer triplets tri, and I need to select those which only contain integers from a given set idx. What's the fastest way to do this?
Select[Sort /@ tri, Intersection[idx, #] === # &] is not particularly fast.
 
Have you tried just compiling it?
 
Doens't help much, but ignore the question. It was the wrong approach.
 
i just tried it, only 2x improvement :(
nice distraction from writing a proposal
 
8:57 PM
@Szabolcs My parser starts generating abstract syntax trees ;-)
 
Pick[tri, Times @@ (mask[[#]] & /@ Transpose[tri]), 1]; where mask is a list of 0s and 1s, the 1s corresponding to the positions of idx elements in Range[maxInteger].
 
 
2 hours later…
11:12 PM
@OleksandrR. When I remember right, then you had some knowledge about licenses and copyright notices?
 
@halirutan not really. :)
 
If I want to share code but keep it my property somehow.. what can one use.
@OleksandrR. Really, I thought you were the one who reads all license terms ;-)
 
@halirutan hmm, I never really considered that situation... I don't know what to suggest except for writing a licence with the terms you want
Worth noting is, that if you don't provide a licence, then you retain all rights by default
 
@OleksandrR. Maybe this all isn't important.
@OleksandrR. Ah, that's indeed good to know
 
It really depends what sort of rights you want to grant people in the code. Nobody can do anything with it unless you let them.
But, if you want to be sure they know where they stand, better to have a licence of some sort. Otherwise maybe you have to sue a lot of people for copyright infringement :)
 

« first day (435 days earlier)      last day (4050 days later) »