math

Calculation of the position of an object moving in a circular motion in 3D

i have an object that is doing a circular motion in a 3d space, the center or the circle is at x:0,y:0,z:0 the radius is a variable. i know where the object is on the circle (by its angle [lets call that ar] or by the distance it has moved). the circle can be tilted in all 3 directions, so i got three variables for angles, lets call them...

Distribute prizes for a tournament system

I'm looking for a way to distribute a number across x units. I don't even know how to put this words so I'll give an example: There's a tournament in which the total prize is $1000. I want that the top 20 winners/entrants will win something out of it.I need a mathematical algorithm/formula which will distibute it across those players, a...

Programming Logic: Finding the smallest equation to a large number.

I do not know a whole lot about math, so I don't know how to begin to google what I am looking for, so I rely on the intelligence of experts to help me understand what I am after... I am trying to find the smallest string of equations for a particular large number. For example given the number "3940200619639447921227904010014361380507...

How to round a number to significant figures in Python

I need to round a float to be displayed in a UI. E.g, to one significant figure: 1234 -> 1000 0.12 -> 0.1 0.012 -> 0.01 0.062 -> 0.06 6253 -> 6000 1999 -> 2000 Is there a nice way to do this using the Python library, or do I have to write it myself? ...

Geometry: find point a specific distance between two points

This is similar to this question, but kind of the opposite. I have two geographic points (latitude, longitude) A and B. Let's say they're 40 nautical miles apart. I'd like to calculate the coordinates of the point 10 nautical miles from point A, on the line between A and B. I'm sure this is very basic math, but it's been YEARS since I'v...

spring like drawing in c#

How to draw the spring like shape using c# drawing class ...

Why does Math.round return a long but Math.floor return a double?

Why the inconsistency? ...

How to find a confidence interval for the total number of events

I have a program which records events that occur with some probability p. After I run it I get k events recorded. How can I calculate how many events there were, recorded or not, with some confidence, say 95%? So for example, after getting 13 events recorded I would like to be able to calculate that there were between 13 and 19 events t...

Draw a point a set distance away from a base point

Hey, I'm trying to figure out an algorithm for finding a random point a set distance away from a base point. So for example: This could just be basic maths and my brain not working yet (forgive me, haven't had my coffee yet :) ), but I've been trying to work this out on paper and I'm not getting anywhere. Thanks, Niall. ...

Modulo of negative numbers

Possible Duplicate: Mod of negative number is melting my brain! I was wondering if there was a nicer algorithm for what I'm trying to do: wrapIndex(-6, 3) = 0 wrapIndex(-5, 3) = 1 wrapIndex(-4, 3) = 2 wrapIndex(-3, 3) = 0 wrapIndex(-2, 3) = 1 wrapIndex(-1, 3) = 2 wrapIndex(0, 3) = 0 wrapIndex(1, 3) = 1 wrapIndex(2, 3) = 2 w...

How to calculate monthly average in MySQL given monthly data that spans more than one month?

I have data that spans multiple months and I want to be able to take the average per day and separate it to the appropriate months. For example, say that one data point is 2/9/2010 - 3/8/2010 and the amount is 1500. Then, the query should return 1071.4 for February 2010 and 428.6 for March. I am hoping there is a MySQL statement that ...

PEMDAS - why is it this order

This is probably an easy math question but what is the reason for the order of PEMDAS. I mean, why isnt' it SADMEP? Parenthesis, Exponents, Multiplication, Division, Addition, Subtraction Below was added because it does require knowledge of PEMDAS albeit a very basic concept it's one that I thought was more interesting in terms of why...

AS3: Rotate a DisplayObject with the Mouse

I am basically trying to create a display object transformation manager which will allow me to scale/rotate objects. I am currently trying to figure out how to rotate an object so its corner follows the current x and y of the mouse. I always get confused on the math of things like this. I know how to listen for the events and everyt...

Algorithm to find which number in a list sum up to a certain number.

I have a list of numbers. I also have a certain sum. The sum is made from a few numbers from my list (I may/may not know how many numbers it's made from). Is there a fast algorithm to get a list of possible numbers? Written in Python would be great, but pseudo-code's good too. (I can't yet read anything other than Python :P ) Example l...

Algorithm to find the closest segment to a point among many segments (Reverse Geocoding)

Hey guys!! I have a set of segments defined by two points. Given a point how can I discover the closest segment to such point? I have already written an algorithm that computes the distance between a point and a segment. Anyway calculating such distance for each segment and then choose the segment with the lowest distance is not really...

Help with this problem?

I'm trying to figure out how to do this. Essentially I have points A and B which I know the location of. I then have point C and point D which I only know the coordinates of C. I know the length of C-D and know that C-D must be parallel to A-B. How could I generally solve for D given A,B,C and length of C-D. Thanks ...

Why does corrcoef return a matrix?

Hi, It seems strange to me that np.corrcoef returns a matrix. correlation1 = corrcoef(Strategy1Returns,Strategy2Returns) [[ 1. -0.99598935] [-0.99598935 1. ]] Does anyone know why this is the case and whether it is possible to return just one value in the classical sense? ...

Objective C Math Formula Fail

Hi, noob here wants to calculate compound interest on iPhone. float principal; float rate; int compoundPerYear; int years; float amount; formula should be: amount = principal*(1+rate/compoundPerYear)^(rate*years) I get slightly incorrect answer with: amount = principal*pow((1+(rate/compoundPerYear)), (compoundPerYear*years)); I'm...

matrix help: how does postScale affect the translation part of a matrix?

Ive been trying to implement a limit to prevent the user from scaling the image too much in my multitouch zoom app. Problem is, when i set the max zoom level by dumping the matrix, the image starts to translate downward once the overall scale of the image hits my limit. I believe it is doing this because the matrix is still being affecte...

How did Google images normalize the width of each row?

It's easy to resize images so that they all have the same height while maintaining the aspect ratio, but how did they fit them all on a row such that every row has the same width? Did they crop some of the images or what? For those flagging this as "off-topic" -- I thought "algorithms for organizing images" was within the realm of p...