math

Tangent of a parametric discrete curve

I have a parametric curve, say two vectors of doubles where the parameter is the index, and I have to calculate the angle of the tangent to this curve at any given point (index). Any suggestion or link about how to do that? Thanks. ...

Area of a irregular shape

I have set of points which lies on the image. These set of points form a irregular closed shape. I need to find the area of this shape. Does any body which is the normal algorithm used for calculating the area ? Or is there any support available in libraries such as boost? I am using C++. ...

Animation with Initial Velocity

I've been trying to solve this problem for a number of days now but I must be missing something. Known Variables: vi = Initial Velocity t = Animation Duration d = Distance. end velocity should always be zero The function I'm trying to create: D(0...t) = the current distance for a given time Using this information I want to be able to ...

Mathematical attack on the Digital Signature Algorithm

Does anybody know the mathematics behind an attack on DSA where modulus p has p-1 made up of only small factors. In reality, this would not happen as the key generator would guarantee that this is not so. There is much information on the web on generating good input paramters for DSA so that it is hard to crack but no information on ho...

using CSS3 transform:rotate in IE origin problem

I'm working on a project that uses the new CSS3 transform:rotate(180deg) feature. Every modern browser has it's own tag, but does support it. Only IE (of course) doesn't. But with using filters the same thing can be achieved. The only problem with that is, is that IE uses another origin as CSS3 does. My guess is that with some math the o...

solving origin of a vectors

I have two endpoints (xa,ya) and (xb,yb) of two vectors, respectively a and b, originating from a same point (xo, yo). Also, I know that |a|=|b|+s, where s is a constant. I tried to compute the origin (xo, yo) but seem to fail at some point. How to solve this? ...

Encode complex number as RGB pixel and back

How is it better to encode a complex number into RGB pixel and vice versa? Probably (logarithm of) an absolute value goes to brightness and an argument goes to hue. Desaturated pixes should receive randomized argument in reverse transformation. Something like: 0 -> (0,0,0) 1 -> (255,0,0) -1 -> (0,255,255) 0.5 -> (128,0,0) i -> (255,2...

how to use ln in Java

Hi, I'm trying to use this formula in JAVA : (-ln(1-L))/L I'm not sure how to use ln in java. thanks in advance ...

Does Python/Scipy have a firls( ) replacement (i.e. a weighted, least squares, FIR filter design)?

I am porting code from Matlab to Python and am having trouble finding a replacement for the firls( ) routine. It is used for, least-squares linear-phase Finite Impulse Response (FIR) filter design. I looked at scipy.signal and nothing there looked like it would do the trick. Of course I was able to replace my remez and freqz algoriths...

Closest Approach question for math/physics heads

I'm using a Segment to Segment closest approach method which will output the closest distance between two segments of length. Each segment corresponds to a sphere object's origin and destination. The speed is simply from one point, to the other. Closest Approach can succeed even when there won't be a real collision. So, I'm currentl...

Division, Remainders and only Real Numbers Allowed

Trying to figure out this pseudo code. The following is assumed.... I can only use unsigned and signed integers (or long). Division returns a real number with no remainder. MOD returns a real number. Fractions and decimals are not handled. INT I = 41828; INT C = 15; INT D = 0; D = (I / 65535) * C; How would you handle a fraction (or...

How to learn geometry for programming?

What's the best way to learn the essentials of geometry (and other types of math) used in drawing/graphics programming - e.g. curves (like bezier curves), transformations, matrices, etc.? ...

Pohlig–Hellman algorithm for computing discrete logarithms

Hi Folks, I'm working on coding the Pohlig-Hellman Algorithm but I am having problem understand the steps in the algorithm based on the definition of the algorithm. Going by the Wiki of the algorithm: http://en.wikipedia.org/wiki/Pohlig%E2%80%93Hellman_algorithm I know the first part 1) is to calculate the prime factor of p-1 - which i...

Counting problem: possible sudoko tables?

Hi, I'm working on a sudoko solver (python). my method is using a game tree and explore possible permutations for each set of digits by DFS Algorithm. in order to analyzing problem, i want to know what is the count of possible valid and invalid sudoko tables? -> a 9*9 table that have 9 one, 9 two, ... , 9 nine. (this isn't exact dupl...

Explicitly multiplying values as longs

I understand that all math is done as the largest data type required to handle the current values but when you transverse a loop how do you explicitly multiply longs? The following code returns 0, I suspect, because of an overflow. long result = 0L; List<Long> temp = (List<Long>) getListOfIntegers(); for (int i = 0; i < temp.size(); i++...

Simple maths in Objective-C producing unexpected results

I'm doing the following in Objective-C and expecting 180 as the output but I'm getting 150. Can anyone explain what I'm doing wrong? (360 / 100) * 50 ...

Dynamic creation of a pointer function in c++

I was working on my advanced calculus homework today and we're doing some iteration methods along the lines of newton's method to find solutions to things like x^2=2. It got me thinking that I could write a function that would take two function pointers, one to the function itself and one to the derivative and automate the process. This ...

3D effect to distort paper

This may be a little hard to describe since I don't have a sample. I'm trying to find a math function or full 3d function in php or a similar language that can help me with the following effect: imagine if you were to take a flat sheet or paper and glue it on a glass of water. It wouldn't be flat any more. It would have a curve, and on...

c++ opengl: how to find normalized vectors for a quad ?

Hiya. can anyone assist me in finding the proper formula for quad normalization ? using c++ with opengl. thank you! ...

Music and Mathematics. Finding the natural scale generator. The best way?

Hi! I wrote this post Music and Mathematics, finding the Natural and the Pentatonic scales. I want to find the best programmatic aproach. A solution could be: <script> function getScaleIntervals(c) { var tot = 0; var scale = []; while(tot <= 12){ scale.push(Math.round(tot)); tot += c; } return scale;...