Zend - The PHP Company




Math

Add Code


age calculator  

Type: application
Added by: jakeandjemma
Entered: 21/02/2006
Last modified: 02/12/2005
Rating: - (fewer than 3 votes)
Views: 4755
Age calculator (which works)


Base10Converter  

Type: code fragment
Added by: rdickerson
Entered: 08/09/2005
Last modified: 02/12/2005
Rating: - (fewer than 3 votes)
Views: 2835
Convert base 10 int to any other base up to 16. This function will take a take two integer values. The first is the base you want to convert to, the second is the base 10 number you are converting.


BCGCD Greatest Common Denominator (Large Numbers)  

Type: code fragment
Added by: forumjoiner
Entered: 29/09/2006
Last modified: 31/10/2005
Rating: - (fewer than 3 votes)
Views: 2628
The Greatest Common Denominator of two large numbers, using BCMath functions. Please read the PHP manual for BCMath requirements. It works even for those who cannot have GMP support in their PHP distribution, for instance due to the web host policy.


Bitwise Arithmatic  

Type: application
Added by: Lysander
Entered: 20/09/2001
Last modified: 31/10/2000
Rating: **** (3 votes)
Views: 6665
This script does Addition and Subtraction without once using the + or - operators. Good example of how to use bitwise operators.


calculation of t value and p-value of unpaired t-test  

Type: code fragment
Added by: sunnyB
Entered: 24/07/2002
Last modified: 07/12/2001
Rating: **** (3 votes)
Views: 8679
this program prompts for means, standard dev, and sample sizes of both groups, and calculates the p-value of unpaired t-test of two independent group.


Decimal to Fraction  

Type: code fragment
Added by: zak
Entered: 09/06/2000
Last modified: 08/12/1999
Rating: - (fewer than 3 votes)
Views: 8280
A function that converts numbers with decimal remainders to numbers with fractional remainders.


Decimal to roman convertet  

Type: code fragment
Added by: Ader
Entered: 24/07/2001
Last modified: 07/12/2000
Rating: - (fewer than 3 votes)
Views: 6899
Two functions to convert an integer to its equivalent in the roman number- system or vice versa.


Euclidean Algorithm, Erotosthenes Sieve  

Type: application
Added by: vsramamurthi
Entered: 18/11/2000
Last modified: 01/12/2000
Rating: - (fewer than 3 votes)
Views: 6401
An application for doing exact integer computations. Uses bcmath functions of PHP. The Euclidean Algorithm and the Sieve of Erotesthenes are implemented.


Fast Fourier Transform  

Type: code fragment
Added by: binkleym
Entered: 08/08/2000
Last modified: 01/11/2000
Rating: **** (7 votes)
Views: 13220
This is a port of the FFT code in NR to PHP. The size of the input array must be an integer power of two. Main website at http://www.mathewbinkley.org/fft.php


fraction  

Type: class
Added by: firmanf
Entered: 08/06/2000
Last modified: 08/12/1999
Rating: ***** (6 votes)
Views: 9213
Allows manipulation and display of a fraction. Useful for displaying float/double as a fraction as opposed to a decimal number, i.e. 1/2 instead of 0.5, or a better example is 1/3 instead of 0.333333. :-)


Greatest Common Denominator  

Type: code fragment
Added by: zak
Entered: 09/06/2000
Last modified: 08/12/1999
Rating: - (fewer than 3 votes)
Views: 6353
A simple class that finds the greatest common denominator for two integers.


is_even  

Type: code fragment
Added by: stephenv
Entered: 29/03/2002
Last modified: 03/12/2001
Rating: - (fewer than 3 votes)
Views: 5491
simple function to determine if a number is even or odd.


Linear Regression  

Type: class
Added by: mathie
Entered: 04/02/2006
Last modified: 02/12/2005
Rating: - (fewer than 3 votes)
Views: 3348
Simple linear regression class


num2words  

Type: class
Added by: hermawan
Entered: 30/10/2002
Last modified: 01/11/2001
Rating: - (fewer than 3 votes)
Views: 5595
With this class you can convert your integer/number to english fraction words. Ex. 1=>One, 250=>Two hundred fifty, 1000=>One thousand. Give it a try.


Number Formatting  

