I am trying to use the numerical integration function of the MUESLI library, mfOdeSolve, but I get a compilation error. Just like in the example (#4-52) of the user's guide, I divided the code into a main program and an external module: Main: program

I'm sorting a file numerically with almost nine hundred lines. For others the commands tr '\r' '\n' < myfile.txt | sort or tr '\r' '\n' < myfile.txt | sort -n seems to do the trick, but for me, I don't get the output I want (only two hundred lines).

Say I have an almost degenerate 2-D polygon such as: [[40.802,9.289],[40.875,9.394],[40.910000000000004,9.445],[40.911,9.446],[40.802,9.289]] For reference this looks like: If I use the standard centroid algorithm as shown on Wikipedia, for example t

I am writing a program that takes students scores from a csv file and needs to sort then highest to lowest score. the csv file looks like this: josh 12 john 6 fred 8 harry 7 i have tried to put the items in a list like this: Mylist=[] csvfile = open

This question already has an answer here: Does Python have a built in function for string natural sort? 13 answers Sorting integers in a csv file - python 2 answers Hi guys I was having some trouble making a code that arranges a .txt file in numerica

The title says it all: I want to calculate an exponent in matlab with big numbers, but I get overflow and it just returns infinity. >> 100^1000 ans = Inf Last time I checked, 100^1000 is decidedly smaller than infinity :)Working with 64bit floating

Is it a bad practice to overload global operator == and != for floating points ? I'm using fast floating-points in a game environement, and i was thinking about using fuzzy comparison everywhere as i can't imagine a situation where i don't expect ext

I have a code which uses standard routines of numerical recipes for finding eigen vectors of a 3x3 matrix. While the code runs perfectly on linux machines, it fails with a segmentation fault 11 on mac. With gdb, when I back tracked I find that Progra

I'm currently working on a project in which I need to fetch street/city details from a DB using a zipcode. Dutch zipcodes use a "1111 AA" format, I would like to have this entered in a single input field while forcing the first four characters t

What is a tight lower-bound on the size of the set of irrational numbers, N, expressed as doubles in Matlab on a 64-bit machine, that I multiply together while having confidence in k decimal digits of the product? What precision, for example could I

Lets say I have a reference node R and several test nodes T1, T2.... Tn. Any particular node has a set of properties Rp1, Rp2, ... Rpn and T1p1, T1p2, T1p3, ... T1pn, and T2p1, T2p2, T2p3, ... T2pn, and so on. So, any node can have n properties, each

I am getting the following unexpected result when I do arithmetic with small numbers in Python: >>> sys.float_info sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-3

Is it possible in Java code to divide two obtained values from two EditText boxes in an android app, and then divide them by each other to create a result? Pretty much, the consumer of my application will be asked for two DIFFERENT, numerical values

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

I would like to learn more about low level code optimization, and how to take advantage of the underlying machine architecture. I am looking for good pointers on where to read about this topic. More details: I am interested in optimization in the con

Consider this menu output by a WordPress function: <ul id="header-cats"> <li class="cat-item cat-item-6"><a href="url" title="View all posts filed under Category I">Category I</a> </li>

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" libra

I just started experimenting cuda with the following cude #include "macro.hpp" #include <algorithm> #include <iostream> #include <cstdlib> //#define double float //#define double int int RandomNumber(){return static_cast<dou

I am experiencing problems when I compare results from different runs of my Matlab software with the same input. To narrow the problem, I did the following: save all relevant variables using Matlab's save() method call a method which calculates somet

i am kind of confused why python add some additional decimal number in this case, please help to explain >>> mylist = ["list item 1", 2, 3.14] >>> print mylist ['list item 1', 2, 3.1400000000000001] Floating point numbers are a

Problem with arithmetic using logarithms to avoid numerical underflow (take 2) Having seen the above and having seen softmax normalization I was trying to normalize a vector while avoiding overflow - that is if I have an array x[1], x[2] x[3], x[4],

var str = '0.25'; How to convert the above to 0.25?There are several ways to achieve it: Using the unary plus operator: var n = +str; The Number constructor: var n = Number(str); The parseFloat function: var n = parseFloat(str);

Most of my code is in Java. For standardized algorithms: matrix operations, FFT, ... I would prefer to not use my own pure Java implementations, and are perfectly happy using unsafe FFI/JNI calls. What are the libraries I should look into? Thanks!CER

In Scala, I'd like to be able to write generic classes which use operators like >, /, * etc, but I don't see how to constrain T such that this will work. I looked into constraining T with Ordered[T], but that doesn't seem to work since only RichXXX (

I am trying to use Test Driven Development to implement my signal processing library. But I have a little doubt: Assume I am trying to implement a sine method (I'm not): Write the test (pseudo-code) assertEqual(0, sine(0)) Write the first implementat

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

I need to know if a number compared to a set of numbers is outside of 1 stddev from the mean, etc..While the sum of squares algorithm works fine most of the time, it can cause big trouble if you are dealing with very large numbers. You basically may

I am trying to solve numerically a set of partial differential equations in three dimensions. In each of the equations the next value of the unknown in a point depends on the current value of each unknown in the closest points. To write an efficient

Is there an open-source alternative to MATLAB's fmincon function for constrained linear optimization? I'm rewriting a MATLAB program to use Python / NumPy / SciPy and this is the only function I haven't found an equivalent to. A NumPy-based solution

Are there any good online resources for how to create, maintain and think about writing test routines for numerical analysis code? One of the limitations I can see for something like testing matrix multiplication is that the obvious tests (like havin