Questions tagged [numerical]

This tag is for questions concerning problems using numbers which either cannot be exactly solved, or where the exact solution may be much more difficult to acquire than by using numerical methods.

This tag is for questions concerning problems using numbers which either cannot be exactly solved, or where the exact solution may be much more difficult to acquire than by using numerical methods.

It includes questions about algorithms, precision and accuracy of underlying numbers, advantages and disadvantages of several methods, error propagation, problems with the underlying numbers and data structures.

508 questions
3
votes
2 answers

A C library for finding local maxima?

I'm trying to write an audio analysis application, and I need to identify local maxima in a 2D array which represents a spectrogram. I've already got an open source library that can generate the spectrogram using Fast Fourier Transforms, but I was…
andygeers
  • 6,909
  • 9
  • 49
  • 63
3
votes
3 answers

What is "e" variable in popular implementations of Brent root finding algorithm?

I am reading the standard (Numerical Recipes and GSL C versions are identical) implementation of Brent root finding algorithm, and cannot understand the meaning of variable "e". The usage suggests that "e" is supposed to be the previous distance…
quant_dev
  • 6,181
  • 1
  • 34
  • 57
3
votes
2 answers

Performance of ILNumerics of simple math operations over vectors vs system array and Math.NET

I am recently doing some studies on numerical algorithms in C#. Therefore I did some experiments in search for the most suitable math library for .NET. One thing I do very often is to evaluate objective functions, which usually are functions that…
doraemon
  • 403
  • 6
  • 15
3
votes
2 answers

What's the difference between combinatorial and numerical problems

Could you please give at least two examples of each. Thanks.
Julian
  • 1,853
  • 5
  • 27
  • 48
3
votes
4 answers

Accept Numerical Values only for input using scanf

How can I make sure the user inputs numerical values only instead of alphanumeric or any other character? Also what to look for to insert error message for incorrent input? #include int main() { int a, b, c; printf("Enter first…
user2741667
  • 45
  • 1
  • 1
  • 4
3
votes
1 answer

Differences in numerical behaviour between Scala versions

We are in the process of upgrading to Scala 2.10. We seem to have fixed all the show stoppers, but for some of our numerical calculations the answers are a little different in a small number of cases. Are there any known changes introduced between…
Daniel Mahler
  • 7,653
  • 5
  • 51
  • 90
3
votes
3 answers

Global overloading of == and != for floating-points

Is it a bad practice to overload global operator == and != for floating points ? I'm using fast floating-points in a game environement, and i was thinking about using fuzzy comparison everywhere as i can't imagine a situation where i don't expect…
Adrian Goudard
  • 115
  • 1
  • 9
3
votes
1 answer

Numerical classifier (?) Weka / R

I have a numeric dataset (as a database table) with a "n to m" relation. For example: A | B ----- 1 | 1 1 | 2 1 | 9 4 | 2 7 | 8 7 | 11 And I would like to "train" a classifier (using weka?) to tell me which A is the most likely for a set of B's. As…
Jonny H.
  • 33
  • 4
3
votes
2 answers

Numerically integrate a function f(x) over x using MATLAB where f(x) has another argument y which is a vector

I would like to numerically integrate a vector which represents a function f(x) over the range of x specified by bounds x0 and x1 in Matlab. I would like to check that the output of the integration is correct and that it converges. There are the…
dina heidar
  • 33
  • 1
  • 3
3
votes
1 answer

numerical differentiation with Scipy

I was trying to learn Scipy, using it for mixed integrations and differentiations, but at the very initial step I encountered the following problems. For numerical differentiation, it seems that the only Scipy function that works for callable…
owari
  • 369
  • 3
  • 14
3
votes
3 answers

MATLAB's "SIGMA must be symmetric and positive definite" error sometimes not making sense

I am not sure if this is a programming or statistics question, but I am %99 sure that there should be a numerical problem. So maybe a programmatic solution can be proposed. I am using MATLAB's mvnpdf function to calculate multi-variate Gaussian PDF…
paul simmons
  • 5,568
  • 13
  • 51
  • 78
3
votes
1 answer

How to order this computation for numerical stability?

I'm trying to compute a vector, whose sum is 1 and whose elements are defined as such: v[i] = exp(tmp[i])/exp(tmp).sum() The problem is that the value in the exponential may be large (between -10^2 and 10^2), making the exponential to evaluate to…
cpa
  • 3,742
  • 4
  • 16
  • 22
3
votes
3 answers

How to solve 2D integral?

I've been trying to implement trapezoid rule for double integral. I've tried many approaches, but I can't get it to work right. static double f(double x) { return Math.exp(- x * x / 2); } // trapezoid rule static double trapezoid(double a,…
stiv
  • 33
  • 3
3
votes
4 answers

Propagation of NaN through calculations

Normally, NaN (not a number) propagates through calculations, so I don't need to check for NaN in each step. This works almost always, but apparently there are exceptions. For example: >>> nan = float('nan') >>> pow(nan, 0) 1.0 I found the…
max
  • 49,282
  • 56
  • 208
  • 355
2
votes
1 answer

How to extract Numerical gradient matrix from the image matrix in Opencv

i am searching a way to get Numerical gradient from the matrix. The same function is implemented in matlab's default documentation.http://www.mathworks.com/help/techdoc/ref/gradient.html but i couldn't find any in opencv. I want to port this to C++…
wolvorinePk
  • 1,760
  • 5
  • 36
  • 67