Math - mapping numbers
How do I map numbers, linearly, between a and b to go between c and d. That is, I want numbers between 2 and 6 to map to numbers between 10 and 20... but I need the generalized case. My brain is fried. ...
How do I map numbers, linearly, between a and b to go between c and d. That is, I want numbers between 2 and 6 to map to numbers between 10 and 20... but I need the generalized case. My brain is fried. ...
Problem: I need to write a function that takes 4 bytes as input, performs a reversible linear transformation on this, and returns it as 4 bytes. But wait, there is more: it also has to be distributive, so changing one byte on the input should affect all 4 output bytes. The issues: if I use multiplication it won't be reversible after ...
I'm writing a small algorithm in PHP that goes through n number of movies with ratings, and will store the top 5. I'm not reading from a datafile, but from a stream so I cannot simply order the movies by rating. My question is what is the most efficent way to keep track of the top 5 rated movies as I read the stream? Currently I do the ...
What is the difference between Linear search and Binary search? ...
I need to basically merge a Binary Heap, and Linear Probing Hashtable to make a "compound" data structure, which has the functionality of a heap, with the sorting power of a hashtable. What I need to do is create 2 2 dimension arrays for each data structure (Binary Heap, and Hash) then link them to each other with pointers so that when ...
Running into a problem. I have a table defined to hold the values of the daily treasury yield curve. It's a pretty simple table used for historical lookup of values. There are notibly some gaps in the table on year 4, 6, 8, 9, 11-19 and 21-29. The formula is pretty simple in that to calculate year 4 it's 0.5*Year3Value + 0.5*Year5Val...
Greeting, I'm trying to solve the following puzzle: I have a list of linear ranges which represent one big range. X' 100 200 300 400 500 600 700 | 900 (X) |----------|----------|----------|--------+----------| 0 | 100 (Y) ...
I'm trying to add a fade effect to my form by manually changing the opacity of the form but I'm having some trouble calculating the correct value to increment by the Opacity value of the form. I know I could use the AnimateWindow API but it's showing some unexpected behavior and I'd rather do it manually anyways as to avoid any p/invoke...
Below is a cubic interpolation function: public float Smooth(float start, float end, float amount) { // Clamp to 0-1; amount = (amount > 1f) ? 1f : amount; amount = (amount < 0f) ? 0f : amount; // Cubicly adjust the amount value. amount = (amount * amount) * (3f - (2f * amount)); return (start + ((end - start) ...
I have x,y data coming in from a [coordinates1] database (GIS - but this could be any database). I have my application with it's own coordinate system, referencing THE SAME MAP. I have established that a linear relationship exists between coordinates1(x,y) and coordinates2(x,y) as I have subtracted two different coordinates1 and coordin...
I'm trying to lerp between two CGPoints to get the values of all the pixels in between. I'm trying to find a simpler solution since right now I have a confusing recursive mess. The problem is that lerping between two points produces a point in between the two. Now I have two groups of points to lerp through... There has to be an easier...
Hi All, In the Xbox 360 I found out that I have to use D3DFMT_LIN_[xxxxxxx] instead of just D3DFMT_[xxxxxxx] since the textures wouldn't work with D3DFMT_LIN on the 360. As the tite says the LIN part stands for Linear, the description between the D3DFMT_LIN and D3DFMT_ for the texutres is just that one format is linear one isn't. So wo...
I need to find good approximations of the points where an undefined function intersect a threshold value. I'm stepping through my space and whenever I find that two subsequent steps are on different sides of the threshold, I add a point somewhere in between: My first approach was to just pick the mid-point, but this is obviously a ter...
Is there any algorithm to compute the nth fibonacci number in sub linear time? ...
How do I get SAS to report the 95% CI for the parameter estimate in a linear regression (PROC GLM)? ...
I was wondering if there is a way to include error terms for a linear regression model like r = lm(y ~ x1+x2) ? ...
I have some trouble on setting of n-linear equations in matlab.I don't know how can I declare in matlab.I need matlab code for setting of n-linear equations.. ...
For a linear model with 2 variables r = lm(y ~ x1+x2) When I run plot(r) , I get a bunch of plots such as residuals vs fitted values and so on , but I can only look at one of them at a time . Isnt there a way to seperate them ? ...
I am trying to solve a problem which I have reduced down to counting the number of integer solutions to a number of linear inequalities. I need to be able to count the number of solutions for any number of variables c_1, ..., c_n, but for n=3 the equations could be written as: Now, I know the values of n and r in advance and wish to f...
Hey, I got an array (let's call it a1) of words (like "dog", "fish", "run", "programming" anything) that's really huge. I can combine any of the words out of a1 with any other of the words (e.g. you could combine "dog" and "programming" into "dog-programming"), and then again and again, until the strings gets really big. I also got an...