Articles

3: Functions


  • 3.1: Prelude to Functions
    In this chapter, we will explore functions that are a kind of relationship between parameters and their properties.
  • 3.2: Functions and Function Notation
    A jetliner changes altitude as its distance from the starting point of a flight increases. The weight of a growing child increases with time. In each case, one quantity depends on another. There is a relationship between the two quantities that we can describe, analyze, and use to make predictions. In this section, we will analyze such relationships.
  • 3.3: Domain and Range
    In creating various functions using the data, we can identify different independent and dependent variables, and we can analyze the data and the functions to determine the domain and range. In this section, we will investigate methods for determining the domain and range of functions.
  • 3.4: Rates of Change and Behavior of Graphs
    In this section, we will investigate changes in functions. For example, a rate of change relates a change in an output quantity to a change in an input quantity. The average rate of change is determined using only the beginning and ending data. Identifying points that mark the interval on a graph can be used to find the average rate of change. Comparing pairs of input and output values in a table can also be used to find the average rate of change.
  • 3.5: Composition of Functions
    Suppose we want to calculate how much it costs to heat a house on a particular day of the year. The cost to heat a house will depend on the average daily temperature, and in turn, the average daily temperature depends on the particular day of the year. The cost depends on the temperature, and the temperature depends on the day. By combining these two relationships into one function, we have performed function composition, which is the focus of this section.
  • 3.6: Transformation of Functions
    Often when given a problem, we try to model the scenario using mathematics in the form of words, tables, graphs, and equations. One method we can employ is to adapt the basic graphs of the toolkit functions to build new models for a given scenario. There are systematic ways to alter functions to construct appropriate models for the problems we are trying to solve.
  • 3.7: Absolute Value Functions
    Distances in the universe can be measured in all directions. As such, it is useful to consider distance as an absolute value function. In this section, we will investigate absolute value functions. The absolute value function is commonly thought of as providing the distance the number is from zero on a number line. Algebraically, for whatever the input value is, the output is the value without regard to sign.
  • 3.8: Inverse Functions
    If some physical machines can run in two directions, we might ask whether some of the function “machines” we have been studying can also run backwards. In this section, we will consider the reverse nature of functions.

Thumbnail: This relationship is a function because each input is associated with a single output. Note that input q and r both give output n.


Excel functions (alphabetical)

Click a letter to go to functions that start with it. Or press Ctrl+F to find a function by typing the first few letters or a descriptive word. To get detailed information about a function, click its name in the first column.

Note: Version markers indicate the version of Excel a function was introduced. These functions aren't available in earlier versions.

Important: The calculated results of formulas and some Excel worksheet functions may differ slightly between a Windows PC using x86 or x86-64 architecture and a Windows RT PC using ARM architecture. Learn more about the differences.

Math and trigonometry: Returns the absolute value of a number

Financial: Returns the accrued interest for a security that pays periodic interest

Financial: Returns the accrued interest for a security that pays interest at maturity

Math and trigonometry: Returns the arccosine of a number

Math and trigonometry: Returns the inverse hyperbolic cosine of a number

ACOT function

Math and trigonometry: Returns the arccotangent of a number

ACOTH function

Math and trigonometry: Returns the hyperbolic arccotangent of a number

Math and trigonometry: Returns an aggregate in a list or database

Lookup and reference: Returns a reference as text to a single cell in a worksheet

Financial: Returns the depreciation for each accounting period by using a depreciation coefficient

Financial: Returns the depreciation for each accounting period

Logical: Returns TRUE if all of its arguments are TRUE

ARABIC function

Math and trigonometry: Converts a Roman number to Arabic, as a number

Lookup and reference: Returns the number of areas in a reference

ARRAYTOTEXT function

Text: Returns an array of text values from any specified range

Text: Changes full-width (double-byte) English letters or katakana within a character string to half-width (single-byte) characters

Math and trigonometry: Returns the arcsine of a number

Math and trigonometry: Returns the inverse hyperbolic sine of a number

Math and trigonometry: Returns the arctangent of a number

Math and trigonometry: Returns the arctangent from x- and y-coordinates

Math and trigonometry: Returns the inverse hyperbolic tangent of a number

Statistical: Returns the average of the absolute deviations of data points from their mean

Statistical: Returns the average of its arguments

Statistical: Returns the average of its arguments, including numbers, text, and logical values

Statistical: Returns the average (arithmetic mean) of all the cells in a range that meet a given criteria

Statistical: Returns the average (arithmetic mean) of all cells that meet multiple criteria.

Text: Converts a number to text, using the ß (baht) currency format

Math and trigonometry: Converts a number into a text representation with the given radix (base)

Engineering: Returns the modified Bessel function In(x)

Engineering: Returns the Bessel function Jn(x)

Engineering: Returns the modified Bessel function Kn(x)

Engineering: Returns the Bessel function Yn(x)

Compatibility: Returns the beta cumulative distribution function

In Excel 2007, this is a Statistical function.

BETA.DIST function

Statistical: Returns the beta cumulative distribution function

Compatibility: Returns the inverse of the cumulative distribution function for a specified beta distribution

In Excel 2007, this is a Statistical function.

BETA.INV function

Statistical: Returns the inverse of the cumulative distribution function for a specified beta distribution

Engineering: Converts a binary number to decimal

Engineering: Converts a binary number to hexadecimal

Engineering: Converts a binary number to octal

Compatibility: Returns the individual term binomial distribution probability

In Excel 2007, this is a Statistical function.

BINOM.DIST function

Statistical: Returns the individual term binomial distribution probability

BINOM.DIST.RANGE function

Statistical: Returns the probability of a trial result using a binomial distribution

BINOM.INV function

Statistical: Returns the smallest value for which the cumulative binomial distribution is less than or equal to a criterion value

BITAND function

Engineering: Returns a 'Bitwise And' of two numbers

BITLSHIFT function

Engineering: Returns a value number shifted left by shift_amount bits

BITOR function

Engineering: Returns a bitwise OR of 2 numbers

BITRSHIFT function

Engineering: Returns a value number shifted right by shift_amount bits

BITXOR function

Engineering: Returns a bitwise 'Exclusive Or' of two numbers

Add-in and Automation: Calls a procedure in a dynamic link library or code resource

Compatibility: Rounds a number to the nearest integer or to the nearest multiple of significance

CEILING.MATH function

Math and trigonometry: Rounds a number up, to the nearest integer or to the nearest multiple of significance

Math and trigonometry: Rounds a number the nearest integer or to the nearest multiple of significance. Regardless of the sign of the number, the number is rounded up.

Information: Returns information about the formatting, location, or contents of a cell

This function is not available in Excel for the web.

Text: Returns the character specified by the code number

Compatibility: Returns the one-tailed probability of the chi-squared distribution

Note: In Excel 2007, this is a Statistical function.

Compatibility: Returns the inverse of the one-tailed probability of the chi-squared distribution

Note: In Excel 2007, this is a Statistical function.

Compatibility: Returns the test for independence

Note: In Excel 2007, this is a Statistical function.

CHISQ.DIST function

Statistical: Returns the cumulative beta probability density function

CHISQ.DIST.RT function

Statistical: Returns the one-tailed probability of the chi-squared distribution

CHISQ.INV function

Statistical: Returns the cumulative beta probability density function

