math

For RSA, how do i calculate the secret exponent?

For RSA, how do i calculate the secret exponent? Given p and q the two primes, and phi=(p-1)(q-1), and the public exponent (0x10001), how do i get the secret exponent 'd' ? I've read that i have to do: d = e-1 mod phi using modular inversion and the euclidean equation but i cannot understand how the above formula maps to either the a-1...

2D game algorithm to calculate a bullet's needed speed to hit target?

I have a rather simple bird's-view 2D game where tower sprites defend against incoming moving sprites by shooting a bullet at them. My question: How do I calculate the needed bullet speed for the bullet to reach its moving target, provided that the bullet will always have the same defined speed? I'm using JavaScript and have these sprit...

rotating a 2d square into another

Hi, I have two squares, S1 = (x1,y1,x2,y2) and S2 = (a1,b1,a2,b2) I'm looking for the A transformation matrix with which A * S1 = S2 As far as I see, A is an affine 3x3 matrix, so I have 9 unknown values. How can I calculate these values? thanks and best, Viktor ...

generating equation representations in python/on the web

Is it possible to take something like x^2+5 and have it generate this: http://imgur.com/Muq2X.gif I'll be using Python so anything based in Python would work, but I'm open to other solutions such as latex output. ...

C++ double operator+

Possible Duplicates: Incorrect floating point math? Float compile-time calculation not happening? Strange stuff going on today, I'm about to lose it... #include <iomanip> #include <iostream> using namespace std; int main() { cout << setprecision(14); cout << (1/9+1/9+4/9) << endl; } This code outputs 0 on MSVC 9....

Non-Integer numbers in an String and using atoi

If there are non-number characters in a string and you call atoi [I'm assuming wtoi will do the same]. How will atoi treat the string? Lets say for an example I have the following strings: "20234543" "232B" "B" I'm sure that 1 will return the integer 20234543. What I'm curious is if 2 will return "232." [Thats what I need to solve ...

How do you print the EXACT value of a floating point number?

First of all, this is not a floating point newbie question. I know results of floating point arithmetic (not to mention transcendental functions) usually cannot be represented exactly, and that most terminating decimals cannot be represented exactly as binary floating point numbers. That said, each possible floating point value correspo...

Looking for a bell curve formula to present data that has zero to full affect in a range

a=(0-100) when x=0, a should be 0 when x=100, a should be 100 the data needs to bell curve towards the 100 mark, so that once x passes 100 a will remain at 100 and not go over. Explanation and application follows: We have a number of rows of data that are counted as good, bad or questionable. If a row is bad we count it as full value...

generating equation png files based on mathematical input

I was wondering what options were available to generate .png based on the kind of input one feeds a graphing calculator.. so (y^2 + 5x + 3) / ((3x + 3) + 5y + 18) would return The only thing I've found so far is texvc in mediawiki, but it seems overkill to get the whole mediawiki for one of it's modules. ...

How do I represent used space in 2d?

I have fixed area 2d space filled with rectangles. I'd like to move the rectangles around, add new ones, remove some, but not allow them to overlap. If all of the rects are the same height and width (50x50px), what data structure should I use to store their position and what space they are using and what lookup method should I use agains...

Most efficient way of implementing this?

Hi Guys, I've got a 1km square, I'm dividing it up into 100meters both on the positive and negative sides of it.. __________y__________ | | | | | | | | | |---------|---------| x | | | | | | ...

Help with maths/coding on possible combinations of a set to make up a total - C#

I have a coding/maths problem that I need help translating into C#. It's a poker chip calculator that takes in the BuyIn, the number of players and the total amount of chips for each colour (there are x amount of colours) and their value. It then shows you every possible combination of chips per person to equal the Buy In. The user can ...

How exactly do you compute the Fast Fourier Transform?

Hello, I've been reading a lot about Fast Fourier Transform and am trying to understand the low-level aspect of it. Unfortunately, Google and Wikipedia are not helping much at all.. and I have like 5 different algorithm books open that aren't helping much either. I'm trying to find the FFT of something simple like a vector [1,0,0,0]. ...

Creating a Skew AngleY from a Skew Factor for a Rhomboid in XAML

I'm not sure if this is possible, but basically I have two degrees that will change the width/size and skew of an image. In a tranformation matrix (<Matrix3DProjection/>), it works like this: M11:cos(x) M12:sin(y)*sin(x) M11:0 M21:0 M22:cos(y) M23:0 M31:0 M32:0 M33:1 So if I have X = 30° and ...

Open Source Math Library for F#?

Can anyone recommend a good math library for use with F#? I am looking for the moment for something with statistical distributions, but obviously as needs grow, a fuller library will be useful. Something not unlike Numpy for Python for example. I searched and came across the Math.Net project.. They have a new library math.net which see...

Computational geometry, tetrahedron signed volume

I'm not sure if this is the right place to ask, but here goes... Short version: I'm trying to compute the orientation of a triangle on a plane, formed by the intersection of 3 edges, without explicitly computing the intersection points. Long version: I need to triangulate a PSLG on a triangle in 3D. The vertices of the PSLG are defined...

Language for back-end math-intensive sections

I have recently begun working at a company wherein there are very few (2-3) programmers and many more engineers. As a result, the default language of choice has become VB.net. I look at some of the math-intensive portions of the programs that have been written thus far and I'm certain that these portions could be improved considerably if...

Number of combinations

Given the following letters in a license plate, how many combinations of them can you create AAAA1234 Please note that this is not a homework question (I am too old for college :) I am only trying to understand permutations and combinations. I always get lost when I see questions like this. Do I use n! or nPr or nCr. Any book on th...

Elegant/Clean (special case) Straight-line Grid Traversal Algorithm?

I'm dusting off an old project of mine. One of the things it had to do was -- given a Cartesian grid system, and two squares on the grid, find a list of all squares that a line joining the center of those two squares would pass through. The special case here is that all start and end points are confined to the exact center of squares/c...

php if iterator divisible by statement for dynamic columns

Hi, Im trying to make dynamic column list that will be 4 columns total (PHP). Im echoing an array and after every time 4 array items are echod, I would like to wrap those 4 array items in a div called "column". So basically, I thought I could do this with a self counting $i++ statement, but first off I'm having trouble starting the cou...