# Tag Info

Accepted

### How to document math formulations in scientific computing codes?

I prefer using doxygen that supports C++ and LaTeX comments, both inline and as separate equations. This way, you will keep your comments, including, say, the rigorous mathematical formulation of the ...
Accepted

### Memory Management - Why certain initializations order are faster?

Such an effect happens because of how the data of the int** a is stored in memory (as per C/C++). This question on StackOverflow has answers with some more details (...
Accepted

### Numerical evaluation of the Exponential Integral Ei by rational Chebyshev approximations fails

There is a prime missing both in your code and in the expression in your question. In the original paper, the expression is:  \log(x/x_0) + (x-x_0) \frac{\sum^\prime_{0\leq j\leq n}p_j T_j^*(x/6)}{\...
Accepted

### C standard for computational science

In theory, as the original authors, you're free to pick and name a standard, then expect others to follow it. In practise, if you're supporting an HPC system, then your choice is likely to be ...
Accepted

### What PRNG function is this?

A little playing with the sequence of numbers generated by the C code shows that the sequence is $z_{i+1}=5z_{i}+273 \mod 2^{16}$ This is a linear congruential generator (LCG). It's easy to show ...
Accepted

### Suming up the series $1+1/2+...+1/n$ in C

I see several problems with your code: type error in scanf (n is an integer, not a float) i=0 and not i==0 in the for loop ...

### Numerical integration giving incorrect sign

This might be an accuracy problem in computing the second term, because of those large exponentials when $x \gg 1$. I would first work on that term: gather $e^x$ out from numerator and denominator and ...

### Looking for Runge-Kutta 8th order in C/C++

summarizing some points: If it's a long-term integration of a non-dissapative model, a symplectic integrator is what you're looking for. Otherwise, since it's an equation of motion, Runge-Kutta ...

### Do BLAS routines compute their respective operations with minimum error?

BLAS routines do not typically use stable summation algorithms. In the case of gsl, you can look up its source code online - the source of gsl's sdot is contained ...
Accepted

### Using GSL for basic operations

Of course it makes sense to use the GSL (or another library for that matter) for several reasons: Don't reinvent the wheel. The work has been done, you can spend your time on more useful things. If ...

### I've developed a derivative-free optimization method, looking for comments

I would like to hear comments from users that have some practical models (e.g. black-box hyperparameter optimization) which are still needed to be solved acceptably - whether this method works or not ...

### C standard for computational science

You should definitely jump to C99, or newer(!). The C99 standard introduced the restrict keyword. Loosely speaking, with this keyword you can inform the compiler ...
Accepted

### What language are best for creating data compression algorithms except for C/C++?

In my general experience, the following are required in order to get "reasonable" performance from a programming language: The ability to specify static types. It's OK if the language also ...

### Kummer's confluent hypergeometric for complex arguments in C/C++?

One possibility is to wrap the arbitrary precision interval implementation in Arb. This will not be as fast as a dedicated double precision implementation, but it might still be fast enough. Note 1: ...
Accepted

### How to deal with big numbers in intermediate calculations?

I think there's a simple way to do this. You have a rational function of identical cosh/sinh terms, where every expression is a homogeneous polynomial in cosh/sinh, and the only problem is that these ...
Accepted

### Recommendations for ODE solvers for stiff equations

This is a huge open ended question, but I'll copy the recommendation section from the current release of DifferentialEquations.jl: Stiff Problems For stiff problems at high tolerances (>1e-2?) it ...

Accepted

### C or fortran library to solve linear 2D/3D elliptic PDE

Most of the widely used finite element libraries are written in C++. If all you really care for -- and if all you will ever care for -- is solving an elliptic PDE on a rectangle, then it's probably ...
Accepted

### Number of decimal of float and double in C

Prof. Bangerth's comment is completely correct. To add more detail, we can refer to IEEE754 standard which defines the floats as ...
Accepted

### Linear solve using CHLOMOD in C

Here is how I call CHOLMOD from a C program. It uses as input my own C++ structure for a sparse matrix (in standard Compressed Row Storage format). There are several gotchas: understanding the ...
Accepted

### Implementing velocity verlet for harmonic oscillator in C gives error wrt conservation of energy

Your second acceleration ao in the else statement does not make sense. Since it assumes that the calculated position and ...

### Programming language for HPC

It is probably a good idea to stick with Python if you have expertise with that. I am assuming that this means you are using numpy/scipy. Depending on what you exactly want to do, well-written numpy/...
Accepted

### Sum over very small exponentials: Underflow

You may use Kahan summation algorithm  The idea is to reschedule the sum operations in such a way precision loss is limited. The code is very simple (reproduced from  below). If this does not ...

### Looking for Runge-Kutta 8th order in C/C++

I would like to add that while what Geoff Oxberry suggests for long-term integration (using symplectic integrators) is true, in some cases it won't work. More specifically, if you have dissipative ...

### Decrease execution time using openMP

The algorithm you are using spawns extremely cheap tasks, especially at small $n$. As you don't have a luxury of changing the algorithm, the only reasonable (relatively) way to avoid the overhead of ...