CHISQ.INV.RT function

Statistical: Returns the inverse of the one-tailed probability of the chi-squared distribution

CHISQ.TEST function

Statistical: Returns the test for independence

Lookup and reference: Chooses a value from a list of values

Text: Removes all nonprintable characters from text

Text: Returns a numeric code for the first character in a text string

Lookup and reference: Returns the column number of a reference

Lookup and reference: Returns the number of columns in a reference

Math and trigonometry: Returns the number of combinations for a given number of objects

COMBINA function

Math and trigonometry:
Returns the number of combinations with repetitions for a given number of items

Engineering: Converts real and imaginary coefficients into a complex number

CONCAT function

Text: Combines the text from multiple ranges and/or strings, but it doesn't provide the delimiter or IgnoreEmpty arguments.

Text: Joins several text items into one text item

Compatibility: Returns the confidence interval for a population mean

In Excel 2007, this is a Statistical function.

CONFIDENCE.NORM function

Statistical: Returns the confidence interval for a population mean

CONFIDENCE.T function

Statistical: Returns the confidence interval for a population mean, using a Student's t distribution

Engineering: Converts a number from one measurement system to another

Statistical: Returns the correlation coefficient between two data sets

Math and trigonometry: Returns the cosine of a number

Math and trigonometry: Returns the hyperbolic cosine of a number

COT function

Math and trigonometry: Returns the hyperbolic cosine of a number

COTH function

Math and trigonometry: Returns the cotangent of an angle

Statistical: Counts how many numbers are in the list of arguments

Statistical: Counts how many values are in the list of arguments

Statistical: Counts the number of blank cells within a range

Statistical: Counts the number of cells within a range that meet the given criteria

Statistical: Counts the number of cells within a range that meet multiple criteria

Financial: Returns the number of days from the beginning of the coupon period to the settlement date

Financial: Returns the number of days in the coupon period that contains the settlement date

Financial: Returns the number of days from the settlement date to the next coupon date

Financial: Returns the next coupon date after the settlement date

Financial: Returns the number of coupons payable between the settlement date and maturity date

Financial: Returns the previous coupon date before the settlement date

Compatibility: Returns covariance, the average of the products of paired deviations

In Excel 2007, this is a Statistical function.

COVARIANCE.P function

Statistical: Returns covariance, the average of the products of paired deviations

COVARIANCE.S function

Statistical: Returns the sample covariance, the average of the products deviations for each data point pair in two data sets

Compatibility: Returns the smallest value for which the cumulative binomial distribution is less than or equal to a criterion value

In Excel 2007, this is a Statistical function.

CSC function

Math and trigonometry: Returns the cosecant of an angle

CSCH function

Math and trigonometry: Returns the hyperbolic cosecant of an angle

Cube: Returns a key performance indicator (KPI) name, property, and measure, and displays the name and property in the cell. A KPI is a quantifiable measurement, such as monthly gross profit or quarterly employee turnover, used to monitor an organization's performance.

Cube: Returns a member or tuple in a cube hierarchy. Use to validate that the member or tuple exists in the cube.

Cube: Returns the value of a member property in the cube. Use to validate that a member name exists within the cube and to return the specified property for this member.

Cube: Returns the nth, or ranked, member in a set. Use to return one or more elements in a set, such as the top sales performer or top 10 students.

Cube: Defines a calculated set of members or tuples by sending a set expression to the cube on the server, which creates the set, and then returns that set to Microsoft Office Excel.

Cube: Returns the number of items in a set.

Cube: Returns an aggregated value from a cube.

Financial: Returns the cumulative interest paid between two periods

Financial: Returns the cumulative principal paid on a loan between two periods

Date and time: Returns the serial number of a particular date

Date and time: Calculates the number of days, months, or years between two dates. This function is useful in formulas where you need to calculate an age.

Date and time: Converts a date in the form of text to a serial number

Database: Returns the average of selected database entries

Date and time: Converts a serial number to a day of the month

DAYS function

Date and time: Returns the number of days between two dates

Date and time: Calculates the number of days between two dates based on a 360-day year

Financial: Returns the depreciation of an asset for a specified period by using the fixed-declining balance method

DBCS function

Text: Changes half-width (single-byte) English letters or katakana within a character string to full-width (double-byte) characters

Database: Counts the cells that contain numbers in a database

Database: Counts nonblank cells in a database

Financial: Returns the depreciation of an asset for a specified period by using the double-declining balance method or some other method that you specify

Engineering: Converts a decimal number to binary

Engineering: Converts a decimal number to hexadecimal

Engineering: Converts a decimal number to octal

DECIMAL function

Math and trigonometry: Converts a text representation of a number in a given base into a decimal number

Math and trigonometry: Converts radians to degrees

Engineering: Tests whether two values are equal

Statistical: Returns the sum of squares of deviations

Database: Extracts from a database a single record that matches the specified criteria

Financial: Returns the discount rate for a security

Database: Returns the maximum value from selected database entries

Database: Returns the minimum value from selected database entries

Text: Converts a number to text, using the $ (dollar) currency format

Financial: Converts a dollar price, expressed as a fraction, into a dollar price, expressed as a decimal number

Financial: Converts a dollar price, expressed as a decimal number, into a dollar price, expressed as a fraction

Database: Multiplies the values in a particular field of records that match the criteria in a database

Database: Estimates the standard deviation based on a sample of selected database entries

Database: Calculates the standard deviation based on the entire population of selected database entries

Database: Adds the numbers in the field column of records in the database that match the criteria

Financial: Returns the annual duration of a security with periodic interest payments

Database: Estimates variance based on a sample from selected database entries

Database: Calculates variance based on the entire population of selected database entries

Date and time: Returns the serial number of the date that is the indicated number of months before or after the start date

Financial: Returns the effective annual interest rate

ENCODEURL function

Web: Returns a URL-encoded string

This function is not available in Excel for the web.

Date and time: Returns the serial number of the last day of the month before or after a specified number of months

Engineering: Returns the error function

ERF.PRECISE function

Engineering: Returns the error function

Engineering: Returns the complementary error function

ERFC.PRECISE function

Engineering: Returns the complementary ERF function integrated between x and infinity

Information: Returns a number corresponding to an error type

Add-in and Automation: Converts a number to euros, converts a number from euros to a euro member currency, or converts a number from one euro member currency to another by using the euro as an intermediary (triangulation).

Math and trigonometry: Rounds a number up to the nearest even integer

Text: Checks to see if two text values are identical

Math and trigonometry: Returns e raised to the power of a given number

EXPON.DIST function

Statistical: Returns the exponential distribution

Compatibility: Returns the exponential distribution

In Excel 2007, this is a Statistical function.

Math and trigonometry: Returns the factorial of a number

Math and trigonometry: Returns the double factorial of a number

Logical: Returns the logical value FALSE

F.DIST function

Statistical: Returns the F probability distribution

Compatibility: Returns the F probability distribution

In Excel 2007, this is a Statistical function.

F.DIST.RT function

Statistical: Returns the F probability distribution

Lookup and reference: Filters a range of data based on criteria you define

FILTERXML function

Web: Returns specific data from the XML content by using the specified XPath

This function is not available in Excel for the web.

Text: Finds one text value within another (case-sensitive)

F.INV function

