Skip to main content

All Questions

Tagged with
1 vote
1 answer
224 views

Converting float64 array to uint16 (Python)

I'm having trouble in a data type conversion from float64 to uint16. If I have an array of floats and I try to convert it with array_uint16 = array_float64.astype(np.uint16) is there a sort of "...
Leonardo Castello's user avatar
4 votes
0 answers
101 views

Why the outputs of a*a + a*a and a**2 + a**2 is different in Python?

a = 1e200 print(a) b = a*a + a*a print(b) c = a**2 + a**2 print(c) output: 1e+200 inf Traceback (most recent call last): File "d:\TUD\Materials\SPE\Session1\overflowerror.py", line 7, ...
Julius Hu's user avatar
0 votes
1 answer
37 views

When converting a string to an int, how do I check if there will be overflow?

I am trying to convert a string to a 32-bit int and I want to clamp numbers smaller than -2^31 to -2^31 and numbers bigger than 2^31-1 to 2^31-1. This is my code so far, but for some reason it is not ...
Anon's user avatar
  • 1
0 votes
0 answers
56 views

Overflow in solve_bvp during "simple" differential equation system

I would like to solve the following system of differential equation: d(phi)/dz= Rcl*i d(i)/dz = i0*exp(phi*2.3/b) I tried to solve this using solve_bvp from scipy and it didn't work. To check if a ...
Ingmar's user avatar
  • 1
2 votes
2 answers
93 views

Confusing on output result of numpy.power function

I am trying to learn numpy. At this page, I saw following code: import numpy as np arr1 = np.array([10, 20, 30, 40, 50, 60]) arr2 = np.array([3, 5, 6, 8, 2, 33]) newarr = np.power(arr1, arr2) print(...
Masoud's user avatar
  • 615
0 votes
0 answers
24 views

Avoiding numerical overflow in unavoidable exponent calculation

I am having difficulty doing a Nernst modification to convert a voltage to a concentration gradient. I have attempted this: def calc_voltage_offset(self,config): Voltage = 350 #Voltage in mV, ...
Confused_scientist's user avatar
1 vote
1 answer
139 views

Why does numpy handle overflows inconsistently?

How come the following test works fine on Windows, but fails on Linux: import numpy as np print(f"Numpy Version: {np.__version__}") # version A versionA = np.eye(4) versionA[:3, 3] = 2**32 ...
FirefoxMetzger's user avatar
0 votes
0 answers
23 views

How can I set my x higher? I need it to be at least 1000e8, but the I get a overflow error

How do I prevent the Overflow Error? It only happens once I set my x higher than 400e4 I need it to go at least to 1000e5 I need the derivative of the function f and after that I would like to plot it ...
Daniel123's user avatar
0 votes
0 answers
23 views

Python Overflow while trying to code the RSA cryptosystem

I'm trying to code the cryptosystem RSA for school and i have an overflow problem. It is happening when i'm trying to decode de message by doing (m^d)%n.
Hugo's user avatar
  • 1
2 votes
2 answers
231 views

Avoid overflow in random matrix multiplication in python

I have to multiply many (about 700) matrices with a random element (in the following, I'm using a box distribution) in python: #define parameters μ=2. σ=2. L=700 #define random matrix T=[None]*L ...
kBoltzmann's user avatar
0 votes
1 answer
251 views

Pandas - OverflowError : Python int too large to convert to C long

Data = pd.read_csv(file) I'm getting overflow error:python int too large to convert to C long, while read a csv file of 6.25GB. Working fine with files less than 2GB.
Mohammed shadab's user avatar
1 vote
1 answer
30 views

Overflow encountered when evaluating string

I got this error when I am trying to evaluate an expression f(x1, x2, ...) from a string based on given x1, x2, ... I = eval(string) <string>:1: RuntimeWarning: overflow encountered in ...
asdfgh's user avatar
  • 21
-3 votes
1 answer
175 views

Normaliztion in linear regression (gradient descent) [closed]

I am writing a simple (gradient descent) code for linear regression with multi variables data set, my problem was that when I was testing the code I noticed that the cost still decreasing after 5 ...
Karim Ahmed's user avatar
1 vote
2 answers
701 views

How to add scrollbar to Python Folium popup?

How do you add a vertical scrollbar to a Python Folium map popup? I have too much information to display that the popup spans the entire screen currently.
testytesttest's user avatar
1 vote
1 answer
75 views

(34, 'Numerical result out of range') calculating Annual Percentage Rate with scipy

I am trying to solve Annual Percentage Rate in Python using scipy library and newton method. At some point Python reaches max Pythonic float range solving this equation: Here is example code with ...
Martin Reguly's user avatar

15 30 50 per page
1
2 3 4 5
11