numerical

Numerical integration using Simpson's Rule on discrete data

╄→гoц情女王★ 提交于 2019-12-06 10:44:42
问题 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 input. My data is all discrete and one-dimensional. Is that any way to use quad on my data? Thanks. 回答1: An answer to your question would be no. The only way to perform numerical integration for data with no expression in Matlab is by using the trapz

Java / Scala math library with elliptic integrals and bessel functions?

為{幸葍}努か 提交于 2019-12-06 05:29:05
问题 I am looking for a math library for scientific computing to use in Java / Scala. Especially I need complete elliptic integrals und modified Bessel functions. I would be nice if it is open source, but I guess I will have to take whatever is out there. A scipy (python lib for scientific computing) replacment would be great :-) 回答1: As far as I'm aware, the most widely used Java math libraries are: The Apache Commons Math library, and The Colt project (developed by CERN) You'll have to

What is the limit of the Value Type BigInteger in C#?

倖福魔咒の 提交于 2019-12-05 18:20:21
问题 As described in MSDN BigInteger is : An immutable type that represents an arbitrarily large integer whose value in theory has no upper or lower bounds. As I can see BigInteger is a ValueType , as much as I know, a ValueType must have a maximum size of 16 bytes . MSDN goes further saying : an OutOfMemoryException can be thrown for any operation that causes a BigInteger value to grow too large. and more : Although this process is transparent to the caller, it does incur a performance penalty.

Numerical instability FFTW <> Matlab

独自空忆成欢 提交于 2019-12-05 03:31:02
I am trying to numerically solve the Swift-Hohenberg equation http://en.wikipedia.org/wiki/Swift%E2%80%93Hohenberg_equation using a pseudo-spectral scheme, where the linear terms are treated implicitly in Fourier space, while the nonlinearity is evaluated in real space. A simple Euler scheme is used for the time integration. My problem is that the Matlab code I have come up with works perfectly, while the C++ code, which relies on FFTW for the Fourier transforms, becomes unstable and diverges after a couple thousand time steps. I have tracked it down to the way the nonlinear term is treated

OpenCV:src is not a numerical tuple

强颜欢笑 提交于 2019-12-05 02:36:33
I've written a program about color detection by using python. But always there's an error around the 'Erode' sentence. Here's part of my program. Thank you. # Convert the image to a Numpy array since most cv2 functions # require Numpy arrays. frame = np.array(frame, dtype=np.uint8) threshold = 0.05 #blur the image frame=cv2.blur(frame, (5,5)) #Convert from BGR to HSV hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) #split into 3 h, s, v= cv2.split(hsv) #red color s = cv2.threshold(h, 15, 1, cv2.THRESH_BINARY_INV)#1-15,x>15 y=0 h = cv2.threshold(h, 245, 1, cv2.THRESH_BINARY)#245-255 x>245 y=1 h = h

How can I add floats together in different orders, and always get the same total?

旧巷老猫 提交于 2019-12-04 22:35:08
问题 Let's say I have three 32-bit floating point values, a , b , and c , such that (a + b) + c != a + (b + c) . Is there a summation algorithm, perhaps similar to Kahan summation, that guarantees that these values can be summed in any order and always arrive at the exact same (fairly accurate) total? I'm looking for the general case (i.e. not a solution that only deals with 3 numbers). Is arbitrary precision arithmetic the only way to go? I'm dealing with very large data sets, so I'd like to

Identifying common periodic waveforms (square, sine, sawtooth, …)

China☆狼群 提交于 2019-12-04 11:44:17
问题 Without any user interaction, how would a program identify what type of waveform is present in a recording from an ADC? For the sake of this question: triangle, square, sine, half-sine, or sawtooth waves of constant frequency. Level and frequency are arbitrary, and they will have noise, small amounts of distortion, and other imperfections. I'll propose a few (naive) ideas, too, and you can vote them up or down. 回答1: You definitely want to start by taking an autocorrelation to find the

Java / Scala math library with elliptic integrals and bessel functions?

南笙酒味 提交于 2019-12-04 09:53:35
I am looking for a math library for scientific computing to use in Java / Scala. Especially I need complete elliptic integrals und modified Bessel functions. I would be nice if it is open source, but I guess I will have to take whatever is out there. A scipy (python lib for scientific computing) replacment would be great :-) As far as I'm aware, the most widely used Java math libraries are: The Apache Commons Math library , and The Colt project (developed by CERN ) You'll have to investigate their respective APIs though to determine if they provide exactly the functionality you require. I know

Sort a python list of strings with a numeric number

拈花ヽ惹草 提交于 2019-12-04 06:59:55
问题 I have a list of filenames called filelist In []: filelist Out []: ['C:\\Mon20412\\P-2NODE-RAID6-1BLACK-32k-100-segmented.xlsx', 'C:\\Mon25312\\P-2NODE-RAID6-13RED-32k-100-segmented.xlsx', 'C:\\Mon20362\\P-2NODE-RAID6-2GREEN-32k-100-segmented.xlsx'] I want to sort this filelist by the numerical value that is in the bolded position C:\Mon20412\P-2NODE-RAID6- 1 BLACK-32k-100-segmented.xlsx C:\Mon25312\P-2NODE-RAID6- 13 RED-32k-100-segmented.xlsx C:\Mon20362\P-2NODE-RAID6- 2 GREEN-32k-100

Is there a way to reduce scipy/numpy precision to reduce memory consumption?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 05:48:14
On my 64-bit Debian/Lenny system (4GByte RAM + 4GByte swap partition) I can successfully do: v=array(10000*random([512,512,512]),dtype=np.int16) f=fftn(v) but with f being a np.complex128 the memory consumption is shocking, and I can't do much more with the result (e.g modulate the coefficients and then f=ifftn(f) ) without a MemoryError traceback. Rather than installing some more RAM and/or expanding my swap partitions, is there some way of controlling the scipy/numpy "default precision" and have it compute a complex64 array instead ? I know I can just reduce it afterwards with f=array(f