Statistical: Returns the inverse of the F probability distribution

F.INV.RT function

Statistical: Returns the inverse of the F probability distribution

Compatibility: Returns the inverse of the F probability distribution

In Excel 2007this is a Statistical function.

Statistical: Returns the Fisher transformation

Statistical: Returns the inverse of the Fisher transformation

Text: Formats a number as text with a fixed number of decimals

Compatibility: Rounds a number down, toward zero

In Excel 2007 and Excel 2010, this is a Math and trigonometry function.

FLOOR.MATH function

Math and trigonometry: Rounds a number down, to the nearest integer or to the nearest multiple of significance

Math and trigonometry: Rounds a number the nearest integer or to the nearest multiple of significance. Regardless of the sign of the number, the number is rounded up.

Statistical: Returns a value along a linear trend

In Excel 2016, this function is replaced with FORECAST.LINEAR as part of the new Forecasting functions, but it's still available for compatibility with earlier versions.

FORECAST.ETS function

Statistical: Returns a future value based on existing (historical) values by using the AAA version of the Exponential Smoothing (ETS) algorithm

FORECAST.ETS.CONFINT function

Statistical: Returns a confidence interval for the forecast value at the specified target date

FORECAST.ETS.SEASONALITY function

Statistical: Returns the length of the repetitive pattern Excel detects for the specified time series

FORECAST.ETS.STAT function

Statistical: Returns a statistical value as a result of time series forecasting

FORECAST.LINEAR function

Statistical: Returns a future value based on existing values

FORMULATEXT function

Lookup and reference: Returns the formula at the given reference as text

Statistical: Returns a frequency distribution as a vertical array

F.TEST function

Statistical: Returns the result of an F-test

Compatibility: Returns the result of an F-test

In Excel 2007, this is a Statistical function.

Financial: Returns the future value of an investment

Financial: Returns the future value of an initial principal after applying a series of compound interest rates

GAMMA function

Statistical: Returns the Gamma function value

GAMMA.DIST function

Statistical: Returns the gamma distribution

Compatibility: Returns the gamma distribution

In Excel 2007, this is a Statistical function.

GAMMA.INV function

Statistical: Returns the inverse of the gamma cumulative distribution

Compatibility: Returns the inverse of the gamma cumulative distribution

In Excel 2007, this is a Statistical function.

Statistical: Returns the natural logarithm of the gamma function, Γ(x)

GAMMALN.PRECISE function

Statistical: Returns the natural logarithm of the gamma function, Γ(x)

GAUSS function

Statistical: Returns 0.5 less than the standard normal cumulative distribution

Math and trigonometry: Returns the greatest common divisor

Statistical: Returns the geometric mean

Engineering: Tests whether a number is greater than a threshold value

Lookup and reference: Returns data stored in a PivotTable report

Statistical: Returns values along an exponential trend

Statistical: Returns the harmonic mean

Engineering: Converts a hexadecimal number to binary

Engineering: Converts a hexadecimal number to decimal

Engineering: Converts a hexadecimal number to octal

Lookup and reference: Looks in the top row of an array and returns the value of the indicated cell

Date and time: Converts a serial number to an hour

Lookup and reference: Creates a shortcut or jump that opens a document stored on a network server, an intranet, or the Internet

Statistical: Returns the hypergeometric distribution

Compatibility: Returns the hypergeometric distribution

In Excel 2007, this is a Statistical function.

Logical: Specifies a logical test to perform

Logical: Returns a value you specify if a formula evaluates to an error otherwise, returns the result of the formula

IFNA function

Logical: Returns the value you specify if the expression resolves to #N/A, otherwise returns the result of the expression

IFS function

Logical: Checks whether one or more conditions are met and returns a value that corresponds to the first TRUE condition.

Engineering: Returns the absolute value (modulus) of a complex number

Engineering: Returns the imaginary coefficient of a complex number

Engineering: Returns the argument theta, an angle expressed in radians

Engineering: Returns the complex conjugate of a complex number

Engineering: Returns the cosine of a complex number

IMCOSH function

Engineering: Returns the hyperbolic cosine of a complex number

IMCOT function

Engineering: Returns the cotangent of a complex number

IMCSC function

Engineering: Returns the cosecant of a complex number

IMCSCH function

Engineering: Returns the hyperbolic cosecant of a complex number

Engineering: Returns the quotient of two complex numbers

Engineering: Returns the exponential of a complex number

Engineering: Returns the natural logarithm of a complex number

Engineering: Returns the base-10 logarithm of a complex number

Engineering: Returns the base-2 logarithm of a complex number

Engineering: Returns a complex number raised to an integer power

Engineering: Returns the product of complex numbers

Engineering: Returns the real coefficient of a complex number

IMSEC function

Engineering: Returns the secant of a complex number

IMSECH function

Engineering: Returns the hyperbolic secant of a complex number

Engineering: Returns the sine of a complex number

IMSINH function

Engineering: Returns the hyperbolic sine of a complex number

Engineering: Returns the square root of a complex number

Engineering: Returns the difference between two complex numbers

Engineering: Returns the sum of complex numbers

IMTAN function

Engineering: Returns the tangent of a complex number

Lookup and reference: Uses an index to choose a value from a reference or array

Lookup and reference: Returns a reference indicated by a text value

Information: Returns information about the current operating environment

This function is not available in Excel for the web.

Math and trigonometry: Rounds a number down to the nearest integer

Statistical: Returns the intercept of the linear regression line

Financial: Returns the interest rate for a fully invested security

Financial: Returns the interest payment for an investment for a given period

Financial: Returns the internal rate of return for a series of cash flows

Information: Returns TRUE if the value is blank

Information: Returns TRUE if the value is any error value except #N/A

Information: Returns TRUE if the value is any error value

Information: Returns TRUE if the number is even

ISFORMULA function

Information: Returns TRUE if there is a reference to a cell that contains a formula

Information: Returns TRUE if the value is a logical value

Information: Returns TRUE if the value is the #N/A error value

Information: Returns TRUE if the value is not text

Information: Returns TRUE if the value is a number

Information: Returns TRUE if the number is odd

Information: Returns TRUE if the value is a reference

Information: Returns TRUE if the value is text

ISO.CEILING function

Math and trigonometry: Returns a number that is rounded up to the nearest integer or to the nearest multiple of significance

ISOWEEKNUM function

Date and time: Returns the number of the ISO week number of the year for a given date

Financial: Calculates the interest paid during a specific period of an investment

Text: Changes half-width (single-byte) characters within a string to full-width (double-byte) characters

Statistical: Returns the kurtosis of a data set

Statistical: Returns the k-th largest value in a data set

Math and trigonometry: Returns the least common multiple

Text: Returns the leftmost characters from a text value

Text: Returns the number of characters in a text string

LET function

Math and trigonometry: Assigns names to calculation results to allow storing intermediate calculations, values, or defining names inside a formula

Statistical: Returns the parameters of a linear trend

Math and trigonometry: Returns the natural logarithm of a number

Math and trigonometry: Returns the logarithm of a number to a specified base

Math and trigonometry: Returns the base-10 logarithm of a number

Statistical: Returns the parameters of an exponential trend

Compatibility: Returns the inverse of the lognormal cumulative distribution

LOGNORM.DIST function

Statistical: Returns the cumulative lognormal distribution

