The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
61 views

Efficient calculation of diagonal matrix elements

I have a matrix $V$ of size $M$ in which each row $i$ is a vector $v_i$. Now I have another matrix $H$ and I would like to calculate as efficiently as possible the list of values $v_i^\dagger\cdot ...
3
votes
0answers
55 views

Challenge: Speeding up MaxDetect for application in 3D blob detection

In image segmentation it is a common problem that objects appear clustered and are therefore undistinguishable from each other when using simple algorithms. Based on this post I obtained efficient ...
0
votes
0answers
37 views

Speeding up Nonlinearmodelfit by constraining parameters?

I have a complicated parametric PDE that can be fitted to some data with NonlinearModelFit, but takes several hours to estimate the best values of the four free parameters. Currently, the code ...
0
votes
0answers
30 views

How can I make this more efficient/why doesn't my naive solution speed things up?

I'm computing a certain power series (up to some number of terms), and I figured I should try to speed up the computation as much as I can. The series is defined as follows: Let $f$ be a Laurent ...
2
votes
2answers
85 views

Counting Events in a moving date range

I want to count the number of times events take place in a date range. The counting is done over a window of e.g. 28 days where the goal is to have between 11 and 13 events in the time window. The ...
-2
votes
2answers
138 views

How to write efficient code? How to make this example run faster? [closed]

I would like to learn writting more efficiently. I am working on problem of simulating random walks (abnormal diffusion). I believe this is good example of inefficient code. How can I make it faster? ...
0
votes
0answers
53 views

Is there a faster way to do Normal[SparseArray[{{1,1,1}→1.2, {1,1,2}→20.2, …, {m,n,p}→0.3}]]?

I have a list of the form {{1,1,1}→1.2, {1,1,2}→20.2, ..., {m,n,p}→0.3} and I want to create an $m \times n \times p$ array, $A$, where the value of $A[[i,j,k]]$ is ...
6
votes
1answer
133 views

Law of Cosines to determine angle change along spiral

The Spiral I'm trying to place circles along the outside of an Archimedean spiral. Shown below: ...
4
votes
2answers
101 views

Gamma function computation efficiency?

I wonder what kind of algorithm is used to compute the values for the gamma function. Specifically, I am interested in how the computational load increases when the complexity of the input grows. So, ...
6
votes
2answers
122 views

Additive SparseArray Assembly

