# Tag Info

Accepted

### 3D tree in Mathematica?

First, an idomatic, but slow version. ...
Accepted

### Solving "Resistance between two nodes on a grid" problem in Mathematica

In addition to Carl Woll's post: Computing the pseudoinverse of a the graph Laplacian matrix (a.k.a. the KirchhoffMatrix) is very expensive and in general leads to ...
Accepted

### Image segmentation by pixel value

Update: If you want 4-neighborhood, you can use MorphologicalComponents to do most of the work, which is fast and easy to implement (that was my original attempt, ...
• 36.2k
Accepted

### Quick QuickSort implementation

I also got angry about those randomly picked and ill-implemented benchmarks by the Julia team. I appreciate their efforts (jit compilers are useful), but the Fibonacci example was straight away ...

### Solving "Resistance between two nodes on a grid" problem in Mathematica

Based on rcampion2012's answer to Efficient Implementation of Resistance Distance for graphs?, you could use: ...
• 131k
Accepted

### The most efficient algorithm to find all possible integer pairs which sum to a given integer

I think IntegerPartitions[m, {2}, listOfIntegers] does exactly what you want, and seems pretty efficient.
• 49.1k
Accepted

### Visibility Polygon

Edit Test non-convex case. ...
• 77.9k

### How can I get samples of f(x) that are roughly evenly spaced?

f[x_] := 1 - 8 x^2 + 8 x^4; You can use the option MeshFunctions -> {ArcLength} and ... 1. Specify the number of equal-arc-...
• 399k
Accepted

### Why is SVM unable to separate linearly separable data?

It's not explicitly documented, but I think Mathematica is using the C-SVM variant, where a regularization parameter C basically says how "expensive" mislabeled training samples are, compared to the ...
• 36.2k
Accepted

### Factor a polynomial Root into Roots of smallest possible degree

A constructive approach The problem can be solved if the form of the solution is given. Define the two factors using a hint (that these should be cubic equations) in the original post ...
• 19.2k

### How can I get samples of f(x) that are roughly evenly spaced?

If we want to the ArcLength approximately equal to the dist = 0.15;, we can define an arclength function ...
• 77.9k

### Creating unique keys from list

Clear[f] f[_] = 0; (f[#] = f[#] + 1; {f[#], #}) & /@ list ...
• 70.9k

### Algorithm too slow

You could use FrobeniusSolve for this: Table[ Length @ FrobeniusSolve[{1,2,5,10}, i], {i,10} ] {1, 2, 2, 3, 4, 5, 6,...
• 131k
Accepted

### Algorithm too slow

Looks like you are describing the classic problem of counting the number of ways to make change, given coins of value 1, 2, 5, and 10. Generating functions can count the ways. ...
• 15.3k

### How to calculate the "center" point

The median is known to be more robust against outliers than the mean: ...
Accepted

### Fast method to calculating signature of a matrix

SeedRandom[1]; H = RandomReal[{-1, 1}, {100, 100}] // (# + #\[ConjugateTranspose]) &; Short[H, 3] ...
• 2,240
Accepted

### Accumulate up and down

accumulateUpDown := Module[{ud = {0, 0}}, Map[ud[[1 + Boole[# >= 0]]] += # &]] accumulateUpDown @ dt == res True <...
• 399k

### Numerical approximation of the integral by using data

Another approach is to combine Interpolation with NIntegrate. ...

### Finding all elements within a certain range in a sorted list

Assuming that you are interested in multiple different windows for the same list, then the following approach will be much faster than the other answers. Basically, compute a ...
• 131k

• 26.9k
Accepted

### From a list of lists of integer, choose a minimal length list of integers that intersects each sublist

LinearProgramming By enumerating your lists and associating each element of Union @@ data with set of indices of lists that contain this element, you can translate ...
• 15.1k

Slow version ...
• 15.7k
Accepted

### Which algorithm does Mathematica use for "RandomSearch"?

According to section "Random Search" in this guide, NMinimize with method RandomSearch scatters points randomly over the search ...

### Is there a cyclic list manipulate function?

Square brackets are only used for functions ...
• 161k

### What's wrong with this FFT-based Von Kármán vortex street simulation?

I found the index should start from 0 instead of 1. This affects the (squared) wave number k....
• 3,740

### Smooth a list of integer values

The following can be shortened: ...
• 42.2k

### Factor a polynomial Root into Roots of smallest possible degree

I'll show the resultant formulation for the degree 15 example. The polynomial in question: ...
• 59.6k

### How to implement the sample-point process like the built-ins of Mathematica?

Being highly astonished about all the very interesting answers, I only want to add an approach using NMinimize. Not very fast, but straightforward. The idea behind ...
• 55.1k