3,197 questions
3
votes
2
answers
192
views
How to compare the numerical precision of two different tensors
I'm trying to compare the output of two tensors with different numerical precisions: one in float64 (fp64) and the other in float32 (fp32). Both tensors are computed from the same inputs and represent ...
0
votes
0
answers
61
views
Sum of integer data and numeric data is unexpected numeric value, R [duplicate]
Why is the sum of the iaea_mass_dat_trunc$AM_WN (integer) and iaea_mass_dat_trunc$AM_frac (numeric) 499496.6 for all results? How do I get the appropriate result (for example, the sum of the values in ...
0
votes
2
answers
144
views
.NET MAUI Numeric Entry accept dot and comma as decimal separator
Is there a way to accept dot and comma as a decimal separator in an numeric entry field?
From the keyboad it is not allowed to enter a dot in a german enviorment.
<Entry Text="{Binding LVK}&...
1
vote
1
answer
105
views
R and Desmos produce different results on the same numerical integration problem
I would like to compute the following quantity, which is the reciprocal of an integral. I first compute it on Desmos :
Then I compute the very same quantity on R using integrate :
set.seed(1234)
...
1
vote
1
answer
68
views
Reducing to Hessenberg form using Givens rotations
I'm trying to implement a function in Python that reduces a square matrix to upper Hessenberg form using Givens rotations. I know that this should be possible Wiki and sometimes preferred over ...
1
vote
1
answer
70
views
Why isn't the array that I create in R being able to convert into a raster?
I am trying to plot a Hovmoller diagram using NetCDFs from Copernicus database. I am trying to plot it for one specific point (lon,lat). When I create a database for this with all depth values and all ...
4
votes
1
answer
144
views
In Haskell, why toRational (1/0) == infinity is False?
I couldn't find documentation for this behaviour and it looks like a bug ([Edit] it is indeed : gitlab.haskell.org/ghc/ghc/-/issues/10387). Am I missing something ?
In GHCi :
> import GHC.Real
...
-3
votes
1
answer
153
views
sort json object numerically by key
I have the following json format. It's basically a representation of the calendar:
{"month1": {"day1":{...}, "day2": {...}}, "month2": {...}}
I'd like to sort ...
0
votes
0
answers
103
views
Apache Calcite with PostgreSQL: “DECIMAL precision 0 must be between 1 and 19” Exception
I am using Apache Calcite 1.38.0 along with the PostgreSQL JDBC driver version 42.7.2. When executing an SQL query through a JdbcSchema connection to my PostgreSQL database, I encountered an exception....
0
votes
0
answers
27
views
The number of derivatives returned by func() (x) must equal the length of the initial conditions vector (y)
I'm trying to define a parameter in my mathematical model "z", where my model is a system of ordinary differential equations, which is then solved using the function "ode" of the ...
0
votes
0
answers
51
views
Jacobi method converges faster than Gauss-Seidel in case of Laplace equation
It is need to solve the problem using the Jacobi method: d^T/dx^2 + d^2T/dy^2 = 0 with conditions at the boundaries of the square:
T(0, y) = 1, T(x, 1) = 1, dT/dx(1, y) = 1 - y, dT/dy(x, 0) = x.
...
0
votes
1
answer
145
views
How to find the index of the minimum cumulative sum in the face of floating-point rounding errors?
Call arr an array of float64 between −1 and 1. I want to find the index of the minimum of the cumulative sums of arr. My problem is that I cannot do this easily as the numbers in arr are of very ...
0
votes
0
answers
35
views
Adding a NumericUpDown to a menu?
Windows Forms has a control NumericUpDown that allows the user to choose a number by clicking tiny up and down arrows, or entering a number via keys.
Is there a way to add this functionality, but ...
0
votes
1
answer
105
views
Problem in converting the datatype of a column in PostgreSQL
I created a whole text table to avoid problems in the import of the csv. After that I changed the data cleanup to "," in "." as number dividers to avoid problems with the delimiter....
0
votes
0
answers
38
views
Partial derivative of logistic function for Levenberg-Marquardt
I am trying to write code that will fit logistic function to set of data. I am using Levenberg-Marquardt routine (as given in Numerical Recipes 3rd edition) and that requires me to supply a function ...
4
votes
1
answer
116
views
How to compute sign(a² - b * c) * sqrt(abs(a² - b * c)) accurately with floating point arithmetics?
Question
I was wondering if there is a numerically accurate way to compute
sign(a² - b * c) * sqrt(abs(a² - b * c))
with floating point arithmetics because it suffers from (ordered from most to least ...
0
votes
1
answer
85
views
polynomial evaluation producing non-differentiable behavior in Python
I'm trying to evaluate a polynomial of degree 61. However, around the point sqrt(2) I get some weird behavior. The graph of the polynomial becomes erratic. What could be the reason for this. The ...
0
votes
1
answer
50
views
How to prevent non-numeric characters being put inside an input box
I am new to TypeScript and currently I am designing a BMR calculator. I have created a handleNumericInput function that only allows numbers to be accepted inside an input box but the problem is when I ...
0
votes
2
answers
198
views
Why 5.0 / 2 returns 2.5000000000000000 (scale of 16) instead of 2.5 (scale of 1)?
Fiddle
select 5.0 / 2
, pg_typeof(5.0 / 2);
pg_typeof
2.5000000000000000
numeric
Why the result is 2.5000000000000000?
When we insert 2.5 into a numeric column or select 2.5 from a numeric column ...
0
votes
3
answers
116
views
How can I extract the numeric portion before the first letter in a FileMaker calculation?
I have a field called Serial Number in FileMaker, and I need to extract the numeric portion of the string that appears before the first letter (A-Z), after removing the first 6 characters.
Here's the ...
5
votes
2
answers
101
views
How do I decode a bit string representing a n-digit number, where the 'n' digits were grouped and encoded in bit words of different lengths?
Background
I am trying to decode a bitstring from a QR-Code, where the data was encoded in numeric mode. According to this QR-Code tutorial: https://www.thonky.com/qr-code-tutorial/numeric-mode-...
1
vote
1
answer
85
views
Unexplained gain in my code when solving coupled differential equations using solve_ivp() in python
I am trying to solve two coupled differential equations in python using the solve:ivp() function from scipy.integrate but I get an unexplained gain on one of my terms that breaks the equation. It is ...
1
vote
3
answers
164
views
With IEEE 754 floating point numbers, is underflow still better than overflow? [closed]
In his classic works from the 1970s, Richard Hamming advises setting up floating point calculations to be more likely to underflow than overflow.
For example, if you want to calculate 1 - 1/(exp(x)+1),...
1
vote
1
answer
98
views
Specify number length and precision in materialized view, starting from a pivot
I have a problem with a materialized view in Oracle: I don't know how to specify the length and precision of the numeric fields.
This is an example code of the creation of the materialized view:
...
0
votes
0
answers
39
views
Optimizing a numerical integration that involves matrices using sympy
The expression I'm integrating is
Where the latent variables are sampled from the a multivariate distribution as following:
And the random variables w_n given a latent variable is sampled from a ...
1
vote
2
answers
120
views
Simple 1 D dispersion equation numerical solution
I am new to coding and trying to solve a simple 1D dispersion equation.
The equation and boundary conditions:
adC/dx = bd^2C/dx^2
x = hj, C = C0; x = - inf, C =0
The analytical solution is
C = C0 * ...
2
votes
1
answer
94
views
How can I approximate 255/sqrt(x) using Newton's method?
I am trying to approximate 255 / sqrt(x) using Newton's method to avoid using division or the sqrt() operation on an architecture where those operations are expensive.
My derivation is:
y = 255 / sqrt(...
1
vote
0
answers
73
views
How to efficiently integrate over a hexagonal region using Cubature in python?
I need to integrate a two-variable function numerically using the Cubature package in Python. The two-dimensional region over which I want to integrate is a hexagon. Integrating it in a circular ...
1
vote
3
answers
228
views
How can I convert a list to numerical in r?
I am using the following data and have come across a roadblock.
I used read.csv to import my raw data into r.
# from OHP$ohp17.value
list(NULL, NULL, "19.9 nmol/L", "0.7 nmol/L", ...
0
votes
0
answers
66
views
Allow decimal in an input
I am working on a little project with Angular, the input from a form doesn´t let me introduce a decimal value, like 23.5. I don´t know if something is wrong, here is the code:
<div class="form-...
0
votes
1
answer
36
views
"Stock" converted to a numeric value
Stock should be converted to a numeric valueBy replacing {stock[1]} by "available " to 100, and "limited stock" to 10, "out of stock" to 0. The idea is to work with ...
0
votes
1
answer
251
views
Problem with Leetcode SQL task - Game Play Analysis IV
I'm trying to solve Leetcode SQL 50 task called "Game play analysis IV":
Table: Activity
player_id - int,
device_id - int,
event_date - date,
games_played - int
This table shows the ...
0
votes
2
answers
297
views
"ERROR: invalid input syntax for type numeric: NULL" postgresql
I'm starting to learn sql in porstgresql. I have create a table with numeric(6,2) structure and trying to import data. But data has some row that has NULL value. Now I'm getting "ERROR: invalid ...
0
votes
2
answers
101
views
GCP Pub/Sub to BigQuery writing incorrect value to NUMERIC column
I'm publishing JSON to Pub/Sub in the following format:
{"reading":"11202.8"}
Numbers are encoded as strings to force explicit precision. This get written to BigQuery using a Pub/...
1
vote
2
answers
213
views
vectorize an Ax=b solver
A lot of numerical solvers (such as this one), for some reason, only supports solving Ax=b where x, b are vectors.
What if I want to solve AX = B, where X and B are matrices.
I know numerically one ...
1
vote
1
answer
131
views
Finding largest root of a function in R
I have a function that is data generated and not a polynomial. For most data, it only has one root, but it can also have two roots, as in in the following plot:
uniroot() tends to fail because the ...
1
vote
1
answer
100
views
CFD Navier-Stokes Equation in Julia
so below is the code snippet i have for Julia:
using Printf
using Plots
gr()
# Parameters definition
Ny = 21 # Number of points in y-direction
Aspect_ratio = 10 # Ratio of ...
-3
votes
1
answer
95
views
How to Display All Repetitive Digits from a String ? in vb.Net
String = 24-06-1966
repetitive Nos to be displayed 6, 6, 6
Non-Repetitive Nos to be displayed 2, 4, 1, 9
Hello
If someone can help me to get or displayed Repetitive digits from Numeric String
...
1
vote
1
answer
54
views
R issue with reshape, reshape is not ordering columns correctly
I am trying to use reshape function in R to arrange my data timepoints in a table. The variable that I am using to split it is numerical, but when reshape arranges the table it incorrectly puts 2,0.5,...
0
votes
1
answer
137
views
How to evaluating solutions to Coupled Nonlinear Elliptic ODEs with Relaxation Method?
I would like to determine the following system of coupled, nonlinear, elliptic ODEs of second order with boundary conditions f(0) = h(0) = 0, f(1) = h(1) = 1.
I used a relaxation method to solve the ...
0
votes
0
answers
100
views
GA4 changing values to numeric changes the values
Bascially, i have a code that filters the data coming from the API. The data is reasonable, however, the values of the active Users are in string format. Once I changed them (to integers), my max ...
0
votes
3
answers
109
views
running sum of np.array with widely varying elements
I need to calculate the running sum of np.array. Let's say a is a given np.array of length l and n is an integer step, then I need an array b of length l - n + 1, where
b= [a[0]+a[1]+...+a[n-1], a[1]+...
1
vote
1
answer
497
views
Byte size of numeric(precision, scale) in Postgres
Given that the size is variable, I am trying to calculate the average cost of a numeric(p, s) attribute. In my case, numeric(10, 2).
From what I understand of the Postgres documentation, this means I ...
0
votes
0
answers
45
views
error bound for linear interpolation of lipschitz
Let f be a Lipschitz function. Do we have any error bound for its linear interpolation?
Any reference is appreciated. We do not know whether f is differntiable, all we know it is convex in a compact ...
2
votes
1
answer
700
views
Solving coupled 2nd order ODE, numerical in Python
I would like to solve the following DGL system numerically in python:
The procedure should be the same as always. I have 2 coupled differential equations of the 2nd order and I use the substitution g'...
4
votes
1
answer
80
views
Problems to solve non-linear coupled dgl in python (numerical)
I have the following problem. I would like to solve the following DGL system numerically in python:
$$
\begin{align*}
&g'' + \frac{2}{r} g' - \frac{2}{r^2} g - \frac{3}{r} e g^2 - e^2 g^3 - \frac{...
1
vote
2
answers
147
views
How to prevent the program from returning 'inf'?
I am working on a famous classical physics problem: - the three body problem. I have made the follwoing program : -
#include <math.h>
#include <iostream>
using namespace std;
class ...
0
votes
0
answers
88
views
Apply Crank-Nicolson method to wave equation with np.linalg.solve
I want to solve a system of equations, where x,y are the vectors which I want the solutions. And c,d are the solutions. A,B are matrix
x-y=c+d
y-Ax=Bd+c
The full problem which I tried to summarize ...
0
votes
2
answers
365
views
RAML validation for json array
In my API RAML, there is a query parameter named 'sfIds' which is an array type. I need to implement validation within the RAML to ensure that the array elements are always numeric, such as [111, 222, ...
1
vote
1
answer
146
views
Multiple polynomial regression in C#
So I need to fit some vectorized data into a 3rd degree polynomial, however I can't find any libraries in C# that are able to do that.
Essentially, x is a vector with 3 elements ([R, G, B]), and the ...