Math-NumberCruncher

 view release on metacpan or  search on metacpan

NumberCruncher.pod  view on Meta::CPAN

Shuffles the elements of @array and returns them.

=head2 @unique = B<Math::NumberCruncher::Unique>(\@array);

Returns an array of the unique items in an array.

=head2 @a_only = B<Math::NumberCruncher::Compare>(\@a,\@b);

Returns an array of elements that appear only in the first array passed. Any elements that appear in both arrays, or appear only in the second array, are discarded. 

=head2 @union = B<Math::NumberCruncher::Union>(\@a,\@b);

Returns an array of the unique elements produced from the joining of the two arrays.

=head2 @intersection = B<Math::NumberCruncher::Intersection>(\@a,\@b);

Returns an array of the elements that appear in both arrays.

=head2 @difference = B<Math::NumberCruncher::Difference>(\@a,\@b);

Returns an array of the symmetric difference of the two arrays. For example, in the words of _Mastering Algorithms in Perl_, "show me the web documents that talk about Perl B<or> about sets B<but not> those that talk about B<both>.

=head2 $gaussianRand = B<Math::NumberCruncher::GaussianRand>();

Returns one or two floating point numbers based on the Gaussian Distribution, based upon whether the call wants an array or a scalar value.

=head2 $ways = B<Math::NumberCruncher::Choose>($n,$k);

The number of ways to choose $k elements from a set of $n elements, when the order of selection is irrelevant.

=head2 $binomial = B<Math::NumberCruncher::Binomial>($n,$k,$p);

