Error in the integrating function of the MUESLI digital library

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

digital sorting but keeping the duplicates

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).

How to sort data from a csv file numerically to python

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

How to calculate an exponent in matlab without having inf?

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

Overall overload of == and! = For floating points

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

segmentation error 11 in mac, but not in Linux, gcc compiler

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

Force different characters at different positions

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

Numerical optimization and minimization

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

Python arithmetic with small numbers

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

How to write fast code (low level)?

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

C vs C ++ digital recipes

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

Numeric error in simple CUDA code

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

Python floating number

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

Use logarithms to normalize a vector to avoid overflow

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],

Javascript to convert the string to a number?

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);

Java digital libraries

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

How to use TDD correctly to implement a numerical method?

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

Three-dimensional networks effective in C calculation

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

Open source alternative to the fmincon function of MATLAB?

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

How to test numerical analysis routines?

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