math

Numbers that exceeds basic types in C#

I'm solving problems in Project Euler. Most of the problems solved by big numbers that exceeds ulong, Ex : ulong number = 81237146123746237846293567465365862854736263874623654728568263582; very sensitive decimal numbers with significant digits over 30 Ex : decimal dec = 0,324234254357389475693657647497826572638542856923...

Mathematical formula for calculating call duration.

Hello, I was working for a telecom company some years ago and I had to generate a formula which calculates duration of a call according to the following algorithm: t1 is the first period t2 is the recurring period RCT is the actual call time (in seconds) CD is the effective call duration (for billing purposes) if RCT is less than ...

Mapping N-dimensional value to a point on Hilbert curve

I have a huge set of N-dimensional points (tens of millions; N is close to 100). I need to map these points to a single dimension while preserving spatial locality. I want to use Hilbert space-filling curve to do it. For each point I want to pick the closest point on the curve. The Hilbert value of the point (curve length from the star...

Mapping Hilbert values to 3D points

I have a set of Hilbert values (length from the start of the Hilbert curve to the given point). What is the best way to convert these values to 3D points? Original Hilbert curve was not in 3D, so I guess I have to pick by myself the Hilbert curve rank I need. I do have total curve length though (that is, the maximum value in the set). ...

Transforming an object between two coordinate spaces

So I'm reading the "3D Math Primer For Graphics And Game Development" book, coming from pretty much a non-math background I'm finally starting to grasp vector/matrix math - which is a relief. But, yes there's always a but, I'm having trouble understand the translation of an object from one coordinate space to another. In the book the a...

What is a good mathematically inclined book for a Lisp beginner?

I am looking for a mathematical book on Lisp. Some ideas? ...

Javascript: Cast Math.sqrt to int?

I've searched through google (maybe I didn't look hard enough) but I could not find how to turn Math.sqrt into an int. I want to use Math.sqrt for a for loop and I guess I need it as an int but I can't seem to figure out how to cast the result to an int. So how do I do it? I tried something similar to Java: (int) Math.sqrt(num); Bu...

Keeping track of an objects local coordinate space

Ok, so - this is heavily related to my previous question Transforming an object between two coordinate spaces, but a lot more direct and it should have an obvious answer. An objects local coordinate space, how do I "get a hold of it"? Say that I load an Orc into my game, how do I know programatically where it's head, left arm, right arm...

Do programmers inherently love mathematics?

Is there any relation between affinity towards mathematics and affinity towards programming? What is your case? Do you love mathematics? What about puzzles? Do all programmers love programming puzzles? For you to be considered a GOOD programmer, is it essential that I love algorithms, mathematics, puzzles etc? ...

Looking for ODE integrator/solver with a relaxed attitude to derivative precision

I have a system of (first order) ODEs with fairly expensive to compute derivatives. However, the derivatives can be computed considerably cheaper to within given error bounds, either because the derivatives are computed from a convergent series and bounds can be placed on the maximum contribution from dropped terms, or through use of pr...

Which interdisciplinary area between Mathematics and CS have high earnings?

I enjoy Mathematics and Computer Science. Is there some interdisciplinary field in CS and Mathematics, that would "guarantee" high earnings? ...

How do I round a decimal to a specific fraction in C#?

In C# rounding a number is easy: Math.Round(1.23456, 4); // returns 1.2346 However, I want to round a number such that the fractional part of the number rounds to the closest fractional part of a predefined fraction (e.g. 1/8th) and I'm trying to find out if the .NET library already has this built in. So, for example, if I want to ro...

How should complex numbers be rendered?

Mathematics naive question: What is the "canonical" way to represent 14+1i? 14+i1 or 14+i Similarly, is it likely, in the 'real world', that scientific notation is going to creep into a complex number so as to freak out a complex numbers parser? For example, 1.2345E+02-1.7002E-09i Edit: Finally, is it 8.45358210351126e+066i ...

Calculate num of 2xadult + 2xchild combinations

a ticketing site offers a discount on "family" tickets. a family ticket is 2 adults, 2 children. the sell tickets page allows a user to enter any number of adult and child tickets. How do I work out how to apply the family ticket discount, then charge all remaining tickets at their relevant cost (i.e. adult tickets cost more than chil...

What is an Average that does not include outliers?

What do you call an Average that does not include outliers? for example if you have a set: {90,89,92,91,5} avg = 73.4 but excluding the outlier (5) we have {90,89,92,91(,5)} avg = 90.5 How do you describe this average in statistics? ...

Mathematical formula not giving same answer in C# as in excel, or calculator

Hi All... I have been trying to use a formula that is used to work out exclusive VAT in a program that our team is creating. The formula works correctly when used in a calculator or in excel, though gives a different output when used within a function in our program! here is the function: function fn_calcVat() { var vRate = Ext.g...

Symbolic Mathematics Python?

I am extreamly interested in math and programming and planning to start symbolic math project from scratch. Is this good project idea? Where to start? How should one approach this project? Any good resources? Thanks in advance. ...

Alternative/faster methods of converting an integer to a cartesian coordinate?

As a fun side-project for myself to help in learning yet another PHP MVC framework, I've been writing Reversi / Othello as a PHP & Ajax application, mostly straightforward stuff. I decided against using a multidimensional array for a number of reasons and instead have a linear array ( in this case 64 elements long ) and a couple methods...

quaternion libraries in C/C++

Any good libraries for quaternion calculations in C/C++ ? Side note: any good tutorials/examples? I've google it and been to the first few pages but maybe you have have some demos/labs from compsci or math courses you could/would share? Thanks ...

Recommendations for discrete math resources

Hi, I recently Graduated from uni in the UK but I only scraped through the Algorithmic and Mathsy units that I was made to do and am now finding that I'd actually like to know how to do some of the stuff that was taught. In particular I'm trying to follow the MIT lectures of the Algorithms lectures on Google Video. I'm finding it very ...