Questions tagged [numerics]

54 questions
31
votes
1 answer

What's the future of std::valarray look like?

Up until fairly recently I hadn't been keeping up with the C++11 deliberations. As I try to become more familiar with it and the issues being worked, I came across this site which seems to be advocating for deprecating or removing std::valarray…
andand
  • 17,134
  • 11
  • 53
  • 79
25
votes
5 answers

Mean value and standard deviation of a very huge data set

I am wondering if there is an algorithm that calculates the mean value and standard deviation of an unbound data set. for example, I am monitoring an measurement value, say, electric current. I would like to have the mean value of all historical…
Alfred Zhong
  • 6,773
  • 11
  • 47
  • 59
14
votes
7 answers

Take the average of two signed numbers in C

Let us say we have x and y and both are signed integers in C, how do we find the most accurate mean value between the two? I would prefer a solution that does not take advantage of any machine/compiler/toolchain specific workings. The best I have…
McCormick
  • 169
  • 1
  • 5
11
votes
4 answers

Doing efficient Numerics in Haskell

I was inspired by this post called "Only fast languages are interesting" to look at the problem he suggests (sum'ing a couple of million numbers from a vector) in Haskell and compare to his results. I'm a Haskell newbie so I don't really know how to…
Fredrik
  • 4,161
  • 9
  • 28
  • 31
9
votes
1 answer

Library function capabilities of Mathematica

I am trying to use CUSP as an external linear solver for Mathematica to use the power of the GPU. Here is the CUSP Project webpage. I am asking for some suggestion how we can integrate CUSP with Mathematica. I am sure many of you here will be…
PlatoManiac
  • 1,442
  • 11
  • 31
9
votes
3 answers

General way of comparing numerics in Python

I have been looking around to find a general way of comparing two numerics in Python. In particular, I want to figure out whether they are the same or not. The numeric types in Python are: int, long, float & complex For example, I can compare 2…
Jesper - jtk.eth
  • 7,026
  • 11
  • 36
  • 63
6
votes
1 answer

Completely wrong value for matrix multiplication with System.Numerics

Even though the System.Numerics.Vectors library that is obtainable via NuGet has its own functions for view and projection matrices I wanted to implement it myself and just use the vector and matrix structures. Unfortunately I am already getting a…
Christian Ivicevic
  • 10,071
  • 7
  • 39
  • 74
5
votes
4 answers

Numerical Integration with c++ on a given mesh with fixed constant discretisation

I have the following problem: My c++ code can compute two functions f1(i1,i2,i3,i4) f2(j1,j2) for every set of {i1,i2,i3,i4} I get some value of f1 and for every set of {j1,j2} I get some value of f2. the sets {i1,i2,i3,i4} and {j1,j2} are given on…
Sankp
  • 51
  • 4
5
votes
1 answer

Is there a good GLSL hash function?

So I am still getting upvotes for my ancient comment on this question: What's the origin of this GLSL rand() one-liner? And it got me thinking, what would a good GLSL hash function look like? There are obvious use cases for it like Perlin noise.…
starmole
  • 4,974
  • 1
  • 28
  • 48
4
votes
2 answers

GoodnessOfFit.StandardError wrong answer

Why am I getting the wrong answer (err2) from GoodnessOfFit.StandardError? In the code below, I do the computation myself and get the right answer (err3). I get the right answer from GoodnessOfFit.RSquared. Note: esttime and phrf are double[].…
phv3773
  • 487
  • 4
  • 10
4
votes
2 answers

Binary search / bisection for floating point numbers

It is easy to find an integer with binary search even if it can be arbitrarily large: first guess the order of magnitude, then keep dividing the interval. This answer describes how to find an arbitrary rational number. Having set the scene, my…
Matthias
  • 133
  • 2
  • 10
4
votes
1 answer

are computations with large floats less accurate then with small floats

Is this statement correct? : Computations with large numbers is less accurate due to the logarithmic distribution of floating point numbers on the computer. So that means computing with values around 1 is more accurate (because of rounding errors)…
Gabriel
  • 8,990
  • 6
  • 57
  • 101
4
votes
1 answer

Incorrect linear interpolation with large x values using Math.Net Numerics

I'm trying to use Math.NET Numerics to do interpolation of a DateTime - Value series. I started off with linear interpolation, but am getting some very off looking results. Running this test: public class script{ public void check_numerics() { …
jdpilgrim
  • 358
  • 3
  • 13
3
votes
2 answers

Adding an int to a string c++

If I have a string string foo and I write foo += 27, what gets appended to the string? Is it the character with the ASCII hex value 0x27 or with 0x1b? Also, when I try foo += 0, I get a compilation error saying ambiguous overload of += operator with…
user377299
  • 31
  • 1
3
votes
1 answer

Public Domain or No Binary Attribution FFT Lib?

I'm looking for an FFT library to translate into the D programming language for inclusion either in a library that I'm working on or (better yet) in the standard library. I need a fairly simple FFT with decent performance, not an uber-optimized one…
dsimcha
  • 67,514
  • 53
  • 213
  • 334
1
2 3 4