# Questions tagged [timing]

This Tag is used for two things: Questions regarding improving execution speed and questions where various methods are compared for execution speed.

138 questions
Filter by
Sorted by
Tagged with
1 vote
67 views

### Creating and printing a real-time evaluation timer

I want to print a timer that starts at 0 when an evaluation begins and stops when the evaluation is completed. I have come up with the following solution using Clock...
56 views

### CPU time in iteration process

Let $Tx=\frac{x}{2}$ for all $x\in[0,1]$. Let $x_{0}\in[0,1]$ and set an iterative sequence $\{x_{n}\}$ by the method $x_{n+1}=Tx_{n}$. Now if $x_{0}=0.8$, then I get a convergent sequence towards the ...
126 views

### Position command runs much slower for range containing numerically evaluated Bessel function

I have a long list (about 10000) of positive numbers (here simply denoted list), for which I want to find the positions of elements lying between 0.5 and the first ...
467 views

### Why does Module slow down StringMatchQ by 180 times?

I knew that Module is slower than With or Block, often by several times. But it surprises me ...
49 views

### Inconsistent Timing on FinancialBond valuations

I need to do bond valuations (lots of them across lots of data) using FinancialBond. Context & Background I have daily interest rate data on 30 year US Treasury ...
1 vote
117 views

### How do I speed up this numerical integration with Bessel functions? (Tried changing Working Precision and Integration Strategies)

I need to compute the function P[b] given as follows: ...
41 views

### Derive a function and then make a fast version for execution

I would like to derive a (complicated) equation of motion and integrate it efficiently numerically. I can do this "by hand" by copying the resulting function in a new function and then ...
147 views

### Inverse taking no time? [closed]

I was comparing the time that the computer takes to perform Partial Pivoting, Total Pivoting and multiplying by the inverse. The code (that makes the comparison chart) is as follows: ...
93 views

### Solving an equation without output

Could you please help in solving the equation below. I am not able to do it with the current version of mathematica (very old one). All parameters are real and positive. Thank you so much in advance <...
1 vote
65 views

### Is there any hope to compute the determinant of $56\times 56$ parametric matrix and simplify the result?

I have this $56\times 56$ parametric matrix $M$ and I want to compute its determinant where $\{t,y,z\}$ are some real parameters. I use Det[M] but it takes a lot ...
183 views

### Why does Table take so much longer than its constituent computations?

I have a 10x5xn list, which I'll call data, data = RandomInteger[{-500, 500}, {10, 5, n}]; ...
355 views

### Speeding up time in computations: a visual and easy way to find the slowest parts of a code

Edit: I searched the wolfram function repository and there is a nice function EvaluationTiming by a Wolfram Research member that makes a dataset from the timing data of a computation. If we set ...
73 views

### Why the performance of list of Timings depend on the order?

It seems that the result of list of Timings and AbsoluteTimings depends on the order, while ...
44 views

### Timing Discontinuity with Replace[] Function

When constructing certain square matrices I noticed a sharp jump in the time required to build them. I've included code and a plot of time required to make the matrix vs dimensionality of the matrix. ...
85 views

### Format Time Reported by AbsoluteTiming

I am trying to format the timing reported by AbsoluteTiming so that it states the hours minutes and seconds of the result. However, probably because ...
107 views

### Why the coefficient function is very fast

When looking for the coefficients of an desired series, I found that the Coefficient function is very fast compared to other functions and methods. In the following summary, we find the different ...
72 views

### Defined function takes more time than pure/anonymous function. Why? [duplicate]

A function defined by f[x_]:=<code> and applied on every element of a list as f /@ testList seems to take longer than the ...
1 vote
142 views

### Explicit integration of PDE running very slowly

I would like to solve the PDE $\frac{\partial u}{\partial t}=(1-x)\frac{\partial u}{\partial x}$, in the interval $[0,1]$, with initial condition $u(0,x)=e^{-218(\frac{-2}{3}-ln(1-x))^2}$, by manually ...
67 views

### Why is Clip so slow and how can I improve its performance?

The built-in function Clip is defined as a way to clip a value between a specified minimum and maximum. Another way to do this, is simply by utilizing ...
1 vote
57 views

### How to get correct note timings when importing multi-track Midi files?

I have observed when importing midi files with more than one track, the times for every track except for the first one are sped up. for example, ...
146 views

### Elimination of the variables

I am trying to get an equation in terms of variable z by eliminating variables g0 and g1 but Running below code is taking time forever ...
1 vote
77 views

### Using With[] vs. Using a Pure Function for Constants

There are many cases where I am conflicted over using With[] versus using pure functions when dealing with constants, knowing the output is the same either way. For ...
267 views

### Code to solve quadratically constrained quadratic optimisation problem using FindMinimum is very slow. How do I make it faster?

