Tagged Questions

An algorithm is a sequence of well-defined steps that defines in abstract the solution to a problem.

learn more… | top users | synonyms

2
votes
1answer
137 views

Determining whether two k-chromatic graphs are equivalent (not simply isomorphic) using IsomorphicGraphQ?

In a previous question of mine, I asked whether Mathematica's built-in routines could determine an isomorphism for two $k$-chromatic graphs, Determining whether two $k$-chromatic graphs are isomorphic ...
9
votes
2answers
266 views

Determining whether two $k$-chromatic graphs are isomorphic (respecting vertex coloration)

Consider the case where I have two $k$-chromatic graphs $G_1$ and $G_2$, i.e. two graphs where individual vertices can be colored with one of a set of $k$ total colors, and I would like to determine ...
4
votes
1answer
489 views

Efficient method for inverting a block tridiagonal matrix

Is there a better method to invert a large block tridiagonal Hermitian block matrix, other than treating it as a ordinary matrix? For example: ...
8
votes
2answers
382 views

Finding all points of period n in an iterated map

I'm trying to implement an algorithm of Jenkinson and Pollicott to calculate the Hausdorff dimension of a Julia set for the map $f_c : z\mapsto z^2 + c$. It's described on page 40 of their paper, ...
19
votes
5answers
2k views

Mathematica Implementations of the Random Forest algorithm

Is anyone aware of Mathematica use/implementation of Random Forest algorithm?
1
vote
2answers
178 views

How to incorporate functions within Do Loops

I'm attempting to repeatedly perform a simple algorithm with incremental changes of a parameter. I can easily express my changing parameter: ...
7
votes
2answers
1k views

Easier program for period of Fibonacci sequence modulo p

For a little project I need to calculate the period of a Fibonacci sequence modulo p, for which p is a prime number. For example, the Fibonacci sequence modulo 19 would be: $$0, 1, 1, 2, 3, 5, 8, 13, ...
5
votes
1answer
374 views

Random number generation with specific distribution

I am writing a program for solving the shortest path in travelling salesman problem, with a twist that there are multiple salesmen who partition the cities among themselves, thus creating two part ...
15
votes
1answer
749 views

How to extract metadata from an image of a business card?

I'm trying to digitize some documents, and I came across a very cool app called camscanner app which performs parallax transform and ocr very nicely, now I'm implementing it in mathematica... Given ...
47
votes
3answers
21k views

How to create a new “person curve”?

Wolfram|Alpha has a whole collection¹ of parametric curves that create images of famous people. To see them, enter WolframAlpha["person curve"] into a Mathematica ...
17
votes
1answer
431 views

Simulating Theatre puzzle

I have been trying to simulate the process of the theatre puzzle from the Joy of X (Strogatz). The puzzle, and some relevant material are here. My simplistic coding for this process follows: ...
2
votes
1answer
181 views

How do I determine if there's an arithmetic sequence within a list? [duplicate]

