Questions tagged [performance-tuning]

Questions on optimizing Mathematica code for higher performance. This may mean faster execution, lower memory usage or both. Not to be confused with mathematical optimization.

2,584 questions
Filter by
Sorted by
Tagged with
53 views

Is there a better way to build a matrix with position coordinates conditions?

Suppose that I have a list of coordinates {x,y} following some geometry in space, for example ...
32 views

My Differential evolution algorithm does not minimise

So far I have implemented the Differential evolution but my output does not show me any minimization is it possible to solve it ...
50 views

Faster PowersRepresentation using IntegerPartitions

Earlier I posted a question about taking fast integer square roots of known integer perfect squares. The reason this came up is I was trying to find a faster way of mimicking the PowersRepresentations[...
243 views

Fast Integer Square Roots of known perfect squares?

A bit of a generic question perhaps - say I have a list of non-negative integers and I know each are perfect squares - what is a fast way of finding their square roots? I have very long lists (...
32 views

why does parallelDo ignore these 2 lines of code? [closed]

I have this loop ...
91 views

Optimizing operations between vectors

Basically I am generating a grid in space (so a vector where v[]=position 1 in x) and a random number of particles in space (so a vector where p[]= position of particle 1 on space). Afterwards, ...
188 views

Fastest way to create multiple lists in a do loop

I do not think my explicit code will be helpful to illustrate it so here is the "barebones" silly example: ...
60 views

Dividing list into smaller list using a set of rules?

Suppose we have the list for $n\in\mathbb{N}$ Range[1,n] We choose the number in the list where $x=1$, $x=n$ and $x=1+(n-1)/2$ round closest to and the numbers ...
105 views
+50

Speeding up Fourier transform and eigenvector calculation

I have a matrix $M$ in Bloch basis (momentum space). Then I have to take Fourier transform of $M$ to go to real space. The size of this lattice in real space can be fixed to some value $N_{unit}$. ...
64 views

How to create a function that merges the first $n$-digits of each value in a list?

Suppose we have a list of numbers. For example, A={1231,1232,1233,1241,1236} Using a function f[x,A], I want to rearrange this ...
39 views

A general question about speed of working with interpolating functions

Consider a grid {x,y,z,f(x,y,z)} Here, x,y,z are real numbers, and f is a function that first monotonically increases with its argument $z$, and then quickly ...
405 views

NIntegrate: the order of singular points matters!

Consider the following integral: $$I = \int_{-5}^5 \frac{1}{(x(x-2))^{1/3}} dx.$$ The exact value is 6.30249 - 2.2405 I. I will perform ...
165 views

Faster searching for subsets with pairwise conditions

I am looking for a faster way of finding large subsets of lists that obey pairwise conditions. In particular, I'm looking for a large (over 10k) set of quaternary words (i.e. ordered lists) of length ...
34 views

NIntegrate With Singularity: Experiment With Various Parameters

I want to numerically evaluate the integral $$I = \int_{\mathbb R^2} dxdy f^*(x) f(y) K(x-y)dxdy,$$ where $$f(x) = \sqrt{\frac 2 \pi} e^{ikx} e^{-x^2}, \quad k\in\mathbb R$$ is an exponentially ...
69 views

How to analyse the performance of Mathematica on this function?

Using f[n_] := Sum[1/(Sqrt[k] + Sqrt[k + 1]), {k, 1, n}] to analyze the well-know series... I noticed a sudden performance drop (on my outdated PC hardware ) ...