# performance-tuning's questions - English 1answer

1.696 performance-tuning questions.

### Why is this parallel notebook not maxing out the available memory and processors?

I've searched many questions about parallel processing here, and they are either specialized or over my head. I run the following parallel notebook on an 8 core EC2 instance. The average memory usage ...

### 1 Speed up FinancialData execution?

0 answers, 11 views performance-tuning curated-data
When I do e.g.GE = FinancialData["GE", "OHLCV", "Jan. 1, 1918"]; // Timing {2.67188, Null}The output claims that the ...

### 3 Efficient implementation of the divided difference

1 answers, 93 views performance-tuning symbolic algebra
Question. I am looking for more efficients ways to compute Newton's divided difference, i.e. the operator $$\partial : f(x,y) \mapsto \frac{f(x,y)-f(y,x)}{x-y} \ ,$$ for the case where $f$ is a ...

### 3 How can I speed up NIntegrate computation?

I want to Plot a definite integral ...

### 2 Performance in ListDensityPlot

1 answers, 55 views plotting performance-tuning
Consider an array of triplets:specup={{x1,y1,z1},{x2,y2,z2},...{xn,yn,zn}}. The dimensions for specup are {1506006, 3}. The ...

### 4 Performance issue using MemberQ inside Table

I have a list of positions that I would like to use in an array. I came up with the following code to fill a Table with 'ones' in these positions, and 'zeros' everywhere else: ...

### 3 why Findroot slower with jacobian?

1 answers, 94 views equation-solving performance-tuning
can someone please tell me why findroot performs poorly with jacobian ? in this example res1 is slower than res. ...

### 4 How to use FoldList / NestList and Pure function for this?

3 answers, 109 views performance-tuning nest fold
...

### 2 How can I stop the function in FormPage from timing out?

1 answers, 37 views performance-tuning formpage
I have a FormPage with a function that, on average, takes several seconds to evaluate. This is entirely expected. However, ...

### 4 NIntegrate for extremely oscillatory function

I have a question about how to use NIntegrate. I need to integrate a slightly different function thousands of times, one very much like the one I have posted below. ...

### 3 How to get the coordinates of the closest point along a line?

I have a plot as below (the plot is just for illustration purpose. in my real problem, I just have pts1):- ...

### 5 How to increase the speed of DeleteDuplicates on some selected columns?

I have a data1 with 4 columns and would like to remove the duplications by looking at the first 3 columns. Thus I used below code:- ...

### 34 A geometric multigrid solver for Mathematica?

Cross posted to community.wolfram.com Mathematica ships a variety of linear solvers through the interfaceLinearSolve[A, b, Method -> method]the most ...

### Compilable table of Matrix diagonals function

1, I am trying to make Compilable function which takes Matrix of zeroes and ones f.e: ...

### 4 Fast way to reassemble SparseArrays

1 answers, 68 views performance-tuning sparse-arrays
I often have to deal with nonlinear shape optimization problems involving curves or surfaces surfaces. A classical example is Plateau's problem. No matter if I use gradient-based techniques (such as ...

### 4 Why is ProbabilityDistribution 100x slower than ExtremeValueDistribution?

0 answers, 41 views performance-tuning distributions
The two distributions are the same, except the ProbabilityDistribution cuts out below x=0. The wolfram documentation on ProbabilityDistribution says nothing about speed. A search of this site gave no ...

### Improving speed of multidimensional Gaussian quadrature

I am trying to do a numerical integration using Gauss-Legendre quadrature over rectangular regions. The equations used in the code below is given as:  Q_{1}= \int_{c_{i}}^{d_{i}}\int_{a_{i}}^{b_{i}}...

### 2 Parallel Evaluation of Multiple Functions and Return the First to Finish

I have two functions which calculate the same thing using different methods. Sometimes, the first method is much faster than the second method. Other times, the other way around. Just pretend this ...

### 4 Replace value in association data-set

1 answers, 72 views performance-tuning associations
I have an association dataset with a depth of two (each value is an association too, and the size of the dataset ~ 30000 keys and an average size of values are ~2000 keys association). The dataset ...

### Simplify not acting smart on a sum of 10 rational functions

Rather by accident I discovered that throwing Simplify at the following "harmless" expression ...

### 1 Making a slow code with symbolic manipulations faster

