# 28.5 Script Accessible Functions

## Date and Time

 Date Returns the Julian-day value which Origin uses internally to represent dates. Day Returns the day number of a given date. Hour Returns the hour as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.). Minute Returns the minutes as an integer, ranging from 0 to 59. Month Returns the month as an integer from 1 (January) to 12 (December). MonthName Returns the Month name for specified month by index of 1 to 12, or as a Date value. Now Returns the current date-time as a date(Julian days) value. Quarter returns 1,2,3,4 with date argument. Second Returns the seconds as a real value in the range 0 (zero) to 59.9999... Time Returns the Julian-day value which Origin uses internally to represent time. Today Returns the current date as a date(Julian days) value. WeekDay Return 1,2,3 etc for day of the week. WeekNum Returns 1 to 53, indicating the calendar week number of the year. Year Returns the year as an integer in the range 0100-9999. YearName Returns the year in string form with input of year or date, with option n.

## String and characters

 Char Returns the character specified by the code number. Code Returns a numeric code for the first character in input string Compare To compare str1 with str2, identical will return 1. Exact Returns TRUE if both strings are an exact match (case and length). Find Return location of a substring(str2) in a string(str1). The search is case-sensitive. To do case insensitive search, use the Search function. Format Convert double to string with LabTalk formatting option. Formatting option default is "*" will use @SD significant digits, "*3" will show as 3 significant digits. Left Returns left-most n characters. Len Return the length of a string. Lower CONVERT TO lowercase MatchBegin Return the beginning location of a substring in a string(str1) by using a string pattern(str2) containing wildcard characters like * or ?. MatchEnd Return the ending location of a substring in a string(str1) by using a string pattern(str2) containing wildcard characters like * or ?. Mid Returns n2 characters of string starting from n1th position (numbered from 1). Replace Replace n2 characters in string1 starting at n1th position with string2. String2 may be different length than n2. Right Returns right-most n characters Search Return the location of a substring(str2) in a string(str1). the search is NOT case-sensitive. To do case-sensitive search, use the Find function. Substitute Substitute string3 with string2 when found in string1. n=0 Substitute all, otherwise only nth instance. Trim Trim spaces from string, options include. Upper Convert to UPPERCASE

## Statistics

 Ave Breaks dataset into groups of size size, finds the average for each group, and returns a range containing these values. Count Counts elements in a vector. Cov Returns the covariance between two datasets. Diff Returns a dataset that contains the difference between adjacent elements in dataset. Histogram Generates data bins from dataset in the specified range from min to max. The bin width is equal to inc. Max Returns the maximum of a vector. Mean Returns the average of a vector. Median Returns median of vdData with nInterpolation. Min Returns the minimum of a vector. Percentile Returns a range comprised of the percentile values for dataset1 at each percent value specified in dataset2. QCD2 Returns a factor (Quality Control D2 Factor) that estimates the standard deviation of a parent distribution (or population) from an average range when the sample size (or subgroup size) n is given. QCD3 Returns a factor (Quality Control D3 Factor) that determines the 3-sigma lower control limit for R charts (Range of Sample Charts) from the average range when the sample size (or subgroup size) n is given. QCD4 Returns a factor (Quality Control D4 Factor) that determines the 3-sigma upper control limit for R charts (Range of Sample Charts) from the average range when the sample size (or subgroup size) n is given. Ss Assumes the mean of the data as the reference value. StdDev The Sample Standard Deviation. StdDevP The Sample Standard Deviation. Sum Returns a range whose i th element is the sum of the first i elements of the dataset dataset. Total Returns the sum of a vector.

## Distributions

### CDF

 Betacdf Computes beta cumulative distribution function at $x$, with parameters $a$ and $b$. Binocdf Computes the lower tail, upper tail and point probabilities in given value $k$, associated with a Binomial distribution using the corresponding parameters in $n$, $p$. Bivarnormcdf Computes the lower tail probability for the bivariate Normal distribution. Chi2cdf Computes the lower tail probability for the $\chi^2$ distribution with real degrees of freedom. Fcdf Computes $F$ cumulative distribution function at $x$, with parameters$a$ and$b$, and lower tail. Gamcdf Computes the lower tail probability for the gamma distribution with real degrees of freedom, with parameters$\alpha$ and $\beta$ . Hygecdf Computes the lower tail probabilities in given value , associated with a hypergeometric distribution using the corresponding parameters in ,nand . Ncbetacdf Computes the cdf with the lower tail of the non-central beta distribution. Ncchi2cdf Computes the probability associated with the lower tail of the non-central $\chi^2$ distribution. Ncfcdf Computes the probability associated with the lower tail of the non-central $\digamma$ or variance-ratio distribution. Normcdf Computes the lower tail probability for the standard distribution. Poisscdf Computes the lower tail probabilities in given value $k$, associated with a Poisson distribution using the corresponding parameters in $\lambda$. Srangecdf Computes the probability associated with the lower tail of the distribution of the Studentized range statistic. Tcdf Computes the cumulative distribution function of Student's t-distribution. Wblcdf Computes the low tail Weibull cumulative distribution function for value $x$ using the parameters $a$ and $b$.

