Linked Questions

6
votes
2answers
170 views

Achieve performance that is competitive with numpy [duplicate]

What are the best practices to ameliorate time performance of Mathematica? As a practical example how we can decrease timing below? ...
-1
votes
2answers
758 views

MATLAB's “logical indexing” in Mathematica [duplicate]

...
2
votes
2answers
108 views

Threshold elements in a table [duplicate]

I'm new to Mathematica. I hope this is not a too stupid question, but I couldn't find a solution in the Mathematica documentation. My question is about creating a function to iterate over the ...
1
vote
1answer
126 views

Is there a cleaner/shorter way to select-replace in matrices? [duplicate]

I love Mathematica, but I find it oddly lacking when it comes to how matrices are handled. Here is an example of code that works but seems like it should be a lot shorter (and minus the loop). I'm ...
1
vote
1answer
111 views

An equivalent in Mathematica [duplicate]

Let's say I have a $n$x$m$ matrix $M$ in Matlab and I want to substitute the elements of $M$ that exceed $15$ for $-1$. In Matlab I just write M(M>15)=-1 and ...
1
vote
1answer
56 views

Choosing data from list and plot [duplicate]

I have a data set like below: Angle={5.48575, -0.669213, 45.9832, 8.63878, -16.8777, 50.022, -41.8882, -45.956, 28.3005, 35.8234} Now want to select the ...
131
votes
8answers
8k views

Can one identify the design patterns of Mathematica?

... or are they unnecessary in such a high-level language? I've been thinking about programming style, coding standards and the like quite a bit lately, the result of my current work on a mixed .Net/...
12
votes
6answers
2k views

Element-wise test on List elements

This question could sound pretty silly but I can't find a way to apply element -wise tests to a list. For example if I digit ...
9
votes
6answers
807 views

Sierpinski carpet with GraphData

Is this graph in the list among the so-called "standard" structures used in GraphData? However, I have not found yet anything like "Carpet" or "Sponge" in the list ...
115
votes
1answer
2k views

Why are numeric division and subtraction not handled better in Mathematica?

There is something that has been troubling me for a while. At least through version 10.0 the performance of a / b and a - b is ...
24
votes
3answers
1k views

Emulating R data frame getters with UpValues

What's the best way to emulate R's data frames functionality? This includes the ability to select rows and columns in a 2-dimensional table by the string identifiers positioned typically in the first ...
10
votes
3answers
2k views

Why is ParallelTable slower than Table?

Update Following a comment of Szabolcs have changed Timing to AbsoluteTiming. The results are virtually the same. Original post I have accidentally observed the following surprising result. So, why ...
16
votes
3answers
730 views

Select seems unusually slow

I haven't been doing nearly as much Mathematica as I really should for the past few months, and in order to get my head back in the game I've been using it to run roughshod over easy Project Euler ...
8
votes
4answers
503 views

Speed of a simple operation over a long list

What is the fastest procedure for counting elements smaller than 0.5 in a large list? For example let list=RandomReal[1, 10000000]; For a number of elements ...
6
votes
4answers
243 views

Concise alternative to First@First@Position[…, 1,Heads->False]

Is there a more compact way to accomplish this: lst = {0,0,7}; idx = Position[lst, Except[0], 1, Heads -> False] // First // First (* => 3 *) For ...

15 30 50 per page