math

Simulating mouse move in Math Input Panel (Windows 7)

I would like to compare my application for handwritten mathematical symbols recognition with the Math Input Panel (MIP) contained in Windows 7. I have a library of recorded mouse strokes representing different mathematical formulas and I need to send them to the MIP to measure its performance. I tried to simulate mouse move but it's not...

Function plotting library for java

Hi, I need to plot a 2 argument function (so I need a 3D plot) - ideally Mathematica style with nice colours for different values, which I will then use in a Latex document. I would prefer to get a vector output (i.e. EPS), so that it prints nicely. Please note that I will not display it on the screen (my app runs as a batch job). ...

Javadoc with Equations?

I'm only familiar with the no-frills javadoc generator, however I'd like to include some mathematical equations in my javadoc (rather than constantly referencing another document). Is there a convenient option to do something like include/properly render LaTeX (most preferred - then I could just cut-n-paste) or MathML tags? ...

What's the best way to maintain significant digits in calculation?

Let's say you want to convert from degrees to radians: radians = degrees * (pi / 180) If pi is considered a constant for the purpose of this calculation, then the resulting radians value should have the same number of significant digits as the initial degrees. I.E. -32.39 degrees = -0.5653 radians # 4 significant digits -32.3...

Is there a Calculus library for JavaScript?

Does anyone know of a Calculus library for JavaScript? I've done some Googling and haven't come up with anything. I applied for the WolframAlpha API, but that's expensive unless they choose to give me a grant. Ideally, I could feed an Array of 2d points into a function, and get back the graph (Array) of points of the derivative. If s...

I have a 4 x 4 grid how can i programmatically work out if a random number is the far right square

so say i have a grid: 0 - 1 - 2 - 3 4 - 5 - 6 - 7 8 - 9 - 10 - 11 12 - 13 - 14 - 15 (but will be more rows...) how can i find out programmatically if a random number (within the range of the numbers) is equal to the far right number: 3,7,11,15...? thanks ...

Fast lookup for dictionary vector to a given vector. High dimensions

I'm looking for an answer that scales, but for my specific purpose, I have a 48th dimension vector. This could be represented as an array of 48 integers all between 0 and 255. I have a large dictionary of these vectors, approximately 25 thousand of them. I need to be able to take a vector that may or may not be in my database, and qui...

Calculating determinant of a matrix

I need an recursive algorithm to calculate determinant of n*n matrix. ...

What type of variable do I use to store mathematical operator?

I'm trying to put buttons that have operators on them, like / * +, etc. I want to store the operator in such a way that I can use it in an expression, like 1 var 2 = 8 I would like to avoid having to use a different method for each operator, so an operator var would be my best option, I think. Objective-C for iPhone ...

Maths library for Java

What is the best library for Java to do numeric stuff like calculating integrals, finding roots of a function, calculating different probability cdf's, etc.? ...

Fibonacci Sequence in C

This is the expected output: We are to make a C program that calculates for the Fabonacci Sequence. We're only allowed up to 3 variables and we're NOT allowed to use loops. And I don't know what to do and how to start. I hope you guys can help me. :/ ...

How to save decimal in java

Having the following code in Java: double operation = 890 / 1440; System.out.println(operation); Result: 0.0 What I want is to save the first 4 decimal digits of this operation (0.6180). Do you know how can I do it? ...

Graph recognition software

ISGCI lists a lot of graph classes, many of which are recognizable in polynomial time. Is anyone here aware of actual implementations of these algorithms? ...

Can I randomize an array by providing a seed and get the same order?

I am trying to create a random string based on a fixed string. I'd like to be able, if at all possible, create the same random string (i know its an oxymoron) provided I use the same seed. like so: $base = '0123456789abcdef'; $seed = 'qwe123'; function getRandStr($base, $seed) { } such that so long as I give the same $base and $seed ...

Calculating window dragging and skewing in JavaScript

Hi, I am using JavaScript and trying to make a skew effect on a div. First, take a look at this video: http://www.youtube.com/watch?v=ny5Uy81smpE (0:40-0:60 should be enough). The video shows some nice transformations (skew) when you move the window. What I want to do is the same thing: to skew a div when I move it. Currently I just h...

opposite of enum (using formula) (objective-c)

I have 4 numbers 0-3 which is an enum (objective-c) and I'd like to get the opposite using a formula. So if 0 is put into the formula it returns 2 and if it 2 is entered then it returns 0 (and same with 1 and 3). The reason being (and it is programming related) that I want to get the opposite of an enum without having to do an if or swi...

Implementing automatic differentiation for 2nd derivative: algorithm for traversing the computational graph?

I am attempting to implement automatic differentiation for a Python statistics package (the problem formulation is similar to optimization problem formulations). The computational graph is generated using operator overloading and factory functions for operations like sum(), exp(), etc. I have implemented automatic differentiation for ...

SQL abs calculation - using latitudes and longitudes - MATH!

I've got an sql query that pulls locations from a database based on coordinates within a certain range. Now I'm trying to order them by proximity with a bit of math - but no matter how many times im writing it out on paper I can't seem to figure out a working solution. lets describe a few variables: $plat (the latitude of the place) ...

Voronoi diagram using custom (great circle) distance

I want to create a Voronoi diagram on several pairs of latitudes/longitudes, but want to use the great circle distance between them, not the (inaccurate) Pythagorean distance. Can I make qhull/qvoronoi or some other Linux program do this? I considered mapping the points to 3D, having qvoronoi create a 3D Voronoi diagram[1], and in...

How to force a number to be in a range in C#?

Hi, In C#, I often have to limit an integer value to a range of values. For example, if an application expects a percentage, an integer from a user input must not be less than zero or more than one hundred. Another example: if there are five web pages which are accessed through Request.Params["p"], I expect a value from 1 to 5, not 0 or...