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

Avoid & Count non-numerical values computing basic statistics in Mathematica

Please consider: dalist={{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {2.88`, 2.04`, 4.64`,0.56`, 4.92`, 2.06`, 3.46`, 2.68`, 2.72`,0.820}, {"Laura1", "Laura1", "Laura1", "Laura1", "Laura1", "Laura1", "Laura1", "Laura1",…
500
  • 6,509
  • 8
  • 46
  • 80
3
votes
3 answers

Dynamic json object with numerical keys

I have a json object which I converted to dynamic C# object with help of this answer. It works just fine, but trouble is that this object has numerical keys. For instance, var jsStr = "{address:{"100": {...}}}"; So I can't wirte …
Tror
  • 442
  • 4
  • 12
3
votes
3 answers

How to convert a column of string to numerical?

I have this pandas dataframe from a query: | name | event | ---------------------------- | name_1 | event_1 | | name_1 | event_2 | | name_2 | event_1 | I need to convert the column event to numerical, or…
Sandro Motyl
  • 109
  • 6
3
votes
2 answers

Numerical Error in simple CUDA code

I just started experimenting cuda with the following cude #include "macro.hpp" #include #include #include //#define double float //#define double int int RandomNumber(){return static_cast(rand() %…
leon
  • 4,931
  • 7
  • 39
  • 37
3
votes
1 answer

Hypergeometric function

Octave doesn't seem to have a function to compute the generalized hypergeometric function pFq, or its simpler particular case 2F1: >> help hypergeom error: help: the 'hypergeom' function belongs to the symbolic package from Octave Forge but has not…
Luis Mendo
  • 110,752
  • 13
  • 76
  • 147
3
votes
1 answer

Number of Unique `double`s between Two Values

I provide an answer to this question below (I did not find an 'answer own question' button) Original Question In Java, we have floating point type double which is encoded as 64 bits in memory. From this we know that it can take on at most 2^64…
Thomas Weise
  • 389
  • 6
  • 13
3
votes
1 answer

Tiny numerical difference in sum-of-squares depending on numpy procedure call used

I am writing a function which computes sum of squares of errors. x and y are vectors of the same length; y is observation data, x is data computed by my model. The code is like: >> res = y.ravel() - x.ravel() >> np.dot(res.T, res) >>…
mrad
  • 46
  • 5
3
votes
1 answer

Approximation error when using sqrt and floor

I have to do an enumeration of solutions of an equation and I know that y < x *( sqrt(n) - 1 ), where x, y and n are integers. My naive approach would be to look for y less or equal than floor( x * ( sqrt( (float)n ) - 1 ) ). Should I be worried…
rgugliel
  • 43
  • 6
3
votes
1 answer

Redis SortedSet: How to get values in numerical order rather than alphabetical order when two values has the same score?

Recently, I'm using redis SortedSet to implement game rank for every user, but I've got a problem: zadd game_rank 55 6435 zadd game_rank 55 6088561 zadd game_rank 55 608825 zrange game_rank 0 -1 the result is : "60882561" "608852" "6435" I want to…
3
votes
2 answers

solving a trig equation numerically with in-browser JS

Given values for the variables s, v, and h, and given a library such as numeric.js how can I numerically solve the following equation for a within a given degree of accuracy? I'm wanting a JS algorithm for use in-browser.
Web_Designer
  • 72,308
  • 93
  • 206
  • 262
3
votes
1 answer

Double Numerical Integration in C++

I am looking for a good way to compute a double integral numerically using pre-written C++ libraries. The basic integral I'm dealing with is this: I've done some research and discovered a few libraries that might be useful, however I'm not sure…
Mr. Frobenius
  • 324
  • 2
  • 8
3
votes
4 answers

Working with massive numbers and minute numbers simultaneously

I have an mxn matrix A, with very small or very large elements. For example: A = -1e4*randn(10,20); I would like to create a new matrix C of the same size, as follows: First, define a matrix B whose elements are the exponential of the elements of…
f10w
  • 1,524
  • 4
  • 24
  • 39
3
votes
3 answers

Jacobi iteration doesn't end

I'm trying to implement the Jacobi iteration in MATLAB but am unable to get it to converge. I have looked online and elsewhere for working code for comparison but am unable to find any that is something similar to my code and still works. Here is…
3
votes
2 answers

Decimal accuracy of binary floating point numbers

I've found this problem in many interview exams, but don't see how to work out the proper solution myself. The problem is: How many digits of accuracy can be represented by a floating point number represented by two 16-bit words? The solution is…
3
votes
2 answers

how to add expressions and do numerical calculation in Maxima?

I would like to ask: how I can add expressions in Maxima? i.e. I have: A = x + y; B = 2*x + 2*y; How to get Maxima to give me (A + B)? how I can do numerical calculation in Maxima? I want to assign x = 1; b = 2; How to get the numerical value of…
CaTx
  • 1,421
  • 4
  • 21
  • 42