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

Bash - numerical sort sorts 10s before 1s

I'm in a directory. There are two subdirectories and I want to list the files in them, in numerical order. In the first directory, the files are named 01, 02, 03... and they sort fine. But in the second directory, the files are named 1, 2, 3 and…
james_kansas
  • 165
  • 2
  • 7
2
votes
4 answers

Numerical integration using Simpson's Rule on discrete data

I am looking for numerical integration with matlab. I know that there is a trapz function in matlab but the precision is not good enough. By searching it online, I found there is a quad function there it seems only accept symbolic expression as…
user1285419
  • 2,183
  • 7
  • 48
  • 70
2
votes
5 answers

c# regular expression only numerical characters in string

I want to check if a string with an undefined length consist of only numbers. Example: "234324" = true "er32" = false "1" = true the way I tried to solve this problem is like this: public bool Validate(string input) { return…
Marnix v. R.
  • 1,638
  • 4
  • 22
  • 33
2
votes
2 answers

Large numerical errors in my Mathematica program

Here is a piece of my program. Have a look. For[m = 1, m <= mode1, m++, For[n = 0, n <= mode2, n++, A[m, n][t_] = a[m, n]*Cos[\[Omega]*t]; B[m, n][t_] = b[m, n]*Cos[\[Omega]*t]; ] ] temp = 0; For[m = 1, m <= mode1, m++, For[n = 0, n…
user1099153
2
votes
2 answers

robust online algorithm for semi-variance

I'm looking for the equivalent of welford's algorithm for the online computation semi-variance (downside partial variance). Does anyone know of a good reference? Does such an algorithm even exist? Edit: the case where the semi-variance is taken…
o17t H1H' S'k
  • 2,541
  • 5
  • 31
  • 52
2
votes
2 answers

how do I optimize computation of Gaussian pdf?

I am working on a C++ project that often requires the computation of Gaussian pdf given a data point x and an existing Gaussian distribution G. This is expensive since the exponential function exp is involved. Even if I take log, the log function is…
wanderer
  • 1,219
  • 1
  • 10
  • 10
2
votes
2 answers

Perl: Numerical sort of arrays in a hash

I have a hash of arrays, and I need to sort it first on the keys, and then on the values in the array. Here's my simple code: my %myhash; $line1 = "col1 0.999"; $line2 = "col2 0.899"; $line3 = "col2 -0.52"; $line4 = "col2 1.52"; #insert into…
user961627
  • 12,379
  • 42
  • 136
  • 210
2
votes
3 answers

Get numerical value at end of class name and store as variable using jQuery

Consider this menu output by a WordPress function:
2
votes
3 answers

lagrange approximation -c++

I updated the code. What i am trying to do is to hold every lagrange's coefficient values in pointer d.(for example for L1(x) d[0] would be "x-x2/x1-x2" ,d1 would be (x-x2/x1-x2)*(x-x3/x1-x3) etc. My problem is 1) how to initialize d ( i did …
George
  • 5,808
  • 15
  • 83
  • 160
2
votes
5 answers

Sorting a csv file in Python with sorted() returns values in programmer DESC order, not time DESC order

I'm not doing anything overly complex I believe. I'm presorting a large csv data file because it is full of data that arrives in random time order. The index is correct, but the return formatting is off. …
Mike
  • 23
  • 1
  • 4
2
votes
1 answer

Regex for numeric characters and .&-

I'm using C# and .NET and I have a Regex that looks like this "\D" That matches all non-numeric characters however I don't want that to match a decimal point (.) and a negative sign (-). How can I do that with regular expressions? So I tried…
Mark Lalor
  • 7,820
  • 18
  • 67
  • 106
2
votes
4 answers

C vs C++ numerical recipes

I started to read the book "numerical recipes in C"... I try make my programs more efficients and faster... So, is the same thing, to use C or C++? I know that C++ is a super-set of C... But, are there differences between "cmath" library (c++) with…
fpointbin
  • 1,633
  • 3
  • 16
  • 20
2
votes
1 answer

bash if greater than or equal to error

With the bash script below I am getting an error; line 16: [: : integer expression expected but I can't figure out why? The error lies in if [ "$(log_date)" -le "$days_in_ms" ]; then Can anyone help and explain as BASH if statements confuse…
eekfonky
  • 819
  • 4
  • 16
  • 33
2
votes
3 answers

R - Combine non numerical and numerical data together in the same cell in a dataframe

I want to combine cell values with numeric and character data into the same cell. Specifically, I'm trying to combine named columns with the 'SEM' columns, with a ± symbol in between, to eventually become a table I can publish with latex # A tibble:…
fiferworks
  • 23
  • 4
2
votes
2 answers

Numerical integration of symbolic function in Python

I am new to Python so some of my questions or ideas might be silly, but... I want to graph a distribution D(x). m and s2 are some given real numbers. I have been told that the best way to graph D(x) is to write a function which solves the integral…
Curious
  • 33
  • 1
  • 7