Learn about the 10 pear classes that PHP handles complex math problems

Source: Internet
Author: User
Tags arithmetic contains include integer pear

If you have a background in mathematics, you may have realized that PHP does not have special functions for dealing with advanced mathematical concepts-complex numbers, fractions, polynomials, statistics, and matrices.

However, this flaw can be filled by the pear,php extension and the application library, which provides a large number of off-the-shelf packets to handle complex mathematical units. These packages provide application developers with a robust, well tested code base, while helping you save time and effort to build your own mathematical algorithms.

This article lists 10 pear packets that developers are particularly interested in dealing with complex math problems in their projects (table a). Look and try--you may not know that you may find a solution to the problem you are facing now. But there's a warning: if you don't like math at school, the following may help you recover some unpleasant memories.

Note : You can follow the instructions provided here , install pear directly from the network data packets.  

Table A

Class name

Description

Math_complex

This class allows you to perform basic advanced arithmetic operations on complex numbers (numbers containing real and imaginary numbers). It contains an object-oriented interface that supports trigonometric and logarithmic operations on these numbers.

This class is used when performing trigonometric, hyperbolic, or exponential operations on complex numbers.

Math_fraction

This class allows you to take the numerator and denominator of fractions as the arguments of a class, thus generating a "fractional object". It contains the addition, subtraction, multiplication, addition, and counting methods of fractions, and can also compare two or more points to find the maximum value.

in PHP This class is used when you need to process fractional values in.

Math_derivative

A derivative is one of the most important concepts in calculus, which is the rate at which a given function corresponds to its own variable. This class provides an object-oriented framework to find the derivative of any mathematical expression at a specified level. It supports basic algorithms (add, subtract, multiply, divide) and a cache that accelerates derivation.

This class is used when dealing with derivatives.

Math_polynomial

A polynomial consists of several expressions, each of which has a different exponent. This class provides a variety of tools for solving the polynomial equation, including performing basic arithmetic operations on polynomials, calculating the derivative and number of polynomials, and finding the values of polynomials when they take a specific value from a variable.

Use this class to simplify the complex polynomial equation.

Math_matrix

This class provides an object-oriented framework to perform arithmetic operations that contain matrices. The matrix is represented by a series of arrays, which add, subtract, multiply, divide, determine whether the array is squared, and compute important matrix values, such as determinant and die.

Use this class when you need to process a numeric matrix.

Math_fibonacci

The Fibonacci sequence is a concatenated sequence number, which was first discovered by an Italian mathematical Ponachi. This class provides methods for computing one or more sequence members, and applications such as pseudo-random digital generators, visual arts, and music often need to complete such operations. It can also be used to detect whether an integer belongs to the Fibonacci Ponachi sequence.

Use this class when you need to compute and process the Fibonacci Ponachi numbers .

Math_vector

This class provides an object-oriented framework for processing vectors. It supports important vector computations, such as calculating distances between vectors (Cardis, Manhattan, and chessboard), reversing, transforming, scaling and Changhua vectors, and calculating the length and magnitude of vectors.

This class is used in two-dimensional or three-dimensional space to perform vector computations.

Math_binaryutils

This class provides a framework for processing binary data, including converting between large-endian, small-byte, Decimal, Integer, and hexadecimal formats, packaging and opening options, and the ability to easily subtract binary digits.

Use this class when you need to perform binary digits.

Math_stats

This class provides a diverse set of practical functions for statistical analysis of a dataset. Its functions include calculating the average (standard, internal four-point, harmonic, geometric), median and the number of points, finding the standard, absolute and internal four-point difference, calculating the variation coefficient, the original moment, and calculating the skew and peak states of the distribution.

Use this class when you need to perform a quick basic statistical analysis of a dataset.

Math_histogram

This class carries out statistical analysis by classifying a set of digital data and depicting a graphical frequency map. Its functions include defining "boxes", assigning data points to boxes, and generating a histogram of a columnar dataset in two-dimensional or three-dimensional space, either numerically or graphically.

Use this class to understand how often a dataset is distributed.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.