Compatibility: Returns the cumulative lognormal distribution

LOGNORM.INV function

Statistical: Returns the inverse of the lognormal cumulative distribution

Lookup and reference: Looks up values in a vector or array

Text: Converts text to lowercase

Lookup and reference: Looks up values in a reference or array

Statistical: Returns the maximum value in a list of arguments

Statistical: Returns the maximum value in a list of arguments, including numbers, text, and logical values

MAXIFS function

Statistical: Returns the maximum value among cells specified by a given set of conditions or criteria

Math and trigonometry: Returns the matrix determinant of an array

Financial: Returns the Macauley modified duration for a security with an assumed par value of $100

Statistical: Returns the median of the given numbers

Text: Returns a specific number of characters from a text string starting at the position you specify

Statistical: Returns the minimum value in a list of arguments

MINIFS function

Statistical: Returns the minimum value among cells specified by a given set of conditions or criteria.

Statistical: Returns the smallest value in a list of arguments, including numbers, text, and logical values

Date and time: Converts a serial number to a minute

Math and trigonometry: Returns the matrix inverse of an array

Financial: Returns the internal rate of return where positive and negative cash flows are financed at different rates

Math and trigonometry: Returns the matrix product of two arrays

Math and trigonometry: Returns the remainder from division

Compatibility: Returns the most common value in a data set

In Excel 2007, this is a Statistical function.

MODE.MULT function

Statistical: Returns a vertical array of the most frequently occurring, or repetitive values in an array or range of data

MODE.SNGL function

Statistical: Returns the most common value in a data set

Date and time: Converts a serial number to a month

Math and trigonometry: Returns a number rounded to the desired multiple

Math and trigonometry: Returns the multinomial of a set of numbers

MUNIT function

Math and trigonometry: Returns the unit matrix or the specified dimension

Information: Returns a value converted to a number

Information: Returns the error value #N/A

NEGBINOM.DIST function

Statistical: Returns the negative binomial distribution

Compatibility: Returns the negative binomial distribution

In Excel 2007, this is a Statistical function.

Date and time: Returns the number of whole workdays between two dates

NETWORKDAYS.INTL function

Date and time: Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days

Financial: Returns the annual nominal interest rate

NORM.DIST function

Statistical: Returns the normal cumulative distribution

Compatibility: Returns the normal cumulative distribution

In Excel 2007, this is a Statistical function.

Statistical: Returns the inverse of the normal cumulative distribution

NORM.INV function

Compatibility: Returns the inverse of the normal cumulative distribution

Note: In Excel 2007, this is a Statistical function.

NORM.S.DIST function

Statistical: Returns the standard normal cumulative distribution

Compatibility: Returns the standard normal cumulative distribution

In Excel 2007, this is a Statistical function.

NORM.S.INV function

Statistical: Returns the inverse of the standard normal cumulative distribution

Compatibility: Returns the inverse of the standard normal cumulative distribution

In Excel 2007, this is a Statistical function.

Logical: Reverses the logic of its argument

Date and time: Returns the serial number of the current date and time

Financial: Returns the number of periods for an investment

Financial: Returns the net present value of an investment based on a series of periodic cash flows and a discount rate

NUMBERVALUE function

Text: Converts text to number in a locale-independent manner

Engineering: Converts an octal number to binary

Engineering: Converts an octal number to decimal

Engineering: Converts an octal number to hexadecimal

Math and trigonometry: Rounds a number up to the nearest odd integer

Financial: Returns the price per $100 face value of a security with an odd first period

Financial: Returns the yield of a security with an odd first period

Financial: Returns the price per $100 face value of a security with an odd last period

Financial: Returns the yield of a security with an odd last period

Lookup and reference: Returns a reference offset from a given reference

Logical: Returns TRUE if any argument is TRUE

PDURATION function

Financial: Returns the number of periods required by an investment to reach a specified value

Statistical: Returns the Pearson product moment correlation coefficient

PERCENTILE.EXC function

Statistical: Returns the k-th percentile of values in a range, where k is in the range 0..1, exclusive

PERCENTILE.INC function

Statistical: Returns the k-th percentile of values in a range

Compatibility: Returns the k-th percentile of values in a range

In Excel 2007, this is a Statistical function.

PERCENTRANK.EXC function

Statistical: Returns the rank of a value in a data set as a percentage (0..1, exclusive) of the data set

PERCENTRANK.INC function

Statistical: Returns the percentage rank of a value in a data set

Compatibility: Returns the percentage rank of a value in a data set

In Excel 2007, this is a Statistical function.

Statistical: Returns the number of permutations for a given number of objects

PERMUTATIONA function

Statistical: Returns the number of permutations for a given number of objects (with repetitions) that can be selected from the total objects

PHI function

Statistical: Returns the value of the density function for a standard normal distribution

Text: Extracts the phonetic (furigana) characters from a text string

Math and trigonometry: Returns the value of pi

Financial: Returns the periodic payment for an annuity

POISSON.DIST function

Statistical: Returns the Poisson distribution

Compatibility: Returns the Poisson distribution

In Excel 2007, this is a Statistical function.

Math and trigonometry: Returns the result of a number raised to a power

Financial: Returns the payment on the principal for an investment for a given period

Financial: Returns the price per $100 face value of a security that pays periodic interest

Financial: Returns the price per $100 face value of a discounted security

Financial: Returns the price per $100 face value of a security that pays interest at maturity

Statistical: Returns the probability that values in a range are between two limits

Math and trigonometry: Multiplies its arguments

Text: Capitalizes the first letter in each word of a text value

Financial: Returns the present value of an investment

Compatibility: Returns the quartile of a data set

In Excel 2007, this is a Statistical function.

QUARTILE.EXC function

Statistical: Returns the quartile of the data set, based on percentile values from 0..1, exclusive

QUARTILE.INC function

Statistical: Returns the quartile of a data set

Math and trigonometry: Returns the integer portion of a division

Math and trigonometry: Converts degrees to radians

Math and trigonometry: Returns a random number between 0 and 1

Math and trigonometry: Returns an array of random numbers between 0 and 1. However, you can specify the number of rows and columns to fill, minimum and maximum values, and whether to return whole numbers or decimal values.

Math and trigonometry: Returns a random number between the numbers you specify

RANK.AVG function

Statistical: Returns the rank of a number in a list of numbers

RANK.EQ function

Statistical: Returns the rank of a number in a list of numbers

Compatibility: Returns the rank of a number in a list of numbers

In Excel 2007, this is a Statistical function.

Financial: Returns the interest rate per period of an annuity

Financial: Returns the amount received at maturity for a fully invested security

Add-in and Automation: Returns the register ID of the specified dynamic link library (DLL) or code resource that has been previously registered

Text: Replaces characters within text

Text: Repeats text a given number of times

Text: Returns the rightmost characters from a text value

Math and trigonometry: Converts an arabic numeral to roman, as text

Math and trigonometry: Rounds a number to a specified number of digits

Math and trigonometry: Rounds a number down, toward zero

Math and trigonometry: Rounds a number up, away from zero

Lookup and reference: Returns the row number of a reference

Lookup and reference: Returns the number of rows in a reference

RRI function

Financial: Returns an equivalent interest rate for the growth of an investment

Statistical: Returns the square of the Pearson product moment correlation coefficient

