Japanese English

Vnano Math Plug-in Group
(org.vcssl.nano.plugin.math package)


Abstract

Plug-ins in this package/subpackages provide elementary math & statistical functions available in scripts of the Vnano (VCSSL nano).
Features provided by these plug-ins is a subset (*) of the VCSSL Math Library and the math.StatisticalFunction Library which are a standard libraries of the VCSSL, so same features are also available in scripts of the VCSSL by default, with importing them at the head of the script as: " import Math; import math.StatisticalFunction; "

* Features of some math functions (e.g.: sin) provided by plug-ins in this package are extended to make it possible to get/return arrays. It has not been supported yet on the VCSSL, so it is only available on the Vnano.

List of Provided Plug-ins and Features

MathElementaryXnci1Plugin
Provides elementary math functions.
Variable: PI
Function: rad(degree) / deg(radian) / sin(x) / cos(x) / tan(x) / asin(x) / acos(x) / atan(x) / sqrt(x) / ln(x) / log10(x) / pow(x,exponent) / exp(x) / abs(x)
MathStatisticalXnci1Plugin
Provides elementary statistical functions.
Function: sum(...) / mean(...) / van(...) / van1(...) / sdn(...) / sdn1(...)

License

All of the above plug-ins are released under CC0.


MathElementaryXnci1Plugin
(org.vcssl.nano.math.xnci1.MathElementaryXnci1Plugin)

The plug-in providing elementary math functions.

Variables

Variable PI
Value Storing the value of the circle ratio .
Data Type float (constant)

Functions

Function rad( degree )
Feature The conversion function from degree to radian. Converts the value in the unit of degree passed as an argument "degree" to the value in the unit of radian, and returns it. When an array is passed, converts each elements of it, stores them in another array, and returns it. Please note that, the conversion result will not be shifted automatically to taking value in the range of [0, 2), so you will get the result value exceeding 2 if you will pass the argument exceeding 360.
Signature float[...] rad( const float &degree[...] )
Params (float type, any rank) degree: The value in the unit of degree to be converted to the value in the unit of radian.
Return value (float type, having same ranl/length with the param) The converted value in the unit of radian.
Example print( rad(180.0) ); // 3.14...
Function deg( radian )
Feature The conversion function from radian to degree. Converts the value in the unit of degree passed as an argument "degree" to the value in the unit of radian, and returns it. When an array is passed, converts each elements of it, stores them in another array, and returns it. Please note that, the conversion result will not be shifted automatically to taking value in the range of [0, 360), so you will get the result value exceeding 360 if you will pass the argument exceeding 2.
Signature float[...] deg( const float &radian[...] )
Params (float type, any rank) radian: The value in the unit of radian to be converted to the value in the unit of degree.
Return (float type, having same rank/length with the param) The converted value in the unit of degree.
Example print( deg(PI) ); // 180.0
Function sin( x )
Feature The sine function. The unit of the argument "x" is radian. When an array is passed, computes the value of sin(x[i]) for each elements x[i], stores them in another array, and returns it.
Singature float[...] sin( const float &x[...] )
Params (float type, any rank) x: The argument of the sine function in the unit of radian.
Return (float type, having same rank/length with the param) The value of the sine function.
Example print( sin(PI/2.0) ); // 1.0
Function cos( x )
Feature The cosine function. The unit of the argument "x" is radian. When an array is passed, computes the value of cos(x[i]) for each elements x[i], stores them in another array, and returns it.
Singature float[...] cos( const float &x[...] )
Params (float type, any rank) x: The argument of the cosine function in the unit of radian.
Return (float type, having same rank/length with the param) The value of the cosine function.
Example print( cos(PI*2.0) ); // 1.0
Function tan( x )
Feature The tangent function. The unit of the argument "x" is radian. When an array is passed, computes the value of tan(x[i]) for each elements x[i], stores them in another array, and returns it.
Signature float[...] tan( const float &x[...] )
Params (float type, any rank) x: The argument of the tangent function in the unit of radian.
Return (float type, having same rank/length with the param) The value of the tangent function.
Example print( tan(PI/4.0) ); // 0.99999... (The true value is 1. The difference between the result and the true value is caused by tiny numerical error related with precisions of data/algorithm/etc., so it is not a bug.)
Function asin( x )
Feature The inverse function of sine (arc-sine). The unit of the result is radian. When an array is passed, computes the value of asin(x[i]) for each elements x[i], stores them in another array, and returns it.
Signature float[...] asin( const float &x[...] )
Params (float type, any rank) x: The argument of the arc-sine function.
Return (float type, having same rank/length with the param) The value of the arc-sine function in the unit of radian.
Example print( asin(1.0) ); // 1.5707963... (/2)
Function acos( x )
Feature The inverse function of cosine (arc-cosine). The unit of the result is radian. When an array is passed, computes the value of acos(x[i]) for each elements x[i], stores them in another array, and returns it.
Signature float[...] acos( const float &x[...] )
Params (float type, any rank) x: The argument of the arc-cosine function.
Return (float type, having same rank/length with the param) The value of the arc-cosine function in the unit of radian.
Example print( acos(-1.0) ); // 3.14... ()
Function atan( x )
Feature The inverse function of cosine (arc-tangent). The unit of the result is radian. When an array is passed, computes the value of atan(x[i]) for each elements x[i], stores them in another array, and returns it.
Signature float[...] atan( const float &x[...] )
Params (float type, any rank) x: The argument of the arc-tangent function.
Return (float type, having same rank/length with the param) The value of the arc-tangent function in the unit of radian.
Example print( atan(1.0) ); // 0.78539... (/4)
Function sqrt( x )
Feature The square-root function. When an array is passed, computes the value of sqrt(x[i]) for each elements x[i], stores them in another array, and returns it.
Signature float[...] sqrt( const float &x[...] )
Params (float type, any rank) x: The value of which square root should be computed.
Return (float type, having same rank/length with the param) The square root value of the argument.
Example print( sqrt(4.0) ); // 2.0
Function ln( x )
Feature The logarithm function with the base "e" (napier number). When an array is passed, computes the value of ln(x[i]) for each elements x[i], stores them in another array, and returns it.
Signature float[...] ln( const float &x[...] )
Params (float type, any rank) x: The argument of the logarithm function.
Return (float type, having same rank/length with the param) The value of the logarithm function with the base "e" (napier number).
Example print( ln(10.0) ); // 2.3025...
Function log10( x )
Feature The logarithm function with the base 10. When an array is passed, computes the value of ln(x[i]) for each elements x[i], stores them in another array, and returns it.
Signature float[...] log10( const float &x[...] )
Params (float type, any rank) x: The argument of the logarithm function.
Return (float type, having same rank/length with the param) The value of the logarithm function with the base 10.
Example print( log10(10.0) ); // 1.0
Function pow( x, exponent )
Feature The function which returns the value of &qupt;x&qupt; to &qupt;exponent&qupt;-power. When an array is passed, computes the value of pow(x[i], exponent) for each elements x[i], stores them in another array, and returns it.
Signature float[...] pow( const float &x[...], const float &exponent )
Params (float type, any rank) x: see "Feature" section.
(float type) exponent: see "Feature" section.
Return (float type, having same rank/length with the param x) The value of &qupt;x&qupt; to &qupt;exponent&qupt;-power.
Example print( pow(2.0,3.0) ); // 8.0
Function exp( exponent )
Fearure The function which returns the value of &qupt;e&qupt; (napier number) to &qupt;exponent&qupt;-power. When an array is passed, computes the value of exp(x[i]) for each elements x[i], stores them in another array, and returns it.
Signature float[...] exp( const float &exponent[...] )
Params (float type, any rank) exponent: see "Feature" section.
Return (float type, having same rank/length with the param) The value of &qupt;e&qupt; (napier number) to &qupt;exponent&qupt;-power.
Example print( exp(2.0) ); // 7.38905... ( squared value of "e")
Function abs( x )
Feature The absolute-value function. When an array is passed, computes the value of abs(x[i]) for each elements x[i], stores them in another array, and returns it.
Signature float[...] abs( const float &x[...] )
Params (float type, any rank) x: The value of which absolute value should be computed.
Return (float type, having same rank/length with the param) The absolute value.
Example print( abs(-1.23) ); // 1.23