The problem I have a quadratically constrained quadratic optimisation problem (QCQP) which takes about 13 seconds to find the optimal solution. I want to iteratively optimise a large number of times (...
1 vote
136 views

### How to make the following code work faster?

The problem I would like to compute the Lorentz transformation $\mathbf{p}'$ of an arbitrary 3-momentum vector $\mathbf{p}$ given a boost characterized by some other momentum vector $\mathbf{p}_{N}$, ...
157 views

### Check if list is singleton in sub linear time

A singleton is a list whose elements are equal. Some ways of checking this in Mathematica: {Equal@@#&, 1==Length@Union@#&, MatchQ[#,{x_ ..}]&} I ...
65 views

### How to evaluate the following integral faster?

I have a problem with the time required for evaluating the multi-dimensional integral and would be grateful for any help in reducing this time. First of all, there are some pre-definitions used in the ...
159 views

### Why Dot product of my vectors takes longer than usual?

I have a list containing 100 complex numbers lying between 1.9 + 1.9 i and 2.0 + 2.0 i you can download its mx file from the link below and import it in Mathematica: http://adambarfib.ir1.rapidpars....
54 views

### Long execution time using position

I have two lists, for example: List1={2,4,6,8,10,12} List2={4,10,12} I want to find the positions in List1 such that the element at that position is equal to the ...
1 vote
58 views

### How to reduce the computation time of this series expansion?

I have a complicated function gg[Delta,l][z1,z2] which is given in the sample code below. I would like to expand this function for as many ...
53 views

### Why is doing a computation inside Select slower than a precomputation?

I am trying to generate primitive Pythogorean triples using Euclid's parametrization. I basically want a list of pairs with ordered pairs $(m,n)$ such that $m$ and $n$ are coprime. My first approach ...
159 views

### Multi-dimensional array lookup vs flat array lookup with compute

During Monte-Carlo (MC) simulations on a latice of dimensions $(L_1,L_2,\ldots,L_D)$, all the site varibales are often stored as a $D$ dimensional array array. To ...
128 views

### NIntegrate timing discrepancy

When I run the following identical numerical integrals ...
50 views

### Difference in computation speed of Eigensystem not to expectation for ParallelTable and Table

I was trying to compute the time it takes for Eigensystem to evaluate while being inside a ParallelTable, as it is well-known LAPACK subroutine has an inbuilt Parallelization to it. And the difference ...
26 views

### Calculation time differs between segmented loops and one whole loop

I stumbled on a strange issue while simulating a large number of random values, $10^8$ to be precise. I generated the numbers at first by the following code: ...
228 views

### Reduce the time of computation for $5$-dimensional numerical integration

I need to perform (numerically) the $5$-dimensional integral given in the code below for a large number of values of $\epsilon$. The code I have at the moment takes $\sim 11$ minutes and returns an ...
785 views

### Mathematica 12.1 start-up time in Linux extremely slow

I installed Mathematica 12.1 on my Linux machine and the start-up time is extremely slow. I see the Spikey logo and messages like: Initializing Kernel connections ...
45 views

### Summing Kronecker Deltas: Sharp slowdowns for simple sums

I'm using Mathematica 12.0 Student Edition. I'm a little confused by the length of time Mathematica takes to evaluate certain sums of Kronecker Deltas or Discrete Deltas. Here's a simple example below:...
1 vote
72 views

### Converting Timing to TimeObject

What's the proper way to get Timing and post-process it for example to convert to a TimeObject as a defined function? In line, ...
1 vote
63 views

### Filtering Fibonacci numbers for elements meeting certain criteria [closed]

Write a code that selects in less than two seconds from every 123rd of the first 33,333 even Fibonaci numbers; those which contain the digits 2, 3, 6, 7, and 8 and also contains the digit 1 more than ...
178 views

### How to set a timer (countdown) in Manipulate what stops it running?

I have a Manipulate function with 2d slider which I can play with some curves. I consider this as a game (gamification in physics). I want to set a timer so when it countdown to zero then the game ...
98 views

### How to speed up Timing[4^(10^10)]

I have an old computer with a quad-core AMD Phenom II processor (3Ghz). When I run Timing[4^(10^10)]the computer takes hours to evaluate the expression. I'm not ...
266 views

### Using Parallelize in a solve function

Is there a way to use Parallelize the following operation, in order to make it do the calculations faster? Or is there another way to speed up this calculation? ...
1 vote
84 views

### Generalization of code is slower than particular case

I wrote the following Mathematica module: ...
106 views

### Summing all the times of a column

It is possible to add a last row in the table where I can show the sum of values of the last column. I would like to get the total time value... ...
614 views

### Show timing of every output

I know I can follow Wolfram's guide and enable "ShowTiming" to show the timing of the previous command at the bottom of the window. Additionally, I can enable <...
318 views

### Interpolation works slowly

Consider the following code: ...
1 vote
55 views

### Why do I keep getting the same time from the Timing function?

I am running a gamblers problem solution where I am testing the timing involved in solving the Ax = b equation for matrices of n=100, 1000, 10000, and 100000. For some reason I keep getting the same ...
2k views

### How to speed up a process

I am wondering how to speed up the following code: Currently it takes more than two sec to be processed. ... 1 vote