math

Simulating Ocean Water, need to compute complicated values.

Simulating Ocean Water: http://www.finelightvisualtechnology.com/docs/coursenotes2004.pdf I'm trying to simulate ocean and I need your help. Please be patient, I'm newbie to computer graphics but I know basics of physics and mathematics. As you can see I need to compute the formula: k is a vector, x is a coordinate (so I suggest that...

How does modulus of a smaller dividend and larger divisor work?

7 % 3 = 1 (remainder 1) how does 3 % 7 (remainder ?) work? ...

Order of growth

for f = n(log(n))^5 g = n^1.01 is f = O(g) f = 0(g) f = Omega(g)? I tried dividing both by n and i got f = log(n)^5 g = n^0.01 But I am still clueless to which one grows faster. Can someone help me with this and explain the reasoning to the answer? I really want to know how (without calculator) one can determine which one grow...

Code libraries/applications in C#

I am refreshing my memory on C# (first used it several years ago), and I want to look at some real world quality code (rather than the simplistic ones used in many books). My preference would be mathematical/statistics libraries written in C# as I would like to see how Matrices and PDEs (partial differential equations etc) are implement...

Computing number of permutations of two values, with a restriction on runs

I was thinking about ways to solve this other question about counting the number of values whose digits sum to a target, and decided to try the case where the range was of the form [0, n^base). So essentially you get N independent digits to work with, which is a simpler problem. The number of ways N natural numbers can sum to a target T...

Open source queuing theory algorithms in Java

I need to write a program to analyze the performance of computer systems and networks using queuing theory (http://en.wikipedia.org/wiki/Queueing_theory). I was wondering if there is an open source Java library implementing the various algorithms of queuing theory that can make my task easier. Does anyone have any recommendations? ...

Problem with Double and division

Possible Duplicates: Ints and Doubles doing division 1/252 = 0 in c#? Hi, Maybe because it's Friday, but I cannot understand this: (Double)1/2 = 0.5 (Double)1/(Double)2 = 0.5 (Double)((Double)1/(Double)2) = 0.5 (Double)(1/2) = 0.0 Why the last operation is 0? :S Kind regards. ...

Greatest Common Divisor from a set of more than 2 integers

There are several questions on Stack Overflow discussing how to find the Greatest Common Divisor of two values. One good answer shows a neat recursive function to do this. But how can I find the GCD of a set of more than 2 integers? I can't seem to find an example of this. Can anyone suggest the most efficient code to implement this ...

Deciding on the covariance for a Kalman Filter matrixes

I am beginning to explore using probability in my robotics applications. My goal is to progress to full SLAM, but I am starting with a more simple Kalman Filter to work my way up. I am using Extended Kalman Filter, with state as [X,Y,Theta]. I use control input [Distance, Vector], and I have an array of 76 laser ranges [Distance,Theta] ...

Calculating frequency from amplitude and bitrate

Hey Stackoverflow; I currently have an array full of data which from what I believe is the Amplitude of my wave file. It is currently at a low -32768 and at a high 32767. I also have the SampleRate which was 16,000hz. My understanding of sound isn't very good; does anyone know from this how I can calculate the Frequency? Help greatly...

Help understanding a definitive integral

I am trying to translate a function in a book into code, using MATLAB and C#. I am first trying to get the function to work properly in MATLAB. Here are the instructions: The variables are: xt and m can be ignored. zMax = Maximum Sensor Range (100) zkt = Sensor Measurement (49) zkt* = What sensor measurement should have been (50) ...

Is there any way to divide rgb color palette?

I'm trying to generate a color palette which has 16 colors. i will display this palette in 4x4 grid. so i have to find a way to rgb color palette which has 255*255*255 colors divided to 16 colors equally and logically. i think it's gonna be a mathematical algorithm. because i'm tring to pick 16 vectors from 3x3 matrix which picked in e...

iPhone Operators

Okay so I have defined my DSNavigationManager class and it has a property called DSNavigationManagerStyle managerStyle: typedef enum { DSNavigationManagerStyleNone = 0, DSNavigationManagerStyleDefaultNavigationBar = 1 << 0, DSNavigationManagerStyleDefaultToolBar = 1 << 1, DSNa...

Generating all factors of a number given its prime factorization

If you already have the prime factorization of a number, what is the easiest way to get the set of all factors of that number? I know I could just loop from 2 to sqrt(n) and find all divisible numbers, but that seems inefficient since we already have the prime factorization. I imagine it's basically a modified version of a combinations...

Show notification every step of difference between two values (Math Question)

I have to answer this question that seems a riddle ... I don't know if there's a real solution or it's impossible... Questions : Having two double values, one is the total amount of money in the safe, the other is threshold of maximum money recommended in the safe For example: recommended value of money (threshold) : $1,500 Total amou...

Is there a formula without if/else/switch/? etc that could replace the solution[,] matrix

Is there a formula without if/else/switch/? etc that could replace the solution[,] matrix and what are the implications or differences on performance/efficiency for that? class Program { private static Random r = new Random(); // names of the "moves" private static string[] rps = { "PAPER", "ROCK", "SCISSORS"}; // ...

How can I find the unit vector between a point and a line?

I have three known 3-Dimensional points: A, B, and C. Addtionally, I have a fourth point, X. X lies on vector AB such that vector CX is perpendicular to vector AB. So AB · CX = 0 How do I find the unit vector of CX? The use-case here is that I am constructing a (translated) rotational matrix, where the origin is A, the z-axis pass...

How to implement this function in MATLAB?

I am using a book with a function I would like to use. However I don't think I am getting the correct values from my function. Here is the instruction from the book: Here is the function as I have created it in MATLAB: function [ shortProbability ] = pShort( zkt, zktStar, short) if zkt > zktStar shortProbability = 0; else n...

What is half-vector of light in glsl?

I'm playing with per pixel lighting shaders and i don't know one thing: What is half vector of light source ? vec3 halfVector = normalize(gl_LightSource[1].halfVector.xyz); I would like i you can explain it in math rows, i understand math better than words :) ...

Web stats: Calculating/estimating unique visitors for arbitary time intervals.

Hi, I am writing an application which is recording some 'basic' stats -- page views, and unique visitors. I don't like the idea of storing every single view, so have thought about storing totals with a hour/day resolution. For example, like this: Tuesday 500 views 200 unique visitors Wednesday 400 views 210 unique visitors Thur...