We’re rewarding the question askers & reputations are being recalculated! Read more.

# 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,076 questions
Filter by
Sorted by
Tagged with
283 views

### Speed up animation

For a project I need to make a little animation showing what happens when you put two hexagonal lattices on top of each other and rotate one of them(Moiré pattern), and my advisor sugested using ...
79 views

### How can I simplify my geometric calculation?

Here is a math problem I am dealing with right now: Given ellipse $C$: $x^2/a^2 + y^2/b^2=1$ ($a>b>0$). Ellipse $C$ passes through the point $P$: $(1,3/2)$, and has eccentricity $e=1/2$. ...
57 views

### Fastest way to compute determinants over (lists of) machine precision numbers

The below code is a code snippet of a larger project of mine. The project is mostly optimised but this part is not. I'm struggling to improve it, the code takes a really long time to evaluate for what ...
30 views

### Mathematica UI slow on Surface Go

Anyone else using Mathematica 12 on a Surface Go? On my Go 8GB/128GB, Mathematica responds slowly to typing, scrolling through notebooks, and rotating 3D graphics. Wolfram support had me disable ...
24 views

### any way to study the number of CPU cycles used for a computation?

I do speed comparisons for various functions and algorithms, and ultimately, the speed of some section of program code depends on the number of CPU cycles. This can vary wildly across operating ...
33 views

### Is there a feasible computation?

I have to find the values of $p_1$ and $p_2$ which minimizes the expression $G$. However, when I took the partial differentiation of $G$ with respect to $p_1$ and $p_2$, the equations I obtained were ...
52 views

### Speed up Computation on Mac Pro

I recently got the opportunity to switch my licence from a macbook laptop to a Mac Pro. Although being very ignorant on the topic, I know that the Mac Pro should perform computations much faster than ...
76 views

### Efficiently computing current flow betweenness centrality for graphs

Definitions: Given a graph $G=(V,E),$ the current flow betweenness is a node-wise measure that captures the fraction of current through a given node with a unit source (s) sink (t) supply $b_{st}$ (1 ...
52 views

204 views

### Approximating the density of $S\cap[a,b]$ using a Folner Sequence of $A$, where $S \subseteq A$?

Edit: I redid my code but it's still not working. How do we use Mathematica to approximate $$D(S\cap[a,b])=\lim_{n\to\infty}\frac{\left|S\cap{F_n\cap[a,b]}\right|}{\left|F_n\cap[a,b]\right|}$$ ...
124 views

### Help speeding up solution of system of differential equations using Laplace transform

I'm trying to speed up this code that seems to take forever to evaluate. I'm solving a system of 9 coupled differential equations using a Laplace transform (a version of this code that works perfectly ...
60 views

### Reduce taking long time on six equations

I have a system of equations, 4 linear and 2 quadratic, of the following form: $$L_{i,j}(x_1, \cdots, x_{12}) = \sum_{k=1}^{12} x_k c_{k,i,j}$$ for $i, j = 1, 2$, i.e. the $L_{i,j}$ are the ...
217 views

### Number of list elements less than a given integer

I'm trying to make a function whose input is a list, and that outputs a list for which the nth element is the number of elements in the input less than n. So far, I have ...
644 views

### MaxDetect speed

What's the fastest way to find the local maxima of a 2D list? E.g. ...
36 views

### Can LearnDistribution Train and Generate Images Without Defaulting To 256x256?

In spite of anything I try it seems the ConformImages[] function nested in the LearnDistribution[] function resizes images to 256x256. If I convert an image into its "Data" representation before ...
42 views

### Efficient Linear Operators on SparseArrays

I have a rank four SparseArray of dimension {40, 40, 40, 40}. I wish to apply a linear operator to it, whose form I know abstractly. That is, I have a simple closed form for the action of the operator ...
123 views

### Building Truncatable Primes using Nest(List), While, Fold

Here is a video on Truncatable Primes. I tried to build it myself. Here is what I have tried using the method in the video for left Truncatable Primes. ...
86 views

### Optimising Table iteration

I've asked a question here which was resolved by tweaking my code a little. So I shall reiterate, for the following list, ...
298 views

Consider the function $$h:[-1,1]\times I_{\sigma}\to I_{\sigma}$$ $$(\omega, x)\mapsto \sqrt{x + \sigma \omega}$$ where $\sigma > \frac{2}{3\sqrt{3}}, I_{\sigma} = [x_-(\sigma), x_+(\sigma)]... 1answer 78 views ### Speed of Manipulate with Plot3D & ParametricPlot3D [closed] I am trying to generate a 3d animation showing two ripples interfering at a point which can be chosen. In my 3d modelling, I want to show the cross-section of the ripple towards that point. I wrote ... 1answer 67 views ### What is the most efficient way to use the fitted models? I'm generating a simple linear model ($y=mx+b$) by fitting to the background of some data, and then trying to plug in the x-values of the data I'm actually interested in. I'm a bit surprised that <... 2answers 67 views ### Permutations of$ \{1, 2, \dots, n\} \$ [duplicate]

When I try Permutations[Range[1, 12]]; // AbsoluteTiming I get {53.6949, Null} and with ...
76 views

### How can I make this “Pick” inside a “Table” run faster?

I am working on becoming more and more familiar with MMA and on a scale from one to ten, I would rate myself as a four or a five. I understand vectorization and that loops-are-very-bad. I have ...
788 views

### Integration of Interpolated function take an unacceptable amount of time

I have a simple integration which, when using an interpolation function, is taking too long to calculate: ...
136 views

### Linear programming with lazy constraints

Does Mathematica offer any means for solving linear programming problems with "lazy constraints", as described e.g. here? While I am not very familiar with linear programming, my understanding of the ...
139 views

### Convert String to Integer from a huge string database in a very fast way?

I have a huge string database with the form such as {{position},{1,2,3,4,5,..}}, and I want to convert such database to Interger data in a very quick way. In the following example, I created a ...