Lookup and reference: Retrieves real-time data from a program that supports COM automation

Text: Finds one text value within another (not case-sensitive)

SEC function

Math and trigonometry: Returns the secant of an angle

SECH function

Math and trigonometry: Returns the hyperbolic secant of an angle

Date and time: Converts a serial number to a second

Math and trigonometry: Generates a list of sequential numbers in an array, such as 1, 2, 3, 4

Math and trigonometry: Returns the sum of a power series based on the formula

SHEET function

Information: Returns the sheet number of the referenced sheet

SHEETS function

Information: Returns the number of sheets in a reference

Math and trigonometry: Returns the sign of a number

Math and trigonometry: Returns the sine of the given angle

Math and trigonometry: Returns the hyperbolic sine of a number

Statistical: Returns the skewness of a distribution

SKEW.P function

Statistical: Returns the skewness of a distribution based on a population: a characterization of the degree of asymmetry of a distribution around its mean

Financial: Returns the straight-line depreciation of an asset for one period

Statistical: Returns the slope of the linear regression line

Statistical: Returns the k-th smallest value in a data set

Lookup and reference: Sorts the contents of a range or array

Lookup and reference: Sorts the contents of a range or array based on the values in a corresponding range or array

Math and trigonometry: Returns a positive square root

Math and trigonometry: Returns the square root of (number * pi)

Statistical: Returns a normalized value

Compatibility: Estimates standard deviation based on a sample

STDEV.P function

Statistical: Calculates standard deviation based on the entire population

STDEV.S function

Statistical: Estimates standard deviation based on a sample

Statistical: Estimates standard deviation based on a sample, including numbers, text, and logical values

Compatibility: Calculates standard deviation based on the entire population

In Excel 2007, this is a Statistical function.

Statistical: Calculates standard deviation based on the entire population, including numbers, text, and logical values

Statistical: Returns the standard error of the predicted y-value for each x in the regression

Text: Substitutes new text for old text in a text string

Math and trigonometry: Returns a subtotal in a list or database

Math and trigonometry: Adds its arguments

Math and trigonometry: Adds the cells specified by a given criteria

Math and trigonometry: Adds the cells in a range that meet multiple criteria

Math and trigonometry: Returns the sum of the products of corresponding array components

Math and trigonometry: Returns the sum of the squares of the arguments

Math and trigonometry: Returns the sum of the difference of squares of corresponding values in two arrays

Math and trigonometry: Returns the sum of the sum of squares of corresponding values in two arrays

Math and trigonometry: Returns the sum of squares of differences of corresponding values in two arrays

SWITCH function

Logical: Evaluates an expression against a list of values and returns the result corresponding to the first matching value. If there is no match, an optional default value may be returned.

Financial: Returns the sum-of-years' digits depreciation of an asset for a specified period

Text: Converts its arguments to text

Math and trigonometry: Returns the tangent of a number

Math and trigonometry: Returns the hyperbolic tangent of a number

Financial: Returns the bond-equivalent yield for a Treasury bill

Financial: Returns the price per $100 face value for a Treasury bill

Financial: Returns the yield for a Treasury bill

T.DIST function

Statistical: Returns the Percentage Points (probability) for the Student t-distribution

T.DIST.2T function

Statistical: Returns the Percentage Points (probability) for the Student t-distribution

T.DIST.RT function

Statistical: Returns the Student's t-distribution

Compatibility: Returns the Student's t-distribution

Text: Formats a number and converts it to text

TEXTJOIN function

Text: Combines the text from multiple ranges and/or strings, and includes a delimiter you specify between each text value that will be combined. If the delimiter is an empty text string, this function will effectively concatenate the ranges.

Date and time: Returns the serial number of a particular time

Date and time: Converts a time in the form of text to a serial number

T.INV function

Statistical: Returns the t-value of the Student's t-distribution as a function of the probability and the degrees of freedom

T.INV.2T function

Statistical: Returns the inverse of the Student's t-distribution

Compatibility: Returns the inverse of the Student's t-distribution

Date and time: Returns the serial number of today's date

Lookup and reference: Returns the transpose of an array

Statistical: Returns values along a linear trend

Text: Removes spaces from text

Statistical: Returns the mean of the interior of a data set

Logical: Returns the logical value TRUE

Math and trigonometry: Truncates a number to an integer

T.TEST function

Statistical: Returns the probability associated with a Student's t-test

Compatibility: Returns the probability associated with a Student's t-test

In Excel 2007, this is a Statistical function.

Information: Returns a number indicating the data type of a value

UNICHAR function

Text: Returns the Unicode character that is references by the given numeric value

UNICODE function

Text: Returns the number (code point) that corresponds to the first character of the text

Lookup and reference: Returns a list of unique values in a list or range

Text: Converts text to uppercase

Text: Converts a text argument to a number

VALUETOTEXT function

Text: Returns text from any specified value

Compatibility: Estimates variance based on a sample

In Excel 2007, this is a Statistical function.

VAR.P function

Statistical: Calculates variance based on the entire population

VAR.S function

Statistical: Estimates variance based on a sample

Statistical: Estimates variance based on a sample, including numbers, text, and logical values

Compatibility: Calculates variance based on the entire population

In Excel 2007, this is a Statistical function.

Statistical: Calculates variance based on the entire population, including numbers, text, and logical values

Financial: Returns the depreciation of an asset for a specified or partial period by using a declining balance method

Lookup and reference: Looks in the first column of an array and moves across the row to return the value of a cell

WEBSERVICE function

Web: Returns data from a web service.

This function is not available in Excel for the web.

Date and time: Converts a serial number to a day of the week

Date and time: Converts a serial number to a number representing where the week falls numerically with a year

Compatibility: Calculates variance based on the entire population, including numbers, text, and logical values

In Excel 2007, this is a Statistical function.

WEIBULL.DIST function

Statistical: Returns the Weibull distribution

Date and time: Returns the serial number of the date before or after a specified number of workdays

WORKDAY.INTL function

Date and time: Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days

Financial: Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic

Lookup and reference: Searches a range or an array, and returns an item corresponding to the first match it finds. If a match doesn't exist, then XLOOKUP can return the closest (approximate) match.

Lookup and reference: Returns the relative position of an item in an array or range of cells.

Financial: Returns the net present value for a schedule of cash flows that is not necessarily periodic

XOR function

Logical: Returns a logical exclusive OR of all arguments

Date and time: Converts a serial number to a year

Date and time: Returns the year fraction representing the number of whole days between start_date and end_date

Financial: Returns the yield on a security that pays periodic interest

Financial: Returns the annual yield for a discounted security for example, a Treasury bill

Financial: Returns the annual yield of a security that pays interest at maturity

Z.TEST function

Statistical: Returns the one-tailed probability-value of a z-test

Compatibility: Returns the one-tailed probability-value of a z-test

In Excel 2007, this is a Statistical function.


Built-in Operators

Operators Precedences

Description

Relational Operators

The following operators compare the passed operands and generate a TRUE or FALSE value depending on whether the comparison between the operands holds.

Operand types

Description

TRUE if expression A is equal to expression B otherwise FALSE.

Returns same result with EQUAL(=) operator for non-null operands, but returns TRUE if both are NULL, FALSE if one of the them is NULL. (As of version 0.9.0.)

