Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
0 answers
94 views

How to push the performance of this compiled function

I have the function optvals solving for two variables. For the given example of variables, I need the program to run atmost in a millisecond. The main part of the ...
Dotman's user avatar
  • 580
1 vote
1 answer
95 views

How to speed up generating and filtering large lists of numbers?

I have the following code where I brute force search for two variables. list gives a list of 3 dimensional vectors, say {x,y,z}. ...
Dotman's user avatar
  • 580
1 vote
0 answers
66 views

Numerical Error using compile

I'm trying to compile a function and I'm running into the following error CompiledFunction::cfne : Numerical error encountered; proceeding with uncompiled evaluation. I think I have succeeded in ...
Dotman's user avatar
  • 580
0 votes
1 answer
123 views

Performance improvements using Table and Compile

I'm converting a code from MatLab to Mathematica. It takes MatLab less than a second to compute it while its more than ten minutes in Mathematica. I was hoping to improve the performance. Here's a ...
Dotman's user avatar
  • 580
2 votes
2 answers
91 views

How to speedup comparison in the following example?

I have the following problem: I would like to generate random values of some variable $z$ obeying some distribution, but simultaneously within the interval zmin<...
John Taylor's user avatar
  • 5,963
1 vote
1 answer
86 views

Speed up summation of many inverse matrices

Physical background I am trying to write a code that computes the Green function of a system, given the Self energy $\hat{\Sigma}_n$, a list of Matsubara frequencies $z_n$ ($n=1,...,N_{Mats}$) and the ...
Matteo's user avatar
  • 295
3 votes
0 answers
84 views

Using a compiled function in NMinimize

I can get NMinimize to work with compiled functions in simple cases. This works with a constraint: ...
Craig Carter's user avatar
  • 4,839
9 votes
2 answers
471 views

How to detect underflow/overflow (post 11.3)?

This old trick used to work before 11.3: SetSystemOptions["CheckMachineUnderflow" -> True] But no longer... so how can we explicitly check for this in v12+?? ...
M.R.'s user avatar
  • 31.8k
2 votes
0 answers
148 views

Speeding up the process of NDSolve[] when a user-defined function is involved?

I am trying to tackle a (1+4 dimensional PDE) model at which the solution of the first PDE (with some interpolations and changing the domain) would be used in the second PDE. In fact, I must choose ...
Faz's user avatar
  • 1,827
1 vote
1 answer
84 views

NIntegrate fails with functions that have (necessarily) numeric lists as arguments

I'm not able to NIntegrate a function that has a numeric list as an argument. My original problem involves a compiled function, but a MWE is the following: ...
Luis's user avatar
  • 327
1 vote
1 answer
94 views

How to deal with this error in Compiled Function?

...
Xminer's user avatar
  • 1,211
1 vote
1 answer
222 views

Numerical error in compile, Strange behaviour in numerical evaluation

First of all, apologies for the large numbers, I couldn't find a working example for a far lower order and the zeros are necessary... my problem is this: I have a large polynomial (from high-order ...
John P. Wiener's user avatar
5 votes
4 answers
752 views

Findroot with a precompiled function with parameters

If I want to precompile a function that I intend to put into FindRoot many times, I could do it like this: ...
Jojo's user avatar
  • 1,278
6 votes
2 answers
648 views

Using Findroot with Precompiled Function

I am writing a Monte Carlo algorithm to solve some algebraic equations. To do this I need to evaluate FindRoot many times on the same function. Following from F'x's answer to Expression evaluation ...
Jojo's user avatar
  • 1,278
1 vote
1 answer
593 views

Avoid symbolic evaluation with NSolve and compiled function

Problem I have a compiled function that I want to use in an equation given to NSolve. I can get the code to run, but it first produces warning messages that result from NSolve trying to evaluate the ...
FalafelPita's user avatar
5 votes
1 answer
253 views

Compilation, square roots, and integers

After looking at this question, particularly this answer, I wrote my own performance test, using the two functions ...
rogerl's user avatar
  • 4,291
0 votes
0 answers
67 views

Error message when using a compiled function in NSum [duplicate]

Below is a simple example to illustrate the problem test = Compile[{{n, _Integer}}, n] Now, Table works fine ...
matheorem's user avatar
  • 17.4k
5 votes
2 answers
244 views

A problem with Compile and Map

There is a weird behavior of Compile that I do not understand. Consider the following example: ...
Grzegorz Rut's user avatar
  • 1,158
0 votes
1 answer
126 views

Why does Compile redo the calculation when overflow happens?

When implementing the Numerov method solving Schrodinger equation, I encountered this problem. In order to show the order of the evaluation, Print is added. ...
luyuwuli's user avatar
  • 2,814
0 votes
2 answers
1k views

Numerical 3D Integration in Mathematica [closed]

My question in short is: Is it possible to make numerical 3D integration in mathematica efficiently? Or am I gonna have to move this to C++? I feel this problem is way too trivial to go to C++, so ...
The Quantum Physicist's user avatar
4 votes
2 answers
549 views

Problem with machine number precision in compiled functions

When I compile a very big function and give it input the function returns error. I realized that this is because the value of the function becomes smaller than the smallest machine number. Is it ...
MOON's user avatar
  • 3,886
17 votes
2 answers
349 views

CompiledFunction returns machine numbers smaller than $MinMachineNumber

When thinking on the workaround for this LogLogPlot bug suggested by halirutan I noticed that CompiledFunction actually can ...
Alexey Popkov's user avatar
0 votes
1 answer
342 views

Alleviating a bottleneck involving a function call with symbolic derivatives

I have a bottleneck problem involving a function call with symbolic derivatives. I don't have much experience with Mathematica (or any dynamic language) and I'm certain that the way I've set this up ...
chroma's user avatar
  • 1
10 votes
1 answer
3k views

Mathematica NDSolve and 'Compile'?

Since the consensus is usually that NDSolve speeds fares badly against compiled code such as c++ ODE solvers using GSL say, is it possible to make up for this lag ...
fpghost's user avatar
  • 2,145
15 votes
1 answer
676 views

Why is MainEvaluate being used when LinearSolve can be compiled?

According to this question LinearSolve can be compiled. However, CompilePrint[] shows a call to ...
asim's user avatar
  • 1,885