Feeling pretty brain-dead right now. I can, of course, brute-force this, but I feel like there has to be a simple function to return this number. Concerning native functions, I'm using PHP and/or Python.
For example: there exists containers that hold X (5) breadsticks each, and
I need to feed Y (25) people Z (3) breadsticks each.
I ...
I have a list of cities, each of them obviously has a longitude and latitude.
Now selecting one of these cities, i want to obtain all the other cities that have a longitude / latitude in a range of 50 km from the selected city.
What formula should I use?
I am only interested in the mathematical formula to convert km to latidutine and...
specificly im trying to write a piece of code that will allow me to perform basic math operations on a "T extends Number" object variable. it needs to be able to handle any number type that is a subclass of Number.
i know some of the types under Number have .add() methods built in, and some even have .multiply() methods built in. i need ...
How do I express this in javascript?
9H squared plus
3H
all over 2
times L
I'm working on something like:
function calculator (height, len) {
var H = height, L = len;
total = (((9 * H)*(9 * H)) + 3*H)/2)*L;
return total;
}
calculator(15, 7);
I don't care if it's terse or not, but I'm not sure the best way to handle math in javascri...
How can I detect whether a line (direction d and -d from point p) and a line segment (between points p1 and p2) intersects in 2D? If they do, how can I get their intersection point.
There are lots of example how to detect whether two line segments intersects but this should be even simpler case.
I found this but I do not understand wha...
Hello i often develop JTableModels in which some cells must contain the result of apliying a certain simple mathematical formula. This formulas can have:
Operators (+,-,*,/)
Number constants
Other cell references (which contains numbers)
Parameters (numbers with a reference name like "INTEREST_RATE")
I often resolve it making a littl...
Hi Below is a matrix to convert YCbCr to RGB, Can you tell me how can I get formula to convert YCbCr to RGB?
I mean, I have YCbCr value available and I want to get RGB from it.
...
I know it is a very general question, but i'm not sure how to get started and improve number theory related skills.Any good way and good book recommendations for starters and intermediates (specially related to ACM ICPC and for other programming competitions)
...
Is there any way to optimize the following line of C code (to avoid branching)?
if ((i < -threshold) || (i > threshold))
{
counter++;
}
All variables are 16-bit signed integers. An optimized version should be highly portable.
...
Possible Duplicate:
How do you find a roman numeral equivalent of an integer
I am looking for a simple algorithm (preferably in Python). How to translate a given integer number to a Roman number?
string Roman(int Num){...}
For example, Roman(1981) must produce "MCMLXXXI".
...
I need help with a homework assignment for my beginner computer science class. I am completely lost!
I need to write a program in Perl that will calculate the distance between 2 points with three values (x,y,z) by the given formula by my professor. the program must do the following:
prompt for 'c' to continue 'q' to quit
prompt for th...
Given two arrays of doubles, how Can I compute the F Test?
(F test is defined here: http://www.excelfunctions.net/Excel-Ftest-Function.html)
I am looking for answer like this one:
http://stackoverflow.com/questions/1095650/how-can-i-efficiently-calculate-the-binomial-cumulative-distribution-function
...
This post is really helpful:
http://stackoverflow.com/questions/1095650/how-can-i-efficiently-calculate-the-binomial-cumulative-distribution-function
(Title = How can I efficiently calculate the binomial cumulative distribution function?)
However, I need the negative binomial cumulative distribution function.
Is there a way to tweek ...
Hi,
Given a set of points, what's the fastest way to fit a parabola to them? Is it doing the least squares calculation or is there an iterative way?
Thanks
Edit:
I think gradient descent is the way to go. The least squares calculation would have been a little bit more taxing (having to do qr decomposition or something to keep things ...
I'm writing a class that does essentially the same type of calculation for each of the primitive numeric types in C#. Though the real calculation is more complex, think of it as a method to compute the average of a number of values, e.g.
class Calc
{
public int Count { get; private set; }
public int Total { get; private set; }
...
As the title says, how do you do that?
...
Reviewing for midterm, need some help with the following:
Given the points p0 = [1 0] and p1 = [4 6] write the implicit equation for a line in vector form (i.e. compute the appropriate v and n). Is the point p2 = [1.5 3] on the line or above or below the line?
What is the equation for a plane with the norman n = [5 3 4] going through t...
I have the following setting:
I know P1, P2 and the angle alpha, now how do i calculate the coordinates of P3? (Note: P3 is on the same circle with origin P1 and radius P1P2)
The blue lines indicate the coordinate system
...
Hi, basically i have a page on my site with boxes that slide to reveal a background color. I want this background color to be random on load of page by adding a class to the element, eg .blue, .green etc...
I have created this code and as you may notice this randomly sorts the color class and applies to the element, this works for the f...
just a really random question but is the property Math.PI in javascript always 3.141592653589793 in every browser/engine?
...