math

Need help generating discrete random numbers from distribution

I searched the site but did not find exactly what I was looking for... I wanted to generate a discrete random number from normal distribution. For example, if I have a range from a minimum of 4 and a maximum of 10 and an average of 7. What code or function call ( Objective C preferred ) would I need to return a number in that range. ...

APR calculator in .NET

Where can I find a good APR calculator function for UK business.. ...

floating point precision

I have a program written in C# and some parts are writing in native C/C++. I use doubles to calculate some values and sometimes the result is wrong because of too small precision. After some investigation i figured out that someone is setting the floating-point precision to 24-bits. My code works fine, when i reset the precision to at le...

C# Formula to distribute numbers.

I'm looking for a formula that can spread out numbers in a linear format based on a minimum number, max number and amount of numbers (or dots) between. The catch is, the closer you get to the max, the more numbers should be there. An example (number will vary and will be about 100 times larger) Min = 0 Max = 16 AmountOfNumbersToSpread...

Is there C++ class that implements operations with permutations?

Is there C++ template class that implements operations with permutations and permutation group? Such class has to implement finding product and inverse, multiplication, etc. ...

How to calculate an angle from three points?

Lets say you have this: P1 = (x=2, y=50) P2 = (x=9, y=40) P3 = (x=5, y=20) Assume that P1 is the center point of a circle. It is always the same. I want the angle that is made up by P2 and P3, or in other words the angle that is next to P1. The inner angle to be precise. It will be always a sharp angle, so less than -90 degrees. I tho...

Raising to power in PHP

Well, i need to do some calculations in PHP script. And i have one expression that behaves wrong. echo 10^(-.01); Outputs 10 echo 1 / (10^(.01)); Outputs 0 echo bcpow('10', '-0.01') . '<br/>'; Outputs 1 echo bcdiv('1', bcpow('10', '0.01')); Outputs 1.000.... I'm using bcscale(100) for BCMath calculations. Excel and Wolfram ...

Game solving algorithm (Buttonia, lights-out variant)

I am trying to create a solvability function for a game algorithm. Basically a function that returns true or false for a given game it if is solvable or not. The game is Buttonia.com (which does not implement the algorithm as yet), a type of lights-out game. Basically You have a grid of buttons, each of which, when pressed, will change ...

Blogs and Books on Encryption and Security

Could any of you experienced programmers / ethical hackers out there recommend some blogs or books on security/encryption? The only blogs I look at now are .Net Security Blog (http://blogs.msdn.com/shawnfa/archive/2009/03/17/authenticated-symmetric-encryption-in-net.aspx) Laptop Security Blog (http://blog.absolute.com/cybercrimes-more-...

Help with Probability Equation

I'm trying to put together an app for fun that has a scenario where I need to figure out a probability equation for the following scenario: Suppose I have a number of attempts at something and each attempt has a success rate (known ahead of time). What are the odds after doing all those attempts that a success happens? For example ther...

Finding which region contains a point based on coordinates.

I have 4 points that form some quadrilateral. The lines can't cross or anything like that, it should be a square, rectangle, rhombus, parallelogram, etc. The lines that connect them break the field into 9 regions. With a square, it would look like a tic-tac-toe board (#), but with other shapes the lines will be at angles. A point falls...

Gaussian Elimination with custom operators

What is a good way to implement Gaussian elimination when the operators are custom operators, rather then standard arithmetic ones? Here are the operators: Addition: 0 + 0 = 0 0 + 1 = 1 1 + 1 = 0 Subtraction: 0 - 0 = 0 0 - 1 = 1 1 - 1 = 0 Multiplication: 0 * 0 = 0 0 * 1 = 0 1 * 1 = 1 Division: 0 / 0 = illegal 0 / 1 = 0 1 / 1 ...

An interesting math puzzle

Hi StackOverflow, Although it is not very programming related but I think SO could be of some assistance: A zeroless pandigital number of base 10 is a number with all the distinct digits 1,2,3,4,5,6,7,8,9. For example, the first zeroless pandigital number of base 10 is 123456789. Find a zeroless pandigital number of base 10 such that...

Parallelogram contains Point

What way is the fastest of deciding whether a point is inside a parallelogram/rhomboid? ...

Arbitrary-precision arithmetic Explanation

I'm trying to learn C and have come across the inability to work with REALLY big numbers (i.e., 100 digits, 1000 digits, etc.). I am aware that there exist libraries to do this, but I want to attempt to implement it myself. I just want to know if anyone has or can provide a very detailed, dumbed down explanation of arbitrary-precision a...

Is there a calculator with LaTeX-syntax?

When I write math in LaTeX I often need to perform simple arithmetic on numbers in my LaTeX source, like 515.1544 + 454 = ???. I usually copy-paste the LaTeX code into Google to get the result, but I still have to manually change the syntax, e.g. \frac{154,7}{25} - (289 - \frac{1337}{42}) must be changed to 154,7/25 - (289 - 1...

Curvilinear perspective: Convert 3D to 2D

Hi all, I'm looking for the mathematical expression converting a 3D coordinate (x0,y0,z0) to a 2D (x1,y1) coordinate in a curvilinear perspective of radius R where the values of x1 and y1 are the angles of views {-90° .. +90°} of the original point. (image via http://www.ntua.gr/arch/geometry/mbk/histor.htm ) Thanks ! ...

Aspect ratios - how to go about them? (D3D viewport setup)

Allright - seems my question was as cloudy as my head. Lets try again. I have 3 properties while configuring viewports for a D3D device: - The resolution the device is running in (full-screen). - The physical aspect ratio of the monitor (as fraction and float:1, so for ex. 4:3 & 1.33). - The aspect ratio of the source resolution (source...

Java Math Functions for BigDecimal

Are there complementary mathematical functions used in java.lang.Math that fully utilize the capabilities of BigDecimal? In other words, is there a log function that takes and returns a BigDecimal similar to how there is a log function that takes and returns a double? ...

Haskell and Quadratics

Hi, I have to write a program to solve quadratics, returning a complex number result. I've gotten so far, with defining a complex number, declaring it to be part of num, so +,- and * - ing can take place. I've also defined a data type for a quadratic equation, but im now stuck with the actual solving of the quadratic. My math is quite...