Possible Duplicate: find subsequences of constant increase Given an arbitrarily long list of integers (let's say they are sorted), how would one determine if any 3 (or more) of those ...
10
votes
2answers
2k views

Machine learning. SVM algorithm

I want to work with machine learning in Mathematica. Are there any SVM algorithms implemented in Mathematica anywhere? Or any other algorithms for machine learning? With positive and negative database ...
2
votes
0answers
207 views

How can I compute the chromatic index and number of a graph?

I saw a recent question from M.R. and realized there is no function to compute the chromatic index and number of a graph, other than a really slow method in the now deprecated Combinatorica. So, how ...
7
votes
3answers
404 views

How do we solve N-Rooks variation using primes?

Using a $p_n $x $p_n$ matrix, how can we solve the N-Rooks problem to find a prime in every row and column? ...
14
votes
2answers
570 views

How can I speed up the classic GA for graph coloring?

I'm trying to compute the chromatic number of this graph (which is 28): g = Import@"http://www.info.univ-angers.fr/pub/porumbel/graphs/dsjc250.5.col"; My genetic ...
20
votes
2answers
1k views

How to quickly calculate intersections of filled curves?

I am trying to quickly calculate the intersection of polygons with more than 6,000 points. A compiled solution would be preferable. Here is one example of the problem: ...
18
votes
11answers
1k views

Generating an ordered list of pairs of elements from ordered lists

I have a pair of ordered lists. I want to generate a new ordered list (using the same ordering) of length n by applying a binary operator to pairs of elements, one from each list, along with the index ...
21
votes
3answers
586 views

Computing polynomial eigenvalues in Mathematica

MATLAB offers a function polyeig for computing polynomial eigenvalues, which appear, for instance in quadratic eigenvalue problems (see here for some applications) such as: \begin{equation} ...
4
votes
1answer
1k views

Efficient implementation of cubic equation of state

...In this case the Peng Robinson Equation of State. Equations of state are empirical equations with parameters derived from experimental data. They are used to predict pure component and mixture ...
7
votes
2answers
339 views

find subsequences of constant increase

A list like l = {0, 1, 2, 3, 4, 5, 7, 9, 12, 13, 18, 19} may have subsequences of constant increase, $a_{n+1} = a_n + k$. For example: ...
19
votes
2answers
1k views

How can I create a glass distortion effect in an image?

I'd like to overlay a glass jar onto an image with realistic light bending. Can anyone think of a way to automate this effect (perhaps this can be done with the raytracing package rayica)?
12
votes
4answers
1k views

Finding elementary cycles of (directed) graphs

I need to enumerate all the simple cycles (i.e. elementary cycles where no vertex is repeated other than the starting) of a graph which has both directed and undirected edges, where we can treat the ...
53
votes
3answers
6k views

Programmatic approach to HDR photography with Mathematica image processing functions

The High dynamic range imaging (HDR or HDRI) direction in photography and image processing became very popular recently. Besides obvious photo art applications (see examples), there are many great ...
11
votes
2answers
391 views

Word Squares and Beyond

A word square is a set of words which, when placed in a grid, read the same horizontally and vertically. For example, the following is an English word square of order 5: ...
20
votes
3answers
774 views

Build a refined grid based on intersecting line

I honestly have no idea where to begin with this problem. In summary, I have a 2D coarse grid with an intersecting line. For an easy example, let's assume it's a 4x4 grid. I wish to pass through ...
3
votes
1answer
117 views

Center of quadrangular

Having 4 points A (ax, ay), B (bx, by), C (cx, cy) and D ...
7
votes
1answer
918 views

Efficient backtracking with Mathematica

Backtracking is a general algorithm for finding all (or some) solutions to some computational problem, that incrementally builds candidates to the solutions, and abandons each partial candidate c ...
4
votes
1answer
571 views

Computing Slater determinants

I need to compute Slater determinants. I'm wondering if I would benefit from assigning each of my functions to a variable prior to computation. I'm working with Slater determinants, but my question ...
8
votes
3answers
304 views

Faster Alternatives to DateDifference

I need a faster implementation of FractionOfYear and FractionOfMonth, which do the following: Input: A time/date specified by ...
7
votes
1answer
293 views

How can I extend BinCounts to work on Times and Dates?

I want to extend BinCounts to work on a list of times or dates, binning them by Day, Week, Hour of the Month, Day of the Year, etc... So given a list of times and a time bin spec, I need to calculate ...
22
votes
2answers
987 views

How can I pack circles of different sizes into a spiral?

Given a list of circles of different areas, I need to arrange them tangentially in order of increasing area and spiraling outward. An example of the type of packing I'm attempting is shown by the ...
39
votes
1answer
1k views

How to construct a treemap using non-rectangles?

I've written the standard version of a tree map (a graphic that shows nested data) and I'm looking to improve on this layout by switching to different types of polygons or perhaps circles. Can anyone ...
13
votes
2answers
826 views

Higher order SVD

Does anyone know how to do a higher order SVD in Mathematica ? A good reference seems to be here http://www.sandia.gov/~tgkolda/pubs/pubfiles/SAND2007-6702.pdf but I don't understand their formalism ...
30
votes
4answers
2k views

Finding a percolation path

I would like to examine percolation on a random lattice. To be exact, I wish to find the minimum length of a 'bond' needed such that the leftmost site can be connected to the rightmost site. Here is ...
23
votes
7answers
1k views

Splitting words into specific fragments

I am looking into splitting words into a succession of chemical elements symbols, where possible. For example: Titanic = Ti Ta Ni C (titanium, tantalum, nickel, carbon) A word may or may not be ...
12
votes
2answers
1k views

Simple algorithm to find cycles in edge list

I have the edge list of an undirected graph which consists of disjoint "cycles" only. Example: {{1, 2}, {2, 3}, {3, 4}, {4, 1}, {5, 6}, {6, 7}, {7, 5}} Each ...
15
votes
3answers
1k views

Effective matrix power like algorithm

First example Suppose you want to calculate the 6th power of some matrix $A$. The brute force attempt of doing this is considering $$(((AA)A)A)A)A$$ which requires a total of 5 matrix ...
13
votes
5answers
2k views

Finding all elements within a certain range in a sorted list

Suppose we have a sorted list of values. Let's use list = Sort@RandomReal[1, 1000000]; for this example. I need a fast function ...
22
votes
3answers
4k views

Plotting a set of trajectories (not a vector field) in 3D

Consider a set of trajectories in 3D space, that possibly converge. By visualizing trajectories as arrows the result will look crowded as each arrowhead will be placed where the attractor is. In 2D, ...
22
votes
7answers
605 views

Alternative ways to implement a triangular recursion

Triangular recursions are a class of algorithms that frequently turn up in computational mathematics. These recursions are expressible in the general form ...
16
votes
4answers
1k views

How to get actual triangles from DelaunayTriangulation[]?

The ComputationalGeometry package has a DelaunayTriangulation[] function. It returns a list of points connected to each point, ...
36
votes
1answer
2k views

Adaptive sampling for slow to compute functions in 2D

EDIT: Although I have posted an answer based on my current progress, this in incomplete. Please see the "open issues" section in the answer. Most plotting functions in Mathematica adjust the ...