The goal is to assemble a SparseArray in an additive fashion. Let us assume we have a large List of indices (some will be ...
1
vote
3answers
80 views

Efficient matrix multiplication

I have a list of vectors vecs={vec1,vec2,...,vecN} where veci is a list with length N. Now I have a matrix N*N called mat. I would like to efficiently get all the numbers veci.mat.veci for i=1 to N in ...
2
votes
0answers
86 views

Expanding a Function in Series works, SeriesCoefficient Doesn't Work

Take the following definitions: ...
5
votes
1answer
162 views

Efficiently searching a list for the position of the closest number to a specified number

Searching by closest and position I wasn't able to find an answer—but found Nearest by guessing. Nearest, however, returns ...
0
votes
1answer
113 views

Efficiency problem with least square algorithm (Error in both variables)

I was informing myself about the least square algorithms with errors in x and y. I found this post and the top answer wasn't ...
4
votes
3answers
197 views

SparseArray row operations

Given a large (very) sparse matrix, A, how can I efficiently "operate" on only the nonzeros in a given row? For example: For each row in A, generate a list of column indices that have a magnitude ...
0
votes
0answers
125 views

Efficiently tabulating system of coupled ODEs for NDSolve

I am solving a (large) system of second order coupled nonlinear ODEs. I have been increasing the number of dependent variables present in the system slowly, to converge on more physically realistic ...
7
votes
0answers
155 views

Improving the performance of a package for working with rational functions

As Mathematica gets slow for large symbolic calculations, the cost of putting terms over a common denominator (Together), in particular, gets too high. It occurred ...
9
votes
1answer
92 views

IntegerDigits has Listable attributes, but not fast

See this example, a function has Listable attributes often more efficient than Map,but why is this one is an exception? ...
7
votes
2answers
207 views

Complement on pre-sorted lists

Is there any way to instruct Complement to skip the sorting part? If the answer is no (likely), the next question would be: how can I remove from a sorted list ...
4
votes
1answer
266 views

Efficiently generating histograms with large numbers of bins

I'm trying to generate a histogram for a large data set with the following lines of code: ...
3
votes
2answers
332 views
1
vote
0answers
106 views

Making simultaneous equation solving more efficient

I am trying to solve a system of several simultaneous equations that have been generated by a series of modules and functions, using this module: ...
1
vote
0answers
144 views

Get path to end nodes in directed (partially cyclic) graph

I have a large directed graph containing small loops. I would like to extract all paths to all end nodes (no VertexOutComponent) with a given path length $n$. I ...
5
votes
2answers
105 views

DictionaryLookup very slow

I'm trying to plot, given a list of words, how many words belongs to each language. I'm using the following code: ...
1
vote
1answer
133 views

Improving the plotting time of a very complicated expression

The quatity $R$ is defined by a complicated expression in terms of $a_1,a_2,\ldots,a_n$. Now each $a_i$ is a function of $x$, $a_i(x)$. I would like to know what is the most efficient way to ...
8
votes
2answers
121 views

vectorized operations is not efficient?

Consider the following example: ...
7
votes
1answer
112 views

Creating a NearestFunction that returns an index

I use Nearest repeatedly for large data sets. For example pts = RandomReal[{-1, 1}, {1000, 3}]; Nearest[pts, {0, 0, 0}] I ...
19
votes
3answers
466 views

Common subexpression from two expressions

I am working with some unpleasantly tedious polynomials, which need to be manipulated in various ways (integrate with respect to some variable, differentiate with respect to another). Since these ...
2
votes
2answers
280 views

Mass Symbolic Manipulation with Subscripts? (from plaintext Input)

The simplest example of the change being sought is a greek letter, typed in as plaintext nu, and its may be replaced by the symbol, ν: expr = 3nu*kx*ky+ ...
0
votes
2answers
186 views

Import large amount of data with time stamps

I have a large data file (150 000 lines) which I want to import in Mathematica. The first few lines look like this ...
2
votes
0answers
90 views

Significant platform-dependent efficiency when importing data?

I'm curious, as I understand that answer this way: If you are using a Linux derivative or something like cygwin on Windows, then this is an efficient solution for reading only the third field ...
4
votes
2answers
266 views

Efficient drawing of convex polyhedron given a set of points [duplicate]

I have a set of points in the 3D space and I want to draw the bounding convex polyhedron of those points. A very naïve solution would be to draw a triangle between every three points: ...
2
votes
2answers
552 views

Importing several huge files with headers & footers

having here several files in ASCII format http://ge.tt/91rv0Jf/v/0 I want to import, while removing headers and footers and then join the several lists. ...
5
votes
1answer
107 views

How to read off coefficients of tensor-like expression in a speedy way?

I am considering identities involving t[a, b, c, d, ...], where number of indices is fixed. t has the cyclic property so that ...
5
votes
1answer
131 views

Why is Flattening a CoefficientArray so slow?

I have a vector of $n$ degree $n$ polynomials in $(x,y,z)$, each of whose coefficients is an inhomogenous linear expression in $3 n^2$ variables. I want to write down the linear equations in these $3 ...
1
vote
1answer
102 views

Only perform a symbolic differentiation once

I want to define a function that involves a differentiation step that Mathematica can do easily, which might be of the form ...
4
votes
1answer
228 views

A Faster way to combine two Lists of different structures into one of a different structure [duplicate]

I have the following two lists (each containing over 500,000 elements). Here is a sample: ...
8
votes
4answers
471 views

Efficient code for the Ten True Sentences puzzle

I am trying to solve Ten True Sentences Puzzle. Take a look at the following sentences: The number of times the digit 0 appears in this puzzle is _. The number of times the digit 1 ...
12
votes
4answers
471 views

Can you recommend an efficient method for finding the least integer satisfying my inequality?

I tried find the minimum make $\frac{1}{2}+\frac{1}{2+\sqrt{2}}+\frac{1}{3 +\sqrt{3}}+...+\frac{1}{n+\sqrt{n}}>15$ Following code is so slow when I use condition ...
4
votes
3answers
427 views

How to make brute force coding more efficient?

Hi guys and guysettes, The little Mathematica I've been using/seen so far, it seems to be all about neat "one-liners" using the underlying functions and working with lists & maps to solve issues, ...
16
votes
2answers
843 views

Difference between AbsoluteTiming and Timing

I need to evaluate the efficiency of my code. Therefore I would like to evaluate the time the code need for some calculations. Mathematica gives me two possibilities for this kind of evaluation: ...