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
7
votes
3 answers

Scala: Whats the best way to do numeric operations in generic classes?

In Scala, I'd like to be able to write generic classes which use operators like >, /, * etc, but I don't see how to constrain T such that this will work. I looked into constraining T with Ordered[T], but that doesn't seem to work since only RichXXX…
waterlooalex
  • 13,642
  • 16
  • 78
  • 99
7
votes
4 answers

Numerical integration in C++

I need to integrate a function (of two variables). I know I can do it by using Fubini theorem to integrate one variable functions, then using numerical methods such as the Rectangle method or the Trapezoidal rule. But are there any pre-built…
user2370139
  • 1,297
  • 1
  • 11
  • 13
7
votes
8 answers

Has arbitrary-precision arithmetic affected numerical analysis software?

Has arbitrary-precision arithmetic affected numerical analysis software? I feel that most numerical analysis software keeps on using the same floats and doubles. If I'm right, I'd love to know the reason, as in my opinion there are some calculations…
Liran Orevi
  • 4,755
  • 7
  • 47
  • 64
7
votes
4 answers

How to find the minimum positive number that added to 1.0 gives something larger?

While translating some Fortran to Scheme/Racket I have come across the function: ; EPSILON(X) The least positive number that added ; to 1 returns a number that is greater than 1 How do I find the number in Scheme?
soegaard
  • 30,661
  • 4
  • 57
  • 106
7
votes
2 answers

QP solver for Java

I'm looking for a good easy to use Java based Quadratic Programming (QP) solver. Googling around I came across ojAlgo (http://ojalgo.org). However, I was wondering if there are any other/better alternatives.
dmcer
  • 8,116
  • 1
  • 35
  • 41
6
votes
8 answers

Most accurate line intersection ordinate computation with floats?

I'm computing the ordinate y of a point on a line at a given abscissa x. The line is defined by its two end points coordinates (x0,y0)(x1,y1). End points coordinates are floats and the computation must be done in float precision for use in GPU. The…
chmike
  • 20,922
  • 21
  • 83
  • 106
6
votes
4 answers

Free/open source C/C++ library of vectorized math functions?

I'm looking for a free/open source C/C++ (either is acceptable) library of vectorized versions of common math functions (such as ln or exp) similar to Intel's Vector Math Library for Linux. I'd like a library that would provide me with the ability…
BD at Rivenhill
  • 12,395
  • 10
  • 46
  • 49
6
votes
2 answers

Efficient evaluation of hypergeometric functions

Does anyone have experience with algorithms for evaluating hypergeometric functions? I would be interested in general references, but I'll describe my particular problem in case someone has dealt with it. My specific problem is evaluating a…
John D. Cook
  • 29,517
  • 10
  • 67
  • 94
6
votes
1 answer

What's the best midpoint formula for floating point numbers?

The first formula m = (a + b) / 2 is simple, but has a great risk of overflow. Besides, Numerical Analysis, 9th Edition by Burden and Faires points out that when b - a is near the maximum precision of the machine, it is possible for (a + b) / 2 to…
Waizung Taam
  • 119
  • 1
  • 3
6
votes
5 answers

Testing for infinity in CUDA

In a CUDA program, I recently switched from testing for inifinity using return x==INFINITY || x==-INFINITY; where INFINITY is from math.h, to return !isfinite(x); and was quite surprised to get different results. gnu.org suggests that they…
hannes
  • 966
  • 9
  • 13
6
votes
1 answer

Why is this Rcpp code slower than byte compiled R?

As the question title says, I'd like to know why the byte compiled R code (using compiler::cmpfun) is faster than equivalent Rcpp code for the following mathematical function: func1 <- function(alpha, tau, rho, phi) { abs((alpha + 1)^(tau) *…
6
votes
2 answers

Sort two “numbers” with multiple dots

I have an unordered list that can look something like this: 1.1.1 1.1.1.1 1.1.2 1.10.1 1.10.2 1.2.1 1.2.2 1.2.3 1.2.4 1.20.1 1.3.1 And I want to sort it like "numerical" order in…
beowulf13th
  • 447
  • 1
  • 6
  • 16
6
votes
1 answer

PHPExcel number format not displaying correctly

I have an excel export from mysql, which should display data from a column holding a value of 17 digits (a unique, numerical, reference). When using PHPExcel, everything but this reference displays fine. I used…
6
votes
1 answer

remquo: argument reduction?

In the C99 spec it says of remquo: The remquo functions are intended for implementing argument reductions which can exploit a few low-order bits of the quotient. Note that x may be so large in magnitude relative to y that an exact representation of…
Andrew Tomazos
  • 66,139
  • 40
  • 186
  • 319
6
votes
3 answers

Matlab gives wrong answer

If the following code is executed MATLAB makes a mistake. Can someone verify this? floor([0.1:0.1:2]/0.01) So what is the 129 doing here?? ans = 10 20 30 40 50 60 70 80 90 100 110 120 129 140 150 160 170 180 190 200
mmumboss
  • 690
  • 1
  • 5
  • 13