Questions tagged [numeric]

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.

2593 questions
21
votes
4 answers

More on generic Scala functions

Trying to implement, in Scala, the following Haskell function (from Learn You a Haskell...) so that it works with Int, Double, etc. doubleUs x y = x * 2 + y * 2 Note that this is similar to Scala: How to define "generic" function…
eptx
  • 801
  • 7
  • 17
21
votes
2 answers

How do get only numeric recaptcha?

I need to show only the numeric reCaptha instead of character strings. Is it possible? If yes, please give the procedure. Like Google's Street view
Manikandan
  • 590
  • 2
  • 4
  • 13
21
votes
1 answer

Jquery check if value is numeric

I was wondering if anybody had a quick and dirty jquery method that will check if a value is numeric or not? I was thinking about using a regex type method to check the value, if not do not submit the form. I was using jquery validation, but I am…
SoftwareSavant
  • 9,467
  • 27
  • 121
  • 195
20
votes
6 answers

React Native - how to key number pad ONLY (without punctuations)

Is there a way to key a numeric keypad without punctuations? if I use secureTextEntry={true}, it gets the right keyboard I want, but the values are replaced with *. so, this is what im getting: This is…
Raheel Hasan
  • 5,753
  • 4
  • 39
  • 70
20
votes
2 answers

No dimensions of non-empty numeric vector in R

I have a problem with my numeric vector and dim() in R. I want to know the dimensions of my vector X with: dim(X) However, that function returns NULL. If I type: X I can see that the X is not empty. Why does dim or nrow report it as "NULL"? Part…
user1261558
  • 369
  • 1
  • 2
  • 11
19
votes
7 answers

How to check if a string column in pyspark dataframe is all numeric

I have a PySpark Dataframe with a column of strings. How can I check which rows in it are Numeric. I could not find any function in PySpark's official documentation. values = [('25q36',),('75647',),('13864',),('8758K',),('07645',)] df =…
cph_sto
  • 7,189
  • 12
  • 42
  • 78
18
votes
4 answers

Numeric TextField for Integers in JavaFX 8 with TextFormatter and/or UnaryOperator

I am trying to create a numeric TextField for Integers by using the TextFormatter of JavaFX 8. Solution with UnaryOperator: UnaryOperator integerFilter = change -> { String input = change.getText(); if (input.matches("[0-9]*")) { …
ShadowEagle
  • 490
  • 1
  • 4
  • 15
18
votes
4 answers

Merge pdf files with numerical sort

I am trying to write a bash script to merge all pdf files of a directory into one single pdf file. The command pdfunite *.pdf output.pdf successfully achieves this but it merges the input documents in a regular…
max
  • 449
  • 1
  • 5
  • 10
18
votes
3 answers

Determine if DataColumn is numeric

Is there a better way than this to check if a DataColumn in a DataTable is numeric (coming from a SQL Server database)? Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetStoredProcCommand("Get_Some_Data"); DataSet ds =…
JustinStolle
  • 4,182
  • 3
  • 37
  • 48
18
votes
2 answers

Is there a datatype "Decimal" in R?

I read data stored in the format DECIMAL from a MySQL-Table. I want to do calculations on those numbers within R. I used to cast them to a numeri represaentation using as.numeric(), but the documentation says: numeric is identical to double (and…
R_User
  • 10,682
  • 25
  • 79
  • 120
17
votes
5 answers

How to convert Python decimal to SQLite numeric?

I have a program that reads financial data in JSON and inserts it into an SQLite database. The problem is when I'm inserting it into SQLite numeric column and it doesn't seem to like the decimal object. I've found this question answered before, but…
wting
  • 900
  • 2
  • 13
  • 27
17
votes
3 answers

Cannot convert string to float in pandas (ValueError)

I have a dataframe created form a JSON output that looks like this: Total Revenue Average Revenue Purchase count Rate Date Monday 1,304.40 CA$ 20.07 CA$ 2,345 1.54 % The value stored are received as…
John_Mtl
  • 349
  • 2
  • 4
  • 13
17
votes
4 answers

how to find global minimum in python optimization with bounds?

I have a Python function with 64 variables, and I tried to optimise it using L-BFGS-B method in the minimise function, however this method have quite a strong dependence on the initial guess, and failed to find the global minimum. But I liked its…
dilyar
  • 251
  • 1
  • 3
  • 11
17
votes
7 answers

Cast string to either int or float

I'm looking for a function that would cast a numeric-string into either integer or float type depending on the content of the string, e.g. "1.23" -> float 1.23, "123" -> int 123. I know I can use if-s with is_int, is_float and cast to appropriate…
ducin
  • 25,621
  • 41
  • 157
  • 256
17
votes
3 answers

Float to Double conversion - Best assertion in a unit test?

Given the statements float f = 7.1f; double d = f; What can we assert in a unit test about d? For example this does not work: Console.WriteLine(d == 7.1d); // false Console.WriteLine(d < 7.1d + float.Epsilon); // true by luck Console.WriteLine(d >…
citykid
  • 9,916
  • 10
  • 55
  • 91