math

Seamless Transitions of Scale over large distances (3D rendering)

What is the best mechanism for handling large scale structures and scenes? Examples being a continent with scale cities and geography, or infinity universe style planetary transitions. ...

How to reduce calculation of average to sub-sets in a general way?

Edit: Since it appears nobody is reading the original question this links to, let me bring in a synopsis of it here. The original problem, as asked by someone else, was that, given a large number of values, where the sum would exceed what a data type of Double would hold, how can one calculate the average of those values. There was sev...

remove numbers from a list without changing total sum

I have a list of numbers (example: [-1, 1, -4, 5]) and I have to remove numbers from the list without changing the total sum of the list. I want to remove the numbers with biggest absolute value possible, without changing the total, in the example removing [-1, -4, 5] will leave [1] so the sum doesn't change. I wrote the naive approach,...

Why Does Delphi's Math.Payment Function Return A Negative Number

I'm trying to calculate the monthly payment for the following scenario: $5,000 is borrowed for 3 years at 8.00% compounded monthly with $1,000 due at the end of the term. /* From Math.pas function Payment(Rate: Extended; NPeriods: Integer; const PresentValue: Extended; const FutureValue: Extended; PaymentTime: TPaymentTime): Exten...

Finding a point on a line

I know the start and end points on a line segment. For this example say that the line segment has a distance of 5. Now I want to know the point that has a distance of three away from the end point. Any idea how to do this with math? Start Point (0,0) End Point (0,5) Point I want to find (0,2) ...

How could one implement multiplication in finite fields?

If F := GF(p^n) is the finite field with p^n elements, where p is a prime number and n a natural number, is there any efficient algorithm to work out the product of two elements in F? Here are my thoughts so far: I know that the standard construction of F is to take an irreducible polynomial f of degree n in GF(p) and then view elemen...

turn a line into a rectangle

I have a method that draws a line between two points. This works pretty well, but now I want to make this line into a rectangle. How can I get the points on the left and right side of each of the line points to make it into a rectangle that I can draw? It is almost as though I need to somehow figure out how to get perpendicular lines ...

django - simple equation

why does model.diff return 18446744073709551615 in template, when model is like this and model.pos is 0 and model.neg is 1?: class Kaart(models.Model): neg = models.PositiveIntegerField(default=0) pos = models.PositiveIntegerField(default=0) def diff(self): return self.pos - self.neg ...

PHP - How to base_convert() up to base 62

I need a base_convert() function that works from base 2 up to base 62 but I'm missing the math I need to use, I know that due to the limitations of PHP I need to make use of bcmath, which is fine. Functions like these convert a number to and from base 10 to another base up to 62, but I want to implement the same functionality of base_co...

Generate a receipt number in this range

How would I go about generating a unique receipt number in the following range: GA00000-GZ99999? I am not allowed to use the 'I' and 'O' letters so GI00000-GI99999 & GO00000-GO99999 would be excluded. Ideally, I'd like to create this in T-SQL but can also do it in VB.Net. This number will be stored in SQL and I can access it prior to ge...

Match Parenthetical Expression With Regular Expressions

Hi, I am working on a math expression parser using regular expressions and I am trying to add support for parentheses. My parser works like this: function parse_expression(expression){ Find parenthetical expressions Loop through parenthetical expressions, call parse_expression() on all of them Replace parenthetical express...

Fiege Fiat Shamir Question about quadratic residues

Hello people I am currently studying Fiege-Fiat Shamir and am stuck on quadratic residues. I understand the concept i think but im not sure how to calculate them for example how would i calculate v | x^2 = v mod 21 | x =? ___________________________________ 1 x^2 = 1 mod 21 1, 8, 13, 20 4 x^2 = 4 mod 21 2, 5, 16 7 ...

KD-Trees and missing values (vector comparison)

I have a system that stores vectors and allows a user to find the n most similar vectors to the user's query vector. That is, a user submits a vector (I call it a query vector) and my system spits out "here are the n most similar vectors." I generate the similar vectors using a KD-Tree and everything works well, but I want to do more. I ...

Thousands of rays intersections with Triangles in 3D space

Hi There are thousands of rays and triangles. We need get all the intersection points. If we use the normal two level loops,we need O(m*n) time complexity.Is there any way to low the time complexity fronm O(m*n) to O(m* logn) or O(logm*n)? Best Regards, ...

Get time from the clock image in Matlab - Image Processing

I do not know how to determine the top of the needle of the clock. If you determine the coordinates of them, I can think of the time of the clock. Please help me solve this problem. Thank you very much! ...

Java - computing large mathematical expressions

Hello all, Im facing a scenario where in ill have to compute some huge math expressions. The expressions in themselves are simple, ie have just the conventional BODMAS fundamental but the numbers that occur as operands are very large, to the tune of 1000 digit numbers. I do know of the BigInteger class of the java.math module but am loo...

What is the meaning of ∃?

Reading a book on algorithms. Can someone explain the meaning of the mathematical symbol ∃? ...

Best way to program piecewise-linear function on DSP TMS320C5509

There is a Table of pairs , which defines pieces bounds. And we are using straightforward algorithm: y = f(x) Calculate index n in Table using x Get Yn and Yn+1, compute linear interpolation Y Y is the answer. So i think, there must be more efficient method, could you please point me? ...

Lightweight markup language for math

Is there an easy markup language for math equations? I am developing an application for undergrads and I was looking for something less complex than LaTex and easier to write than MathML. ...

Customizing MWD for math equations

HI, I want to customize the WMD editor (or wmd-new) to convert TeX equations like $\frac{2}{3}$ to Google Charts API images () Is it possible to customize how the HTML is generated? ...