I have a given line R defined by an angle α. R goes through the origin of my plane. I also do have an rectangle, with known width and height. The rectangle has its bottom left corner on the origin.
A new line, parallel to R, is defined by a distance L from R (take A, B, and C as examples). I would like to find out the points where the...
Not sure of the best way to ask this question other than:
I'm writing a function that will accept a variable called 'x'.
function doIt(x){
var y = someformula; //this is just a placeholder for the correct formula
return y;
}
And here's what I expect returned:
if (x is between 0 and 9){ y = 0; }
if (x is between 10 and 19){ y = ...
How is the square root function implemented?
...
how could i change a random non-uniform distribution to a uniform distribution ? Is there a formula ? thanks .
...
I've got a number which is less than 500,000,000 and I want to factorize it in an efficient way. What algorithm do you suggest? Note: I have a time limit of 0.01 sec!
I've just written this C++ code but it's absolutely awful!
void factorize(int x,vector<doubly> &factors)
{
for(int i=2;i<=x;i++)
{
if(x%i==0)
{
dou...
Some good controls and examples to chart functions
I am looking for some examples of plotting functions with some code and seeing that on a chart
so If I had a function like
y=x^2+2
I want to see that plotted from say 0 to some really high number.
C# (WPF in VS 2010 maybe) would be ideal or if their is some other library that work...
There have been many threads started over the confusion in the way that Math.Round works. For the most part, those are answered by cluing people in to the MidpointRounding parameter and that most people are expecting MidpointRounding.AwayFromZero. I have a further question though about the actual algorithm implemented by AwayFromZero.
G...
Non-standard mathematical analysis extends the real number line to include "hyperreals" -- infinitesimals and infinite numbers. Is there (specification for an) implementation of a data type to implement computations using hyperreals? I'm looking for something analogous to the complex number data type you find in Python and Fortran and ...
I am using this right now...
if($('.current').hasClass('odd') && !$('.current').hasClass('even')) {
var oddMarL = $('.current img').css('margin-left');
var oddMarL2 = $('.touch').css('margin-left');
var oddMarT = $('.touch').css('margin-top');
...
Given an integer n and a positive real number s, how can I partition an interval [0..1] into n intervals such that L(i+1)=s L(i) where L(i) is length of i'th interval?
Looking for solution in Mathematica or self-contained C-like pseudo-code
...
Can anyone recommend a good symbolic math/CAS library for Java? If you have actually used the library, can you list any pros/cons regarding the API or general usage?
Thanks!
...
This is somewhat related to another question I asked: Translate GPS coordinates to location on PDF Map. That got me to this point, now I'm stuck on the math.
Let's say I have a floor plan of a building, I've taken gps coordinate readings from each corner of the building. Also assume that the floor plan is lined up with the latitude an...
hi all,
how can we find the last 10 digits of a number like a*(2^b) + 1
when a,b are prime numbers...
...
I have a polynomial P and I would like to find y such that P(y) = 0 modulo 2^r.
I have tried something along the lines of Hensel lifting, but I don't know if this could even work, because of the usual condition f'(y mod 2) != 0 mod 2 which is not usually true.
Is there a different algorithm available ? Or could a variation of Hensel li...
Hi, I'm trying to understand the reason for a rule when converting.
I'm sure there must be a simple explanation, but I can't seem to wrap my head around it.
Appreciate any help!
Converting from base10 to any other base is done like this:
number / desiredBase = number + remainder
You do this until number = 0.
But after all of the calc...
I've got a table of values telling me how the signal level changes over time and I want to simulate a harmonic oscillator driven by this signal. It does not matter if the simulation is not 100% accurate.
I know the frequency of the oscillator.
I found lots of formulas but they all use a sine wave as driver.
...
For my tile-based game, I need to calculate direction based on a given point offset (difference between two points). For example, let's say I'm standing at point (10, 4) and I want to move to point (8, 6). The direction I move at is north-west. What would be the best way to calculate this?
Here's me basic implementation in Java.
public...
I'm struggling with the following bit of code(/challenge) and I was wondering what would be the best way to solve it.
Pseudo(-like) code
If I understand the code correctly it does:
var val = 1
foreach (char in firstargument):
val = val * ((ascii)char + 27137)
if (val == 9215629587130840783880821452128359619700556749382698126651526...
Given 2 functions Translate(x,y) and Scale(x), I want the camera's position to always be the center of the screen. There is also a scalefactor variable and by modifying it it either zooms in or out from the center of the screen. Given that I know the dimensions of the screen in pixels, how could I achieve this? Thanks
...
Hi. I have a 4-control-point bezier curve that represents some timing stuff. The first control is fixed at (0, 0) and the last control is fixed at (1, 1). The two points in between define a bezier curve that specifies how I get from 0 to 1.
Now I need to create a second curve, based off the first one. This second curve also needs to go...