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.
3,147 questions
5
votes
0
answers
161
views
Incredible performance of Eigensystem
I realised that Mathematica's matrix diagonalization (on M4 Pro) is very fast:
...
1
vote
0
answers
40
views
Puzzling behaviour of ParallelMap where the function being called itself has compiled functions inside
I can't post the entire code because it is several hundred lines. But, as in the title, I have a ParallelMap calling a function that has compiled functions inside it. But I get that it sometimes ...
2
votes
0
answers
68
views
Best way to deal with function arguments of different dimensions
Consider the function:
Clear[myf]
myf[x_,z_,y_] = x*z*y;
I have a range of values of $x,y,z$ that I would like to evaluate this functions at:
...
2
votes
0
answers
97
views
How to speed up numerically integrating solution to system of PDEs
I have some code that I believe to be functioning as intended but that takes a while to solve (about 15 minutes per step, of which there are at least 50 needed). So I'm asking for any advice on ...
6
votes
0
answers
85
views
Why is `CoefficientRules` significantly slower than `CoefficientList`, and how to efficiently get sparse rules for multivariate polynomials?
I have noticed a significant performance gap between CoefficientList and CoefficientRules. While ...
1
vote
1
answer
164
views
Do the following produce similar distributions?
I am trying to understand the Normal distribution code.
The first code is:
dist1 = RandomVariate[NormalDistribution[0, 1], {512, 512}]
And the other code is:
...
2
votes
0
answers
96
views
Numerically recovering from a contour-integral solution 𝑤 ( 𝑥 , 𝑡 ) in Mathematica is very slow and inaccurate
I am implementing in Mathematica a contour-integral solution obtained from the Fokas method for a Burgers-type equation on a finite interval.
The original PDE is
\begin{equation}
\theta_t = D \theta_{...
8
votes
2
answers
281
views
3
votes
3
answers
237
views
How can I reliably find the global maximum of a complicated non-polynomial function using Maximize?
I'm trying to use Maximize to find the global maximum of a function. In my real problem there are around 10 variables. The function is quite complicated and ...
1
vote
0
answers
49
views
Using the following compiled routine inside another routine?
Consider the following picker (binary search using a CDF) and some compiled code using it:
...
5
votes
2
answers
310
views
How to calculate a solution with Mittag-Leffler function
$f(p) = \sum\limits_{k=0}^{\infty} (v/D)^k L^{(\alpha-1)k+\alpha-3} E^{k+1}_{\alpha,(\alpha-1)k+\alpha-2}(-p/D L^\alpha)|_{L=1} = 0$,
$v=0.8\ cm/min, D=0.01\ cm^\alpha/min, \alpha =1.97, K=0.6\ 1/min$....
2
votes
1
answer
362
views
Is there a way to define this piecewise function so it can be integrated?
I want to calculate several derivatives and integrals involving a complicated periodic piecewise function, but I'm struggling to get it to work, and someone here suggested that part of the problem is ...
0
votes
0
answers
80
views
Need verification of a ChatGPT code for linear extensions of a partial order
This is sort of a continuation of Generating Linear Extensions of a Partial Order. It is about generating all those permutation lists p which satisfy ...
4
votes
0
answers
159
views
Cover a 3D region with balls faster
Question
Suppose we have a 3D MeshRegion reg composed of 2D triangular faces. I want to find a (minimal-ish) list of balls, ...
5
votes
1
answer
184
views
Why is ListPointPlot3D extremely slow when plotting many points with per-point Style colors, and how can this be optimized?
I am generating a 3D band structure from a slab Hamiltonian and color-coding each eigenvalue by its IPR (defined from the corresponding eignvector, e.g., inverse participation ratio). The numerical ...