Type: code fragment
Added by: mooman
Entered: 12/12/2002
Last modified: 02/11/2001
Rating: - (fewer than 3 votes)
Views: 4676
fmtnum() takes a number and formats it for easy reading. It can convert a number to scientic notation or return it with quantifier attached. For example, you could use it to format the number 12345678 into 1x10+7 or 12.34 M.


Ordinal number printer  

Type: code fragment
Added by: robf
Entered: 28/04/2002
Last modified: 05/12/2001
Rating: - (fewer than 3 votes)
Views: 7080
Feed it "21" and it returns "21st". Prints any number with the appropriate English ordinal suffix.


Permutation / Find all possible combinations of given elements  

Type: code fragment
Added by: chnuschti
Entered: 06/09/2004
Last modified: 09/12/2003
Rating: - (fewer than 3 votes)
Views: 9585
The code fragment (function) allows to find the scheme of all possible combinations of a given number of elements and will return the array with all combinations. Optionally it allows to find also the combinations that dont include all elements. The examples show how to apply the code. Idea/basics of the code were taken from a nice contribution here: http://www.phpfreaks.com/phpref/21.php


PI Search  

Type: code fragment
Added by: darkelder
Entered: 13/03/2002
Last modified: 03/12/2001
Rating: - (fewer than 3 votes)
Views: 4876
Find the PI value with these routines. Try come closer to 3.14159265358979323846!!!


Round up  

Type: code fragment
Added by: acecool
Entered: 08/08/2004
Last modified: 08/12/2003
Rating: - (fewer than 3 votes)
Views: 3811
Takes a number like 1000.000001 and rounds it to 1001, or 1000.9 and rounds it to 1001 I made this for my paginator which gets the total pages then divides by amount per page, sometimes it returns 1.1 or 1.00001 etc, so it rounds it up for a solid number to use for the paginator


shortest is_even function  

Type: code fragment
Added by: ctaroz
Entered: 14/10/2005
Last modified: 02/12/2005
Rating: - (fewer than 3 votes)
Views: 3239
returns TRUE if the number is even, FALSE if not


signify(cut number to given significiant digits)  

Type: code fragment
Added by: masterjy
Entered: 13/12/2001
Last modified: 01/12/2001
Rating: - (fewer than 3 votes)
Views: 4388
take for example, you want to have 2 significiant digits, then 3.34 => 3.3 0.003445 => 0.0034 345.45 => 340 1 => 1.0 0.02 => 0.020 3.45e-4 => 0.00034 0 => 0.0


Simple Calculator Example  

Type: application
Added by: ionzoft
Entered: 05/11/2001
Last modified: 01/11/2000
Rating: - (fewer than 3 votes)
Views: 7401
A simple Add, Subtract, Multiply, and Divide Calculator. This is a short example of a form, data validation, commenting, CSS, HTML, and rather neat code. Beginners may benifit from the source code contained within.


Standard Deviation  

Type: application
Added by: vnath
Entered: 13/04/2000
Last modified: 08/12/1999
Rating: - (fewer than 3 votes)
Views: 7845
A simple function designed to calculate the standard deviation of an array of values.


Standard Deviation  

Type: code fragment
Added by: bstrain
Entered: 02/07/2002
Last modified: 07/12/2001
Rating: - (fewer than 3 votes)
Views: 8622
Calculates the Standard Deviation of an array of numerical values.


Stat1  

Type: class
Added by: alains
Entered: 15/03/2000
Last modified: 02/12/2000
Rating: **** (4 votes)
Views: 7669
This is a statistic class that accepts one or two unidimensional arrays of data. It returns a stat array using the getStats() method. If only one array is sent, it will return the min,max, sum, median, average and standard deviation for this array. If two arrays are sent, in addition to these values for both arrays, a linear regression line is computed with its correlation r and 't'test. Median correction applied on 02/26/01.


Statistical Functions  

Type: code fragment
Added by: dhiranuntkhosnawit
Entered: 18/04/2001
Last modified: 04/12/2000
Rating: - (fewer than 3 votes)
Views: 5525
skewness , kurtosis and mean or average statistical function


String to money  

Type: code fragment
Added by: kcochrane
Entered: 18/07/2002
Last modified: 07/12/2001
Rating: - (fewer than 3 votes)
Views: 5993
It takes in a string like 12345.123 and it will convert it to the normal money format 12,345.12



Search



This Category All Categories