New answers tagged

5 votes
Accepted

How to speed up numerical integration?

We can speed up with using precision and accuracy options. First, we compute without options for comparison. ...
  • 35.3k
2 votes

Speed up counting of digits in binary number

Please investigate how this technique fares in your application. Let's say: SeedRandom[1]; binSequence = RandomInteger[{0, 1}, 20] {1, 1, 0, 1, 0, 0, 0, 1, 0, 1, ...
  • 19.2k
10 votes

How is the zoom tooltip in the "Coordinates Tool" implemented?

Answering the first part of my question (thanks to Lukas Lang for pointing me in the right direction!). The source code for the Image Assistant Toolbar that appears when you select ...
13 votes

How is the zoom tooltip in the "Coordinates Tool" implemented?

Here's a proof-of-concept demonstration of how to build your own tooltip with reasonable performance: ...
  • 27.1k
6 votes

How to replace a multiple iterator Table to speed up computation

Set A=N[Range[2000]]; B=N[Range[0,Pi,Pi/10000.]]; I will compare ...
  • 7,383
5 votes

Speed up functions using variable types but not Compile

Here's a version that avoids the explicit conversion to binary digits and uses only bitwise operations: ...
  • 63.1k
2 votes
Accepted

Floating point precision and speed

Here's what I think I know. My impression is that I've "known" it for such a long time, I can't recall whether I "learned" it from documentation, Wolfram developers, or my own ...
  • 222k
5 votes
Accepted

Find all sets whose index is divisible by the elements

With some mathematical derivation, we can get a very simple formula. ...
  • 1,923
6 votes
Accepted

Find min and max indices of highest and lowest elements in sorted list

OP may want to use binary search. There are many posts here on Mathematica SE relating to binary search, including this which also contains compiled code. See also this. Code. To find the highest ...
  • 7,383
3 votes

Find min and max indices of highest and lowest elements in sorted list

...
  • 19.2k
7 votes

Find min and max indices of highest and lowest elements in sorted list

Graphical explanation of what I understood OP's wants: ...
  • 1,308
4 votes

Find min and max indices of highest and lowest elements in sorted list

What about last0 = Position[list1, 0][[-1, 1]] (* 562*) firstN = Position[list1, Nmax][[1, 1]](*17626*)
7 votes
Accepted

Faster minimization of $$\|I-x A B - x B A + x^2 A B A\|^2_F$$

The objective function is a polynomial of order 4 in x. Writing out its coefficients once, we can minimize it by finding its critical points and then taking the one ...
4 votes
Accepted

Speeding up RandomVariate with custom probability distribution

...
  • 126k
2 votes
Accepted

How to generate random value under the given distribution fast?

I suspect that you'll have to give up on "fast" for your un-normalized density function, as you'll need to normalize it numerically with specific values for ...
  • 35.5k
3 votes

Find all sets whose index is divisible by the elements

Here is another approach: ...
  • 55.3k
1 vote

Counting number of points in fluctuating lines that fall within a circle

EDIT: I've updated the answer to use BinCounts, which suits this problem in multiple ways. Most of the old description below applies to this solution, but here the ...
  • 15.6k
2 votes

Counting number of points in fluctuating lines that fall within a circle

Perhaps the cleanest way to find this distribution is with Nearest. I.e. ...
  • 3,099
1 vote

Counting number of points in fluctuating lines that fall within a circle

I might be very well not understanding the issue because with even 100,000 points obtaining the number of points within all possible radii doesn't seem to take much time: ...
  • 35.5k
0 votes

Counting number of points in fluctuating lines that fall within a circle

To keep things simple I give an example for just one radius. You may adapt it for several radii yourself. First we create the points and the circle according to your example: ...
  • 29.6k

Top 50 recent answers are included