### PDF

 Betapdf Returns the probability density function of the beta distribution with parameters a and b. Binopdf Returns the probability density function of the binomial distribution with parameters n, p. Cauchypdf Returns the pdf of the cauchy distribution with location parameter a and scale parameter b, evaluated at the values in X. Exppdf Returns the probability density function of the exponential distribution with mean parameter lambda, evaluated at the values in X. Gampdf Computes the gamma probability density function at each of the values in X using the corresponding shape parameters in a and scale parameters in b. Ks2density returns the 2D kernel density at point (x,y) with respect to a function using scale (wx,wy). Ksdensity returns the kernel density at x for a given vector vX with a bandwidth w. Lappdf Returns the probability density function of the laplace distribution with location parameter a and scale parameter b, evaluated at the values in X. Lognpdf Returns values at X of the lognormal probability density function with distribution parameters mu and sigma. Normpdf Returns the probability density function at each of the values in X using the normal distribution with mean mu and standard deviation sigma. Poisspdf Returns the Poisson probability density function at each of the values in X using mean parameters in lambda. Wblpdf Returns the probability density function of the Weibull distribution with parameters a and b.

### INV

 betainv Returns the inverse of the cumulative distribution function for a specified beta distribution. Chi2inv Computes the inverse of the $\chi^2$ cdf for the corresponding probabilities in $X$ with parameters specified by $\nu$. Finv Computes the inverse of $F$ cdf at $x$, with parameters $\nu_1$ and $\nu_2$ . Gaminv Computes the inverse of Gamma cdf at $g_p$ , with parameters $a$ and $b$. Norminv computes the deviate,$x_p$, associated with the given lower tail probabilip,$p$, of the standardized normal distributio. Srangeinv Computes the deviate, $x_p$, associated with the lower tail probability of the distribution of the Studentized range statistic. Tinv Computes the deviate associated with the lower tail probability of Student's t-distribution with real degrees of freedom. Wblinv Computes the inverse Weibull cumulative distribution function for the given probability using the parameters a and b.

## Math

 abs Returns the absolute value of a number acos Return the arccosine of a number, the result is in radians Acosh Return the inverse hyperbolic cosin. Angle Returns the angle in radians. Asin Returns the inverse of the corresponding trigonometric function. Asinh Return the inverse hyperbolic sine. Atan Returns the inverse of the corresponding trigonometric function. Atanh Return the inverse hyperbolic tangent. Beta The Beta function has the following form: beta(a, b). Cos Returns value of cosine for each value of the given x. Cosh The cosh(x) function is the hyperbolic form of cos(x) . Degrees Converts the radians into degrees. Exp Returns the exponential value of x. IncBeta Incomplete Beta Function. incf the incomplete F-table function Int Returns the truncated integer of x. For example, int(7.9) = 7. Inverf Computes inverse error function fnction at x. J0 Zero Order Bessel Function J1 First Order Bessel Function Jn The Bessel function of order n (where n is an integer) Ln Returns the natural logarithm value of x. Log Returns the base 10 logarithm value of x. Mod Returns the integer modulus (the remainder from division) of integer x divided by integer y. Nint The return value of the nint(x) function is identical to round(x, 0). Prec Returns a value (or a dataset) such that the numbers contain p places of significance. Rmod Returns the real modulus (the remainder from division) of real number x divided by real number y. Round Returns a value (or a dataset) with p decimal places accuracy. Sin Returns value of sine for each value of the given x. Sinh The sinh(x) function is the hyperbolic form of sin(x). Sqrt The sqrt(x) function returns the square root of x. Tan Returns value of tangent for each value of the given x. Tanh The tanh(x) function is the hyperbolic form of and tan(x). Y0 Zero Order Bessel Function of Second Kind Y1 First order Bessel function of second kind Yn Bessel Function of Second Kind Radians converts degrees into radians. Distance returns the distance with two points. Distance3D returns the distance with two points in 3D. Angleint1 returns angle with one line which through two points(x1, y1) and (x2, y2) with X axis. Returns degrees if unit=1 or radians if unit=0, default is radians. Angleint2 returns angle with two lines. Returns degrees if unit=1 or radians if unit=0, default is radians.

## Data Generation

 Data Creates a dataset with an initial value of x1, a final value of x2, and an increment equal to inc. Errof Returns the dataset (error column) containing the error values of dataset. FindMasks Returns a dataset that contains the indexes of the masked data points. Grnd Returns a value from a normally (Gaussian) distributed sample, with zero mean and unit standard deviation. Normal Returns a range with npts number of values. Peaks Returns a dataset containing indices of peaks found using width and minHeight as a criteria. Poisson Returns npts number of random integers having a Poisson distribution with mean mean.seed is optional. ran return a value between 0 and 1 from a uniformly distributed sample. Rnd Return a value between 0 and 1 from a uniformly distributed sample. TReplace Returns a dataset. Uniform Returns a range with npts number of values. Xof Returns a string containing the X values of dataset.

