# Tag Info

Accepted

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

Plot uses two different algorithms depending on whether PerformanceGoal is set to Quality or ...
Accepted

### 3D tree in Mathematica?

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

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

Wanna listen to a story? :) It was around 2002 when I finally became fed up with ParametricPlot3D[] and its inability to adaptively plot space curves. Recall that ...
Accepted

### How to generate a blank crossword sheet?

One can use CellularAutomaton and apply only one rule: do not allow 4 white cells together! ...
Accepted

### Machine learning. SVM algorithm

As of Version 10 , Mathematica has a built in function Classify, which implements support vector machines and some other common machine learning algorithms. ...

### Replace interior of matrix with zeros

You can do: x[[2 ;; -2, 2 ;; -2]] = 0; x or ...
Accepted

### Faster position list construction from a "take instructions" list

My answer is based on a modification of a binary heap. Basically the construction looks something like this. We start with a binary tree: Notice that if we label the nodes breadth-first, the labels ...
Accepted

### How to fill a grid make its total be largest

Below is given a solution derived with ILP combinatorial optimization: The total of the assigned values to the $5 \times 5$ table is $61$. I called in the comments this approach to be "brute force" ...
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

### Efficient way to build a certain square matrix

Here's my take using NestList cm[n_] := NestList[# + 1 &, Join[Range[n/2 + 1], Reverse@Range[n/2]], n - 1] Then ...
Accepted

### Implement the Bisection algorithm elegantly and easily

1. Bisection algorithm The algorithm itself is fairly straightforward and "fast" in some sense: the number of iterations is roughly Log2 of the ratio of the ...

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

Earlier in the summer I had written the following for How to obtain adaptive sampling as in Plot function?. It is something like J. M.'s technique. But instead of a new version of Mathematica coming ...
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, ...
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 ...

### How to deal with recursion formula in Mathematica?

If you can rewrite the recursion to be tail recursive, you will not run into recursion limits. Here is an example of a tail-recursive implementation of factorial. ...

### Faster position list construction from a "take instructions" list

Preface Below, you will find two different solutions. For understanding the problem itself, the first, iterative solution is better suited since it gives insight in how the solution can be found ...
Accepted

...

### 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: ...
Accepted

### Detecting patterns of black and white stones on a 2D board

One function comes to mind that already implements matching of multidimensonal rules: CellularAutomaton. Allow me to represent your board data like this: ...
Accepted

### Splitting strings into letter keys and integers

You asked for shortened, improved, so here it is using RegularExpressions: ...

### An inverted pyramid

A simple solution with And, Xor and Mod: ...

### Upper bound "Vicious nearest neighbour" algorithm suggestions

(Notebook: https://github.com/arnoudbuzing/rifleproblem) OK, this is not a full blown solution (I can delete it when there is a real answer), but perhaps a useful tool to help others get a feel for ...
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.
Accepted

Accepted

### How to deal with recursion formula in Mathematica?

A number of points: First, if you need to compute several values of your sequence, your intial memo-ized implementation will NOT run into recursion limit problems. Second, if you need to compute ...

### Match opening and closing parentheses?

This one returns the pairs in the order they get closed: ...

### Implementing an algorithm for finding the largest circle that contains a single point in a set (and no other point)

Here's a direct implementation of Rahul Narain's algorithm using Version 10 functions (no attempt has been made to optimize): ...

### Faster position list construction from a "take instructions" list

I have a tree-based method that has the right asymptotics but a very high coefficient. The upshot being, it will not compete with other methods until we get past 10^6 or so in list size. With ...
In this answer, I will use the Functional Paradigm to deal with triangular recursive formula in a uniform manner. For the triangular recursive formula $$T_k^{(n)}=f(T_{k-1}^{(n)},T_{k-1}^{(n+1)})$$ ...