Questions tagged [numerical-computing]

Is an interconnected combination of computer science and mathematics .

Is an interconnected combination of computer science and mathematics in which we develop and analyze algorithms for solving important problems in science, engineering, medicine, and business, for example, designing a bridge, choosing a stock portfolio, or detecting tumors in medical images

146 questions
5
votes
1 answer

How to avoid unnecessary computation when composing pure functions in a functional language?

I have two functions that are a composition of pure functions. The first function takes a parcel, builds a house on it, and take a picture to advertise it in a magazine: let buildAndAdvertiseHouse parcel = parcel |> inspect |>…
Tuur
  • 115
  • 1
  • 3
5
votes
4 answers

What causes isNaN to malfunction?

I'm simply trying to evaluate if an input is a number, and figured isNaN would be the best way to go. However, this causes unreliable results. For instance, using the following method: function isNumerical(value) { var isNum = !isNaN(value); …
Ky -
  • 30,724
  • 51
  • 192
  • 308
5
votes
2 answers

Best Scala collection type for vectorized numerical computing

Looking for the proper data type (such as IndexedSeq[Double]) to use when designing a domain-specific numerical computing library. For this question, I'm limiting scope to working with 1-Dimensional arrays of Double. The library will define a…
supyo
  • 3,017
  • 2
  • 20
  • 35
4
votes
2 answers

In UMFPACK, how often do we need to do symbolic and numeric factorization?

I have a system Ax = b, where B is a constant, but A keeps changing by small amounts in each iteration. I am using UMFPACK 5 to solve this linear system again as again as A changes. I can do the above in two ways: Compute the symbolic and numeric…
Chatter
  • 193
  • 8
4
votes
1 answer

Solving nonnegative linear system in R

Is it possible to find a solution to the undetermined system Ax = b, x >= 0 using some native R function? I can certainly write a linear program and use lpsolve, but am hoping for something native.
gappy
  • 10,095
  • 14
  • 54
  • 73
4
votes
2 answers

Why does this code return two different values doing the same?

#include #include #include int main() { double a; double b; double q0 = 0.5 * M_PI + 0.5 * -2.1500000405000002; double q1 = 0.5 * M_PI + 0.5 * 0.0000000000000000; double w0 = 0.5 * M_PI + 0.5 *…
Rafael
  • 402
  • 5
  • 17
4
votes
1 answer

Avoiding virtual function calls in a computational graph

I'm using a DAG (directed acyclic graph) to represent and evaluate expressions; each node represents an operation (+, -, /, *, accumulate, etc...) and evaluation of the entire expression is achieved by sequentially evaluating each node in…
4
votes
1 answer

Is there any way to print at least 20 significant figures in Octave?

I need to print the result of a program with 20 significant figures, but I don't know how to print more than 15 figures (format long). Is there any way to achieve this?
Jk041
  • 934
  • 1
  • 15
  • 33
4
votes
5 answers

C++ std::vector for HPC?

I am translating a program that perform numeric simulations from FORTRAN to C++. I have to deal with big matrices of double of the size of 800MB. This double M[100][100][100][100]; gives a segmentation error because the stack is not so big. Using…
Nisba
  • 3,210
  • 2
  • 27
  • 46
4
votes
1 answer

How can I find the critical points of a 2D array in python?

I have a (960,960) array an I am trying to find the critical points so I can find the local extrema. I have tried using the np.diff and np.gradient, but I have run into some trouble and I am not sure which function to use. np.diff offers the option…
4
votes
2 answers

Inverse Incomplete Gamma Functions in Matlab

I have a problem which is posed in terms of incomplete Gamma functions and inverse incomplete Gamma functions. Recall that where a Gamma function is a particular integral from 0 to infinity, incomplete gamma functions add another parameter, x, and…
Novak
  • 4,687
  • 2
  • 26
  • 64
3
votes
2 answers

How to calculate the double integral Numerically in Mathematica?

How to calculate the double integral Numerically in Mathematica ? Integrate[Exp[-0.099308 s] * Integrate[Exp[0.041657423 u] Exp[-3.1413 s + 3.12 u] * ((u/(s - u))^(1/2) BesselI[1,2 (u (s - u))^(1/2)] + 0.293…
h02h001
  • 167
  • 4
  • 11
3
votes
1 answer

Overloading of addition for arrays in Rust

Trying to sum two arrays ([1.0, 2.0] + [3.0, 4.0]) fails in Rust as addition isn't defined for arrays. I tried to overload the operation: use std::ops::Add; type float = f64; impl Add for [float;N] { type Output = Self; fn…
3
votes
2 answers

Velocity verlet algorithm - energy increasing for n-body problem

The problem I implemented velocity verlet algorithm to compute trajectories of 2 bodies interacting with each other gravitationally (newtonian gravity only). Orbiting smaller body has a very small mass, body that is in the center of the orbit has a…
3
votes
1 answer

More Robust Integrator cpp

I'm trying to produce a relativistic voigt distribution, the convolution of a relativistic Breit-Wigner distribution and a gaussian function. MWE: double relativisticBreitwigner_pdf(double energy, double width, double mass){ double massSquare =…
1
2
3
9 10