Returns the probability of $k successes in $n tries, given a probability of $p. (i.e., if the probability of being struck by lightning is 1 in 75,000, in 100 days, the probability of being struck by lightning exactly twice would be expressed as B<Bin...

=head2 $probability = B<Math::NumberCruncher::GaussianDist>($x,$mean,$variance);

Returns the probability, based on Gaussian Distribution, of our random variable, $x, given the $mean and $variance.

=head2 $StdDev = B<Math::NumberCruncher::StandardDeviation>(\@array [, $decimal_places]);

Returns the Standard Deviation of @array, which is a measurement of how diverse your data is.

=head2 $variance = B<Math::NumberCruncher::Variance>(\@array [, $decimal_places]);

Returns the variance for @array, which is the square of the standard deviation.  Or think of standard deviation as the square root of the variance.  Variance is another indicator of the diversity of your data.

=head2 @scores = B<Math::NumberCruncher::StandardScores>(\@array [, $decimal_places]);

Returns an array of the number of standard deviations above the mean for @array.

=head2 $confidence = B<Math::NumberCruncher::SignSignificance>($trials,$hits,$probability);

Returns the probability of how likely it is that your data is due to chance.  The lower the confidence, the less likely your data is due to chance.

=head2 $e = B<Math::NumberCruncher::EMC2>( "m36", "km" [, $decimal_places] );

Implementation of Einstein's E=MC**2.  Given either energy or mass, the function returns the other. When passing mass, the value must be preceeded by a "m," which may be either upper or lower case.  When passing energy, the value must be preceeded by...

=head2 $force = B<Math::NumberCruncher::FMA>( "m97", "a53" [, $decimal_places] );

Implementation of the stadard force = mass * acceleration formula.  Given two of the three variables (i.e., mass and force, mass and acceleration, or acceleration and force), the function returns the third.  When passing the values, mass must be prec...

=head2 $predicted = B<Math::NumberCruncher::Predict>( $slope, $y_intercept, $proposed_x [, $decimal_places] );

Useful for predicting values based on data trends, as calculated by BestFit(). Given the slope and y-intercept, and a proposed value of x, returns corresponding y.

=head2 $area = B<Math::NumberCruncher::TriangleHeron>( $a, $b, $c [, $decimal_places] );

Calculates the area of a triangle, using Heron's formula.  TriangleHeron() can be passed either the lengths of the three sides of the triangle, or the (x,y) coordinates of the three verticies.

=head2 $perimeter = B<Math::NumberCruncher::PolygonPerimeter>( $x0,$y0, $x1,$y1, $x2,$y2, ... [, p$decimal_places]);

Calculates the length of the perimeter of a given polygon. The final argument specifies the number of decimal places you want. To specify a number other than the default (see above), the number must be preceeded by the letter "p". For example: Math::...

=head2 $direction = B<Math::NumberCruncher::Clockwise>( $x0,$y0, $x1,$y1, $x2,$y2 );

Given three pairs of points, returns a positive number if you must turn clockwise when moving from p1 to p2 to p3, returns a negative number if you must turn counter-clockwise when moving from p1 to p2 to p3, and a zero if the three points lie on the...

=head2 $collision = B<Math::NumberCruncher::InPolygon>( $x, $y, @xy );

Given a set of xy pairs (@xy) that define the perimeter of a polygon, returns a 1 if point ($x,$y) is inside the polygon and returns 0 if the point ($x,$y) is outside the polygon.

=head2 @points = B<Math::NumberCruncher::BoundingBox_Points>( $d, @p );

Given a set of @p points and $d dimensions, returns two points that define the upper left and lower right corners of the bounding box for set of points @p. 

=head2 $in_triangle = B<Math::NumberCruncher::InTriangle>( $x,$y, $x0,$y0, $x1,$y1, $x2,$y2 );

Returns true if point $x,$y is inside the triangle defined by points ($x0,$y0), ($x1,$y1), and ($x2,$y2)

=head2 $area = B<Math::NumberCruncher::PolygonArea>( 0, 1, 1, 0, 3, 2, 2, 3, 0, 2  [, p$decimal_places]);

Calculates the area of a polygon using determinants. As with PolygonPerimeter(), the final argument specified the number of decimal places you want.  See PolygonPerimeter(), above, for details.

=head2 $area = B<Math::NumberCruncher::CircleArea>( $diameter [, $decimal_places] );

Calculates the area of a circle, given the diameter.

=head2 $circumference = B<Math::NumberCruncher::Circumference>( $diameter [, $decimal_places] );

Calculates the circumference of a circle, given the diameter.

=head2 $volume = B<Math::NumberCruncher::SphereVolume>( $radius [, $decimal_places] );

Calculates the volume of a sphere, given the radius.

=head2 $surface_area = B<Math::NumberCruncher::SphereSurface>( $radius [, $decimal_places] );

Calculates the surface area of a sphere, given the radius.

=head2 $years = B<Math::NumberCruncher::RuleOf72>( $interest_rate [, $decimal_places] );

A very simple financial formula. It calculates how many years, at a given interest rate, it will take to double your money, provided that the money and all interest is left in the account.

=head2 $volume = B<Math::NumberCruncher::CylinderVolume>( $radius, $height [, $decimal_places] );

Calculates the volume of a cylinder given the radius and the height.

=head2 $volume = B<Math::NumberCruncher::ConeVolume>( $lowerBaseArea, $height [, $decimal_places] );

Calculates the volume of a cone given the lower base area and the height.

=head2 $radians = B<Math::NumberCruncher::deg2rad>( $degrees [, $decimal_places] );

Converts degrees to radians.

=head2 $degrees = B<Math::NumberCruncher::rad2deg>( $radians [, $decimal_places] );

Converts radians to degrees.

=head2 $Fahrenheit = B<Math::NumberCruncher::C2F>( $Celsius [, $decimal_places] );

Converts Celsius to Fahrenheit.

=head2 $Celsius = B<Math::NumberCruncher::F2C>( $Fahrenheit [, $decimal_places] );

Converts Fahrenheit to Celsius.

=head2 $cm = B<Math::NumberCruncher::in2cm>( $inches [, $decimal_places] );

Converts inches to centimeters.

=head2 $inches = B<Math::NumberCruncher::cm2in>( $cm [, $decimal_places] );

Converts centimeters to inches.

=head2 $ft = B<Math::NumberCruncher::m2ft>( $m [, $decimal_places] );

Converts meters to feet.

=head2 $m = B<Math::NumberCruncher::ft2m>( $ft [, $decimal_places] );

Converts feet to meters.

=head2 $miles = B<Math::NumberCruncher::km2miles>( $km [, $decimal_places] );

Converts kilometers to miles.

=head2 $km = B<Math::NumberCruncher::miles2km>( $miles [, $decimal_places] );

Converst miles to kilometers.

=head2 $lb = B<Math::NumberCruncher::kg2lb>( $kg [, $decimal_places] );

Converts kilograms to pounds.

=head2 $kg = B<Math::NumberCruncher::lb2kg>( $lb [, $decimal_places] );

Converts pounds to kilograms.

=head2 $RelativeStride = B<Math::NumberCruncher::RelativeStride>( $stride_length, $leg_length [, $decimal_places] );

Welcome to the world of ichnology. This was originally for a dinosaur simulation I have been working on. This and the following four routines are all part of determining the speed of a dinosaur (or any other animal, including people), based on leg me...



( run in 0.802 second using v1.01-cache-2.11-cpan-39bf76dae61 )