NULL if A or B is NULL, TRUE if expression A is NOT equal to expression B, otherwise FALSE.

Synonym for the <> operator.

NULL if A or B is NULL, TRUE if expression A is less than expression B, otherwise FALSE.

NULL if A or B is NULL, TRUE if expression A is less than or equal to expression B, otherwise FALSE.

NULL if A or B is NULL, TRUE if expression A is greater than expression B, otherwise FALSE.

NULL if A or B is NULL, TRUE if expression A is greater than or equal to expression B, otherwise FALSE.

NULL if A, B or C is NULL, TRUE if A is greater than or equal to B AND A less than or equal to C, otherwise FALSE. This can be inverted by using the NOT keyword. (As of version 0.9.0.)

TRUE if expression A evaluates to NULL, otherwise FALSE.

FALSE if expression A evaluates to NULL, otherwise TRUE.

Evaluates to TRUE only if A mets the condition. (since: 3.0.0 )
Note: NULL is UNKNOWN, and because of that (UNKNOWN IS TRUE) and (UNKNOWN IS FALSE) both evaluates to FALSE.

NULL if A or B is NULL, TRUE if string A matches the SQL simple regular expression B, otherwise FALSE. The comparison is done character by character. The _ character in B matches any character in A (similar to . in posix regular expressions) while the % character in B matches an arbitrary number of characters in A (similar to .* in posix regular expressions). For example, 'foobar' like 'foo' evaluates to FALSE whereas 'foobar' like 'foo_ _ _' evaluates to TRUE and so does 'foobar' like 'foo%'.

NULL if A or B is NULL, TRUE if any (possibly empty) substring of A matches the Java regular expression B, otherwise FALSE. For example, 'foobar' RLIKE 'foo' evaluates to TRUE and so does 'foobar' RLIKE '^f.*r

A function can access an outer variable as well, for example:

The function has full access to the outer variable. It can modify it as well.

The outer variable is only used if there’s no local one.

If a same-named variable is declared inside the function then it shadows the outer one. For instance, in the code below the function uses the local userName . The outer one is ignored:

Variables declared outside of any function, such as the outer userName in the code above, are called global.

Global variables are visible from any function (unless shadowed by locals).

It’s a good practice to minimize the use of global variables. Modern code has few or no globals. Most variables reside in their functions. Sometimes though, they can be useful to store project-level data.


Functions

Functions allow to structure programs in segments of code to perform individual tasks.

In C++, a function is a group of statements that is given a name, and which can be called from some point of the program. The most common syntax to define a function is:

type name ( parameter1, parameter2, . ) < statements >

Where:
- type is the type of the value returned by the function.
- name is the identifier by which the function can be called.
- parameters (as many as needed): Each parameter consists of a type followed by an identifier, with each parameter being separated from the next by a comma. Each parameter looks very much like a regular variable declaration (for example: int x ), and in fact acts within the function as a regular variable which is local to the function. The purpose of parameters is to allow passing arguments to the function from the location where it is called from.
- statements is the function's body. It is a block of statements surrounded by braces < >that specify what the function actually does.

Let's have a look at an example:

This program is divided in two functions: addition and main . Remember that no matter the order in which they are defined, a C++ program always starts by calling main . In fact, main is the only function called automatically, and the code in any other function is only executed if its function is called from main (directly or indirectly).

In the example above, main begins by declaring the variable z of type int , and right after that, it performs the first function call: it calls addition . The call to a function follows a structure very similar to its declaration. In the example above, the call to addition can be compared to its definition just a few lines earlier:


The parameters in the function declaration have a clear correspondence to the arguments passed in the function call. The call passes two values, 5 and 3 , to the function these correspond to the parameters a and b , declared for function addition .

At the point at which the function is called from within main, the control is passed to function addition : here, execution of main is stopped, and will only resume once the addition function ends. At the moment of the function call, the value of both arguments ( 5 and 3 ) are copied to the local variables int a and int b within the function.

Then, inside addition , another local variable is declared ( int r ), and by means of the expression r=a+b , the result of a plus b is assigned to r which, for this case, where a is 5 and b is 3, means that 8 is assigned to r .

The final statement within the function:

Ends function addition , and returns the control back to the point where the function was called in this case: to function main . At this precise moment, the program resumes its course on main returning exactly at the same point at which it was interrupted by the call to addition . But additionally, because addition has a return type, the call is evaluated as having a value, and this value is the value specified in the return statement that ended addition : in this particular case, the value of the local variable r , which at the moment of the return statement had a value of 8.


Therefore, the call to addition is an expression with the value returned by the function, and in this case, that value, 8, is assigned to z . It is as if the entire function call ( addition(5,3) ) was replaced by the value it returns (i.e., 8).

Then main simply prints this value by calling:

A function can actually be called multiple times within a program, and its argument is naturally not limited just to literals:

Similar to the addition function in the previous example, this example defines a subtract function, that simply returns the difference between its two parameters. This time, main calls this function several times, demonstrating more possible ways in which a function can be called.

Let's examine each of these calls, bearing in mind that each function call is itself an expression that is evaluated as the value it returns. Again, you can think of it as if the function call was itself replaced by the returned value:

If we replace the function call by the value it returns (i.e., 5), we would have:

With the same procedure, we could interpret:

since 5 is the value returned by subtraction (7,2) .

The arguments passed to subtraction are variables instead of literals. That is also valid, and works fine. The function is called with the values x and y have at the moment of the call: 5 and 3 respectively, returning 2 as result.

The fourth call is again similar:

The only addition being that now the function call is also an operand of an addition operation. Again, the result is the same as if the function call was replaced by its result: 6. Note, that thanks to the commutative property of additions, the above can also be written as:

With exactly the same result. Note also that the semicolon does not necessarily go after the function call, but, as always, at the end of the whole statement. Again, the logic behind may be easily seen again by replacing the function calls by their returned value:

Functions with no type. The use of void

The syntax shown above for functions:

type name ( argument1, argument2 . ) < statements >

Requires the declaration to begin with a type. This is the type of the value returned by the function. But what if the function does not need to return a value? In this case, the type to be used is void , which is a special type to represent the absence of value. For example, a function that simply prints a message may not need to return any value:

void can also be used in the function's parameter list to explicitly specify that the function takes no actual parameters when called. For example, printmessage could have been declared as:

In C++, an empty parameter list can be used instead of void with same meaning, but the use of void in the argument list was popularized by the C language, where this is a requirement.

Something that in no case is optional are the parentheses that follow the function name, neither in its declaration nor when calling it. And even when the function takes no parameters, at least an empty pair of parentheses shall always be appended to the function name. See how printmessage was called in an earlier example:

The parentheses are what differentiate functions from other kinds of declarations or statements. The following would not call the function:

The return value of main

You may have noticed that the return type of main is int , but most examples in this and earlier chapters did not actually return any value from main .

Well, there is a catch: If the execution of main ends normally without encountering a return statement the compiler assumes the function ends with an implicit return statement:

Note that this only applies to function main for historical reasons. All other functions with a return type shall end with a proper return statement that includes a return value, even if this is never used.

When main returns zero (either implicitly or explicitly), it is interpreted by the environment as that the program ended successfully. Other values may be returned by main , and some environments give access to that value to the caller in some way, although this behavior is not required nor necessarily portable between platforms. The values for main that are guaranteed to be interpreted in the same way on all platforms are:

valuedescription
0 The program was successful
EXIT_SUCCESS The program was successful (same as above).
This value is defined in header <cstdlib> .
EXIT_FAILURE The program failed.
This value is defined in header <cstdlib> .

Because the implicit return 0 statement for main is a tricky exception, some authors consider it good practice to explicitly write the statement.

Arguments passed by value and by reference

In the functions seen earlier, arguments have always been passed by value. This means that, when calling a function, what is passed to the function are the values of these arguments on the moment of the call, which are copied into the variables represented by the function parameters. For example, take:

In this case, function addition is passed 5 and 3, which are copies of the values of x and y , respectively. These values (5 and 3) are used to initialize the variables set as parameters in the function's definition, but any modification of these variables within the function has no effect on the values of the variables x and y outside it, because x and y were themselves not passed to the function on the call, but only copies of their values at that moment.


In certain cases, though, it may be useful to access an external variable from within a function. To do that, arguments can be passed by reference, instead of by value. For example, the function duplicate in this code duplicates the value of its three arguments, causing the variables used as arguments to actually be modified by the call:

To gain access to its arguments, the function declares its parameters as references. In C++, references are indicated with an ampersand ( & ) following the parameter type, as in the parameters taken by duplicate in the example above.

When a variable is passed by reference, what is passed is no longer a copy, but the variable itself, the variable identified by the function parameter, becomes somehow associated with the argument passed to the function, and any modification on their corresponding local variables within the function are reflected in the variables passed as arguments in the call.

In fact, a , b , and c become aliases of the arguments passed on the function call ( x , y , and z ) and any change on a within the function is actually modifying variable x outside the function. Any change on b modifies y , and any change on c modifies z . That is why when, in the example, function duplicate modifies the values of variables a , b , and c , the values of x , y , and z are affected.

If instead of defining duplicate as:

Was it to be defined without the ampersand signs as:

The variables would not be passed by reference, but by value, creating instead copies of their values. In this case, the output of the program would have been the values of x , y , and z without being modified (i.e., 1, 3, and 7).

Efficiency considerations and const references

Calling a function with parameters taken by value causes copies of the values to be made. This is a relatively inexpensive operation for fundamental types such as int , but if the parameter is of a large compound type, it may result on certain overhead. For example, consider the following function:

This function takes two strings as parameters (by value), and returns the result of concatenating them. By passing the arguments by value, the function forces a and b to be copies of the arguments passed to the function when it is called. And if these are long strings, it may mean copying large quantities of data just for the function call.

But this copy can be avoided altogether if both parameters are made references:

Arguments by reference do not require a copy. The function operates directly on (aliases of) the strings passed as arguments, and, at most, it might mean the transfer of certain pointers to the function. In this regard, the version of concatenate taking references is more efficient than the version taking values, since it does not need to copy expensive-to-copy strings.

On the flip side, functions with reference parameters are generally perceived as functions that modify the arguments passed, because that is why reference parameters are actually for.

The solution is for the function to guarantee that its reference parameters are not going to be modified by this function. This can be done by qualifying the parameters as constant:

By qualifying them as const , the function is forbidden to modify the values of neither a nor b , but can actually access their values as references (aliases of the arguments), without having to make actual copies of the strings.

Therefore, const references provide functionality similar to passing arguments by value, but with an increased efficiency for parameters of large types. That is why they are extremely popular in C++ for arguments of compound types. Note though, that for most fundamental types, there is no noticeable difference in efficiency, and in some cases, const references may even be less efficient!

Inline functions

Calling a function generally causes a certain overhead (stacking arguments, jumps, etc. ), and thus for very short functions, it may be more efficient to simply insert the code of the function where it is called, instead of performing the process of formally calling a function.

Preceding a function declaration with the inline specifier informs the compiler that inline expansion is preferred over the usual function call mechanism for a specific function. This does not change at all the behavior of a function, but is merely used to suggest the compiler that the code generated by the function body shall be inserted at each point the function is called, instead of being invoked with a regular function call.

For example, the concatenate function above may be declared inline as:

This informs the compiler that when concatenate is called, the program prefers the function to be expanded inline, instead of performing a regular call. inline is only specified in the function declaration, not when it is called.

Note that most compilers already optimize code to generate inline functions when they see an opportunity to improve efficiency, even if not explicitly marked with the inline specifier. Therefore, this specifier merely indicates the compiler that inline is preferred for this function, although the compiler is free to not inline it, and optimize otherwise. In C++, optimization is a task delegated to the compiler, which is free to generate any code for as long as the resulting behavior is the one specified by the code.

Default values in parameters

In C++, functions can also have optional parameters, for which no arguments are required in the call, in such a way that, for example, a function with three parameters may be called with only two. For this, the function shall include a default value for its last parameter, which is used by the function when called with fewer arguments. For example:

In this example, there are two calls to function divide . In the first one:

The call only passes one argument to the function, even though the function has two parameters. In this case, the function assumes the second parameter to be 2 (notice the function definition, which declares its second parameter as int b=2 ). Therefore, the result is 6.

The call passes two arguments to the function. Therefore, the default value for b ( int b=2 ) is ignored, and b takes the value passed as argument, that is 4, yielding a result of 5.

Declaring functions

In C++, identifiers can only be used in expressions once they have been declared. For example, some variable x cannot be used before being declared with a statement, such as:

The same applies to functions. Functions cannot be called before they are declared. That is why, in all the previous examples of functions, the functions were always defined before the main function, which is the function from where the other functions were called. If main were defined before the other functions, this would break the rule that functions shall be declared before being used, and thus would not compile.

The prototype of a function can be declared without actually defining the function completely, giving just enough details to allow the types involved in a function call to be known. Naturally, the function shall be defined somewhere else, like later in the code. But at least, once declared like this, it can already be called.

The declaration shall include all types involved (the return type and the type of its arguments), using the same syntax as used in the definition of the function, but replacing the body of the function (the block of statements) with an ending semicolon.

The parameter list does not need to include the parameter names, but only their types. Parameter names can nevertheless be specified, but they are optional, and do not need to necessarily match those in the function definition. For example, a function called protofunction with two int parameters can be declared with either of these statements:

Anyway, including a name for each parameter always improves legibility of the declaration.

This example is indeed not an example of efficiency. You can probably write yourself a version of this program with half the lines of code. Anyway, this example illustrates how functions can be declared before its definition:

Declare the prototype of the functions. They already contain all what is necessary to call them, their name, the types of their argument, and their return type ( void in this case). With these prototype declarations in place, they can be called before they are entirely defined, allowing for example, to place the function from where they are called ( main ) before the actual definition of these functions.

But declaring functions before being defined is not only useful to reorganize the order of functions within the code. In some cases, such as in this particular case, at least one of the declarations is required, because odd and even are mutually called there is a call to even in odd and a call to odd in even . And, therefore, there is no way to structure the code so that odd is defined before even , and even before odd .

Recursivity

Recursivity is the property that functions have to be called by themselves. It is useful for some tasks, such as sorting elements, or calculating the factorial of numbers. For example, in order to obtain the factorial of a number ( n! ) the mathematical formula would be:

n! = n * (n-1) * (n-2) * (n-3) . * 1
More concretely, 5! (factorial of 5) would be:

5! = 5 * 4 * 3 * 2 * 1 = 120
And a recursive function to calculate this in C++ could be:


Function scope

Kotlin functions can be declared at the top level in a file, meaning you do not need to create a class to hold a function, which you are required to do in languages such as Java, C# or Scala. In addition to top level functions, Kotlin functions can also be declared locally, as member functions and extension functions.

Local functions

Kotlin supports local functions, which are functions inside another function:

A local function can access local variables of outer functions (the closure). In the case above, the visited can be a local variable:

Member functions

A member function is a function that is defined inside a class or object:

Member functions are called with dot notation:

For more information on classes and overriding members see Classes and Inheritance.


Azure Functions Python Library

Python support for Azure Functions is based on Python 3.6/3.7/3.8 and 3.9 (coming soon), serverless hosting on Linux and the Functions 2.0 runtime.

Here is the current status of Python in Azure Functions:

What are the supported Python versions?

Azure Functions Runtime Python 3.6 Python 3.7 Python 3.8 Python 3.9
Azure Functions 2.0 ✔ ✔ - -
Azure Functions 3.0 ✔ ✔ ✔ (preview)

  • Build, test, debug and publish using Azure Functions Core Tools (CLI) or Visual Studio Code
  • Triggers / Bindings : HTTP, Blob, Queue, Timer, Cosmos DB, Event Grid, Event Hubs and Service Bus
  • Create a Python Function on Linux using a custom docker image
  • Triggers / Bindings : Custom binding support

Get Started

Give Feedback

Issues and feature requests are tracked in a variety of places. To report this feedback, please file an issue to the relevant repository below:


Изменить имя функции, регион или триггер

Если вы переименовываете или изменяете регионы или триггер для функций, обрабатывающих производственный трафик, следуйте инструкциям в этом разделе, чтобы избежать потери событий во время модификации. Прежде чем выполнять эти шаги, сначала убедитесь, что ваша функция идемпотентна , поскольку и новая версия, и старая версия вашей функции будут работать одновременно во время изменения.

Переименовать функцию

Чтобы переименовать функцию, создайте новую переименованную версию функции в index.js а затем выполните две отдельные команды развертывания. Первая команда развертывает функцию с новым именем, а вторая команда удаляет ранее развернутую версию. Например, если у вас есть функция с именем webhook которую вы хотите изменить на webhookNew , измените код следующим образом:

Затем выполните следующие команды, чтобы развернуть новую функцию:

Изменить регион или регионы функции

Если вы изменяете указанные регионы для функции, обрабатывающей производственный трафик, вы можете предотвратить потерю событий, выполнив следующие шаги по порядку:

  1. Переименуйте функцию и измените ее регион или регионы по желанию.
  2. Разверните переименованную функцию, что приведет к временному запуску одного и того же кода в обоих наборах регионов.
  3. Удалить предыдущую функцию.

Например, если у вас есть функция с именем webhook которая в настоящее время находится в области функций по умолчанию us-central1 , и вы хотите перенести ее в asia-northeast1 , вам необходимо сначала изменить исходный код, чтобы переименовать функцию и изменить регион. .

Затем разверните, запустив:

Теперь работают две идентичные функции: webhook работает в us-central1 , а webhookAsia работает в asia-northeast1 .

Сейчас есть только одна функция - webhookAsia , которая работает в asia-northeast1 .

Изменить тип триггера функции

По мере разработки облачных функций для развертывания Firebase с течением времени вам может потребоваться изменить тип триггера функции по разным причинам. Например, вы можете захотеть:

  • Переход от унаследованного хранения onChange события в onFinalize , onDelete , onArchive и onMetadataUpdate . (Дополнительные сведения об этом см. В руководстве по обновлению с бета-версии до версии 1 или версии 2 ).
  • Измените один тип события Firebase Realtime Database или Cloud Firestore на другой, например общее событие onWrite на onCreate событие onCreate .

Невозможно изменить тип события функции, просто изменив исходный код и запустив firebase deploy . Чтобы избежать ошибок, измените тип триггера функции с помощью этой процедуры:

  1. Измените исходный код, чтобы включить новую функцию с желаемым типом триггера.
  2. Разверните функцию, что приведет к временному запуску как старой, так и новой функции.
  3. Явно удалите старую функцию из рабочей среды с помощью интерфейса командной строки Firebase.

Например, если у вас есть функция objectChanged с унаследованным onChange события onChange , и вы хотите изменить ее на onFinalize , сначала переименуйте функцию и отредактируйте ее, чтобы она имела onFinalize события onFinalize .

Затем выполните следующие команды, чтобы сначала создать новую функцию, прежде чем удалять старую:


Lag-3, Tim-3, and TIGIT: Co-inhibitory Receptors with Specialized Functions in Immune Regulation

Co-inhibitory receptors, such as CTLA-4 and PD-1, have an important role in regulating T cell responses and have proven to be effective targets in the setting of chronic diseases where constitutive co-inhibitory receptor expression on T cells dampens effector T cell responses. Unfortunately, many patients still fail to respond to therapies that target CTLA-4 and PD-1. The next wave of co-inhibitory receptor targets that are being explored in clinical trials include Lag-3, Tim-3, and TIGIT. These receptors, although they belong to the same class of receptors as PD-1 and CTLA-4, exhibit unique functions, especially at tissue sites where they regulate distinct aspects of immunity. Increased understanding of the specialized functions of these receptors will inform the rational application of therapies that target these receptors to the clinic.

Copyright © 2016 Elsevier Inc. All rights reserved.

Figures

Figure 1. Co-inhibitory receptor pathways

Figure 1. Co-inhibitory receptor pathways

A) The Lag-3 pathway. Left panel, Lag-3 is expressed on…

Figure 2. The Lag-3, Tim-3, and TIGIT…

Figure 2. The Lag-3, Tim-3, and TIGIT pathways in autoimmunity

A) Lag-3 plays a protective…

Figure 3. The Lag-3, Tim-3, and TIGIT…

Figure 3. The Lag-3, Tim-3, and TIGIT pathways in chronic diseases

Figure 4. Hierarchy of co-inhibitory receptors

Figure 4. Hierarchy of co-inhibitory receptors

Co-inhibitory receptors are ranked from top to bottom according…

Figure 5. Specification of checkpoint-receptor pathways

Figure 5. Specification of checkpoint-receptor pathways

A) Lymphoid specification. Some co-inhibitory receptors are preferentially expressed…


When the function is invoked, the recorded <commands> are first modified by replacing formal parameters ( $ , . ) with the arguments passed, and then invoked as normal commands.

In addition to referencing the formal parameters you can reference the ARGC variable which will be set to the number of arguments passed into the function as well as ARGV0 , ARGV1 , ARGV2 , . which will have the actual values of the arguments passed in. This facilitates creating functions with optional arguments.

Furthermore, ARGV holds the list of all arguments given to the function and ARGN holds the list of arguments past the last expected argument. Referencing to ARGV# arguments beyond ARGC have undefined behavior. Checking that ARGC is greater than # is the only way to ensure that ARGV# was passed to the function as an extra argument.


Watch the video: Μητρ. Σιατίστης κ. Παύλος: Η προηγιασμένη θ. Λειτουργία 9-3-17 (September 2021).