I have a code with symbolic manipulations. It works fine but very slow (e.g. for w=14 it's reasonably fast but I want it to work for ...

### 5 Data Cleaning Problem - Getting rid of redundancies

I am cleaning a database and I need to clean also the location field. The data is taken from a forum, so the entrance are self compiled. For this reason I have a lot of weird and different stuff going ...

### 1 Memory use for large computation

I am running a "big" program on my 32G RAM laptop. When MMA is running, roughly there is about 28G RAM "available" to use. So I did a bit of a test. ...

### 2 Using more CPU power to decrease evaluating time

1 answers, 191 views plotting performance-tuning
Lets say I wanted to make a highly detailed graph of a 3D function. Generally I use something like ...

### 5 Efficient conversion from string to number

Is there a way to convert a list of string to numbers faster than ToExpression? ...

### 4 Improve “Game of Life” on a mosaic

2 answers, 112 views performance-tuning cellular-automata
I had the idea of generalizing Conways Game of Life from a regular lattice to act on a Poisson Voronoi mosaic (tessellation). The code below works but is maybe not the best idea in terms of speed. I'...

### 5 The effect of NormalsFunction on the number of function evaluations in Plot3D

1 answers, 74 views plotting performance-tuning graphics3d
An interesting issue was raised in comments to the following question: Monitoring Plot3D with a given number of plotpoints. We were discussing the fact that a ...

### 6 Efficiency in calculation on graphs: Compile?

1 answers, 76 views performance-tuning compile
Basic Question I have a looping calculation that I need to perform on some large lists a very large number of times, and as I have written the functions the computational speed is prohibitively slow. ...

### HannWindow implementation and discretization speed

0 answers, 51 views functions performance-tuning
I would like to discretize a series of HannWindows, but two issues arise. First, my manual implementation of HannWindow seems to ...

### 12 Scaling Dynamic widgets up

1 answers, 95 views performance-tuning dynamic
The serious flaw of Dynamic is a combination of facts: it is triggered/refreshed by any kind of mutation of a symbol, careful metaprogramming/construction of ...

### Table & complex exponential (Arbitrary‐Precision) operations efficiency issue [on hold]

Below is the expression I want to optimize, ('I' represent the imaginary unit):ParallelTable[Flatten[Exp[I*n*list]], {n, -10, 10}];as you can see I already ...

### 7 Why changing to float-point value does't improve the speed?

2 answers, 598 views performance-tuning numerics faq
I am testing the first tip of this article Use floating-point numbers if you can, and use them early. I've compared a pair codes and finding it's not helpful to use the float-point number during ...

### 2 How to make this higher resolution transform as fast as Fourier?

Given a table of data, the Fourier command gives the discrete frequency content of the data, where the resolution in frequency space is equal to 1/N, where N is the number of data points. Higher ...

### 1 Is there a better way to calculate the semivariance of a list?

edit2: The tweak suggested by Henrik Schumacher in Carl Woll's answer is so far a clear winner ($\times800$ over the benchmark); it's almost disturbing to contemplate how 'slow'-relatively speaking-...

### 10 Efficiently counting the number of data points that fall within each square of a grid

4 answers, 474 views list-manipulation performance-tuning
The following code works, but is inefficient. I would like to find a better implementation. The problem is the following. I have a list of points, representing a matrix of 2 columns and N rows. Each ...

### How this trade-off has been calculated for Regularized least-squares in convex-optimization boyd book [migrated]

I am reading this topic of boyd book from convex optimization, but the following division i-e trade-off least square and l2 norm are difficult to understand for me. If kindly someone can explain ...

### 4 delete an element list recursively

I have a list, say {10,9,8,7,2,3,5,4,3,2,1}What I want to achieve is to delete the elements that are not in decreasing order recursively. Namely, the output ...

### Using data of a compiled code in future

I have run a huge amount of code to find a 9 by 9 matrix called A. I want to use elements of this matrix in future when I open the Mathematica again. Is it possible? How can I do that? An step by step ...

### 1 Computation performance involving multiple numeric integrals

I have the following code that has been running for more than three days without an answer, unfortunately. Now, my institution provides us with a computer with Intel Xeon CPU E-52650 v3 @ 20 CPU, 2....

### 9 Mod slow in CompiledFunction

3 answers, 251 views performance-tuning compile
I've been playing with a little compiled Ising model implementation. It's brutally slow. Decomposing things I've found that the primary culprit appears to be Mod. ...

### 9 How is the Hessian computed using ExperimentalNumericalFunction?

Here and here it was explained how to use ExperimentalNumericalFunction to compute the Hessian of a numerical function. I would like to know how this undocumented ...

### 2 Improving speed for calculating eigenvalues of a sequence of large matrices

1 answers, 65 views performance-tuning linear-algebra
I need to compute the eigenvalues of matrices of size 1000x1000. I create two symmetric matrices $A$ and $B$ where each entry $(i,j)$ is given by a function ($f$ for $A$ and $g$ for $B$) of $i,j$ and ...

### How can I decrease timing to find measure of edges of a tetrahedron?

Let be $ABCD$ is a tetrahedron, knowing that $ABC$ is an equilateral triangle $AB=a$, $AD=d$, $BD=e$, $CD=f$. I want to find the $a$, $d$, $e$, $f$ when the angle of two vectors $AB$ and $CD$ equal to ...

### 7 What is the point of PaneSelector?

IntroPaneSelector looks like a pretty idiomatic way to toggle displayed content e.g.: ...

### 20 Fast MATLAB, slow Mathematica: Export a matrix as TSV

4 answers, 1.382 views matrix performance-tuning export matlab tsv
I am trying to find the best way of exporting matrices (results of a time-dependent CFD calculation). I found that .h5 is the fastest option, but h5 is not generic, i.e., I can't really open like a ...

### Fastest way to replace/evaluate symbols in long expressions

0 answers, 36 views performance-tuning replacement
I have a set of series like this:ϵ = Sum[epsilon[order][v, θ, ϕ] (r - rp)^order, {order, 0, MaxOrder}] + O[r, rp]^(MaxOrder + 1);and others e.g. ...

### How to speed up a module function with a large number of arguments?

0 answers, 25 views performance-tuning scoping arguments
I'm setting up a fairly hefty numerical code dealing with matrices of variable dimension, but on the order of hundreds of rows and columns. I'm using a Module format: ...

### 8 How to efficiently write into PackedArrays that are stored in Associations?

Using Association to generate complicated data types is very comfortable, in particular if one uses those tricks from How to make use of Associations?. However, I ...

### 2 Apply ParallelMap to function f over a matrix while passing as arguments the row number and the element index

I have a matrix test = { {2.5,1.4,3.3},{4,4,4},{7,3.2,9}} and a function f that requires 2 arguments, the row number and the ...