## Miscellanneous

 BitAND return bitwise AND operation of two intergers. BitOR return bitwise OR operation of two intergers. BitXOR return bitwise XOR operation of two intergers. ISNA determind whether the number is a NANUM. NA return NANUM. sort Returns a dataset that contains dataset, sorted in ascending order.

## NAG Special

 Airy_ai Evaluates an approximation to the Airy function, Ai(x). Airy_ai_deriv Evaluates an approximation to the derivative of the Airy function Ai(x). It is based on a number of Chebyshev expansions. Airy_bi Evaluates an approximation to the Airy function Bi(x). Airy_bi_deriv Evaluates an approximation to the derivative of the Airy function Bi(x). It is based on a number of Chebyshev expansions. Bessel_i_nu Evaluates an approximation to the modified Bessel function of the first kind I$\nu$/4 (x), where the order v=-3, -2, -1, 1, 2 or 3 and x is real and positive. Bessel_i_nu_scaled Evaluates an approximation to the modified Bessel function of the first kind $e^{-x}I_{\frac \nu 4}(x)$, where the order =-3, -2, -1, 1, 2 or 3 and x is real and positive. Bessel_i0 Evaluates an approximation to the modified Bessel function of the first kind, I0(x). Bessel_i0_scaled Evaluates an approximation to $e^{-|x|}I_0(x)$, where IO is a modified Bessel function of the first kind. Bessel_i1 Evaluates an approximation to the modified Bessel function of the first kind,$I_1(x)$. Bessel_i1_scaled Evaluates an approximation to $e^{-|x|}I_1(x)$, where $I_1(x)$ is a modified Bessel function of the first kind. Bessel_j0 Evaluates the Bessel function of the first kind,$J_0(x)$. Bessel_j1 Evaluates an approximation to the Bessel function of the first kind $J_1(x)$. Bessel_k_nu Evaluates an approximation to the modified Bessel function of the second kind $K_{\upsilon /4}(x)$, where the order =-3, -2, -1, 1, 2 or 3 and x is real and positive. Bessel_k_nu_scaled Evaluates an approximation to the modified Bessel function of the second kind $e^{-x}K_{\upsilon /4}(x)$, where the order $\nu$ = -3, -2, -1, 1, 2 or 3 and x is real and positive. Bessel_k0 Evaluates an approximation to the modified Bessel function of the second kind,$K_0\left( x\right)$. Bessel_k0_scaled Evaluates an approximation to $e^xK_0\left( x\right)$, where $K_0$ is a modified Bessel function of the second kind. Bessel_k1 Evaluates an approximation to the modified Bessel function of the second kind,$K_1\left( x\right)$ . Bessel_k1_scaled Evaluates an approximation to $e^xK_1\left( x\right)$, where $k_1$is a modified Bessel function of the second kind. Bessel_y0 Evaluates the Bessel function of the second kind, Y0 Bessel_y1 Evaluates the Bessel function of the second kind, Y1. Cos_integral Evaluates $Ci=cos\_integral(x)$. Cumul_normal Evaluates the cumulative Normal distribution function. Cumul_normal_complem Evaluates an approximate value for the complement of the cumulative normal distribution function. Elliptic_integral_rc Calculates an approximate value for the integral where x ≥ 0 and y ≠ 0. Elliptic_integral_rd Calculates an approximate value for the integral where x, y ≥ 0, at most one of x and y is zero, and z > 0. Elliptic_integral_rf Calculates an approximation to the integral where x, y, z ≥ 0 and at most one is zero. Elliptic_integral_rj Calculates an approximation to the integral Where x,y,z ≥ 0 , $\rho$ ≠0 and at most one of x, y and z is zero. Erf Calculates the error function (or normal error integral). Erfc Calculates an approximate value for the complement of the error function. erfcinv Computes the value of the inverse complementary error function for specified y erfcx Calculates the scaled complementary error function erfinv Calculates the inverse error function Exp_integral Evaluates $E1 = exp\_integral(x)$. Fresnel_c Evaluates an approximation to the Fresnel Integral. Fresnel_s Evaluates an approximation to the Fresnel Integral which is based on Chebyshev expansions. Gamma Evaluates $gamma = gamma(x)$. Incomplete_gamma Evaluates the incomplete gamma functions in the normalized form. jacobian_theta Computes the value of one of the Jacobian theta functions Kelvin_bei Evaluates an approximation to the Kelvin function bei x. Kelvin_ber Evaluates an approximation to the Kelvin function ber x. Kelvin_kei Evaluates an approximation to the Kelvin function kei x. Kelvin_ker Evaluates an approximation to the Kelvin function ker x. Log_gamma Evaluates $\ln \Gamma (x)$.x > 0 which is based on Chebyshev expansions. Real_polygamma Evaluates an approximation to the kth derivative of the psi function ψ(x). Sin_integral Evaluates Si = sin_integral(x).