MathStatisticalXnci1Plugin
(org.vcssl.nano.math.xnci1.MathStatisticalXnci1Plugin)

The plug-in providing elementary statistical functions.

Functions

Function sum(...)
Feature Computes the summation value.
Signature float sum( ... float )
Params (float type, can pass any number of values) Values of which summation value should be computed.
Return (float type) The summation value.
Example print( sum(1.0, 2.5, 4.0) ); // 7.5
Function mean(...)
Feature Computes the arithmetic mean value.
Signature float mean( ... float )
Params (float type, can pass any number of values) Values of which arithmetic mean value should be computed.
Return (float type) The arithmetic mean value.
Example print( mean(1.0, 2.5, 4.0) ); // 2.5
Function van(...)
Fearure Computes the value of the variance ( denominator : N ).
Signature float van( ... float )
Params (float type, can pass any number of values) Values of which value of the variable should be computed.
Return (float type) The value of the variance ( denominator : N ).
Example print( van(1.0, 2.5, 4.0) ); // 1.5
Function van1(...)
Fearure Computes the value of the variance ( denominator : N-1 ).
Signature float van( ... float )
Params (float type, can pass any number of values) Values of which value of the variable should be computed.
Return (float type) The value of the variance ( denominator : N-1 ).
Example print( van1(1.0, 2.5, 4.0) ); // 2.25
Function sdn(...)
Feature Computes the value of the standard-deviation ( denominator : N ).
Signature float sdn( ... float )
Params (float type, can pass any number of values) Values of which value of the standard-deviation should be computed.
Return (float type) The value of the standard-deviation ( denominator : N ).
Example print( sdn(1.0, 2.5, 4.0) ); // 1.2247... (1.5)
Function sdn1(...)
Feature Computes the value of the standard-deviation ( denominator : N-1 ).
Signature float sdn1( ... float )
Params (float type, can pass any number of values) Values of which value of the standard-deviation should be computed.
Return (float type) The value of the standard-deviation ( denominator : N-1 ).
Example print( sdn1(1.0, 2.5, 4.0) ); // 1.5 (=2.25)

Japanese English
Index
News

The Internal Architecture of Exevalator
2022/05/04 - Explaining the internal architecture of Exevalator, which is an open-source expression calculator library we released last month.

Released "Exevalator": A Multilingual & Copyright-Free Expression Evaluator Library
2022/04/16 - We have released a new library "Exevalator" which enables you to calculate values of numerical expressions stored in string variables, on Java/C#/C++/Rust programs.

Announcement (Twitter)