Skip to main content
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
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
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 not deleted user 5033

Questions on optimizing Mathematica code for higher performance. This may mean faster execution, lower memory usage or both. Not to be confused with mathematical optimization.

11 votes
2 answers
2k views

Why is ParallelMap way slower than Map

I recently tried to use ParallelMap instead of Map and to my surprise encountered that ParallelMap seems to be slower in general than Map, which does not make sense to me. Here is a simple test case …
Wizard's user avatar
  • 2,740
7 votes
1 answer
531 views

MapThread Alternatives

I want to add two matrices, the first one containing a 2D vector at each position the other one a list of 2D vectors. The 2D vector from the first matrix should be added to each of the 2D vectors at t …
Wizard's user avatar
  • 2,740
6 votes
Accepted

Alternative for MapThread in listable functions

It is actually pretty simple. Just make the outmost function, i.e. flo in your case Listable, which you have already done in your first code snippet: dem = Compile[{{p1, _Real, 0}}, Min[100 p1, 2500] …
Wizard's user avatar
  • 2,740
5 votes
1 answer
310 views

MapThread and Compile

After discovering that MapIndexed cannot be used with compile (see MapIndexed and Compile) I am now trying do implement similar functionality using a combination of MapThread and Map. Unfortunately I …
Wizard's user avatar
  • 2,740
4 votes
1 answer
125 views

Strange behavior of Mathematica regarding calculation time

Today I witnessed the following strange behavior of Mathematica, when it comes to calculation time involving larger nested lists. The following is the short example that I setup, I am sure one can rep …
Wizard's user avatar
  • 2,740
3 votes
Accepted

Maximising area of intersection of regions

This seems to be an issue with symbolic evaluation. When I run your code in Mathematica 11, I get the following message: Message[RegionMeasure::nmet, RegionIntersection[ImplicitRegion[25 < x^ …
Wizard's user avatar
  • 2,740
3 votes

Integrate over Piecewise function efficiently

First thing I would note is that you should Integrate the function analytically before plotting it. To do so you should add your assumptions like already commented by other users (note that it is impo …
Wizard's user avatar
  • 2,740