Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

AMP/UserGuide/AMF/Core Library

< AMP‎ | UserGuide‎ | AMF
Revision as of 03:55, 15 October 2009 by Milesparker.gmail.com (Talk | contribs) (Table)

Core Function Libraries

The following functions are available by default within any AMF model. AMF maps functions from Java static methods to any function, and we make use of common Java APId for this. The numeric operators use Math.java and their descriptions are from the Javadoc, Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy. We need to add descriptions for most of the other functions and we'll have more functions available with Acore.

Name Usage Description
Operators
Logical Operators
Not  !X
Equal X==Y
Identical X==Y
Greater X>Y
Lesser X<Y
Greater or Equal X>=Y
Lesser or Equal X<=Y
True true
False false
Identity X
Different X!=Y
Numeric Operators
Negative Value -X
Add X+Y
Subtract X-Y
Multiply X*Y
Divide X/Y
Power X^Y
Modulo X%Y
Increment ++X Incremented numeric value by 1 unit. Not transformative of initial value like C!
Decrement --X Decrement numeric value by 1 unit.
Unit Value 1 The value of one common unit, e.g. 1.
Zero Value 0 The value of no units, e.g. zero.
Original Value o The original value, e.g. the value for the value client at time 0.
Spatial
Nearest (#)
Toward (#)
Within (#)
Neighbor (#)
Include Self (#)
Within 2D Boundary (#)
Here (#)
Available (#)
Distance double = distance()
Away (#)
Minimize (#)
Maximize (#)
Location 2D (#)
Boundary 2D double = boundary2D()
Random
Random In Range double = randomInRange(double,double)
Random To Limit double = randomToLimit(double)
Random Unit double = randomUnit()
Random Boolean (#)
Random Weighted int = randomWeighted(double[]) An indexed value weighted against a probability distribution. The total probability must sum to 1.0. For example, an input of {.1,.2,.7} under a unifrom distribution would would have 10% probability of producing "0" , 20% for "1" and 70% for "2".
Random Member [Undefined] = randomMember(double[])
Random State boolean = randomState([Undefined])
Graphic
Shape Oval shapeOval() Draw a generic oval.
Shape Rectangle shapeRectangle()
Shape Marker shapeMarker()
Graphic Outline graphicOutline()
Graphic Fill graphicFill()
Shape Inset shapeInset(int)
Color RGB colorRGB(doubledoubledouble)
Color Red colorRed()
Color Yellow colorYellow()
Color Blue colorBlue()
Color Orange colorOrange()
Color Green colorGreen()
Color Purple colorPurple()
Color Black colorBlack()
Color White colorWhite()
Color Gray colorGray()
Time
Now int = timeNow()
Math
Sine double = sin(double) The trigonometric sine of an angle. Special cases:
 If the argument is NaN or an infinity, then the result is NaN.
 If the argument is zero, then the result is a zero with thesame sign as the argument.The computed result must be within 1 ulp of the exact result.Results must be semi-monotonic.param   a   an angle, in radians.return  the sine of the argument.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Cosine double = cos(double) The trigonometric cosine of an angle. Special cases:
 If the argument is NaN or an infinity, then the result is NaN.The computed result must be within 1 ulp of the exact result.Results must be semi-monotonic.param   a   an angle, in radians.return  the cosine of the argument.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Tangent double = tan(double) The trigonometric tangent of an angle. Special cases:
 If the argument is NaN or an infinity, then the result is NaN.
 If the argument is zero, then the result is a zero with thesame sign as the argument.The computed result must be within 1 ulp of the exact result.Results must be semi-monotonic.param   a   an angle, in radians.return  the tangent of the argument.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Arc Sine double = asin(double) The arc sine of an angle, in the range of -pi/2 throughpi/2. Special cases:
 If the argument is NaN or its absolute value is greater than 1, then the result is NaN.
 If the argument is zero, then the result is a zero with thesame sign as the argument.The computed result must be within 1 ulp of the exact result.Results must be semi-monotonic.param   a   the value whose arc sine is to be returned.return  the arc sine of the argument.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Arc Cosine double = acos(double) The arc cosine of an angle, in the range of 0.0 throughpi. Special case:
 If the argument is NaN or its absolute value is greater than 1, then the result is NaN.The computed result must be within 1 ulp of the exact result.Results must be semi-monotonic.param   a   the value whose arc cosine is to be returned.return  the arc cosine of the argument.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Arc Tangent double = atan(double) The arc tangent of an angle, in the range of -pi/2through pi/2. Special cases:
 If the argument is NaN, then the result is NaN.
 If the argument is zero, then the result is a zero with thesame sign as the argument.The computed result must be within 1 ulp of the exact result.Results must be semi-monotonic.param   a   the value whose arc tangent is to be returned.return  the arc tangent of the argument.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Convert Degree to Radians double = toRadians(double) Converts an angle measured in degrees to an approximatelyequivalent angle measured in radians. The conversion fromdegrees to radians is generally inexact.param angdeg an angle, in degreesreturn the measurement of the angle angdeg in radians.since 1.2

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Convert Radians to Degrees double = toDegrees(double) Converts an angle measured in radians to an approximatelyequivalent angle measured in degrees. The conversion fromradians to degrees is generally inexact; users shouldnot expect cos(toRadians(90.0)) to exactlyequal 0.0.param angrad an angle, in radiansreturn the measurement of the angle angrad in degrees.since 1.2

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Exp double = exp(double) Returns Euler's number e raised to the power of adouble value. Special cases:
 If the argument is NaN, the result is NaN.
 If the argument is positive infinity, then the result is positive infinity.
 If the argument is negative infinity, then the result is positive zero.The computed result must be within 1 ulp of the exact result.Results must be semi-monotonic.param   a   the exponent to raise e to.return  the value e^a^,          where e is the base of the natural logarithms.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Log double = log(double) The natural logarithm (base e) of a doublevalue. Special cases:
 If the argument is NaN or less than zero, then the result is NaN.
 If the argument is positive infinity, then the result is positive infinity.
 If the argument is positive zero or negative zero, then the result is negative infinity.The computed result must be within 1 ulp of the exact result.Results must be semi-monotonic.param   a   a valuereturn  the value ln a, the natural logarithm of         a.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Log b10 double = log10(double) The base 10 logarithm of a double value.Special cases:
 If the argument is NaN or less than zero, then the result is NaN.
 If the argument is positive infinity, then the result is positive infinity.
 If the argument is positive zero or negative zero, then the result is negative infinity.
 If the argument is equal to 10^n^ forinteger n, then the result is n.The computed result must be within 1 ulp of the exact result.Results must be semi-monotonic.param   a   a valuereturn  the base 10 logarithm of  a.since 1.5

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Square Root double = squareRoot(double) The correctly rounded positive square root of a double value.Special cases:
 If the argument is NaN or less than zero, then the result is NaN. 
 If the argument is positive infinity, then the result is positive infinity. 
 If the argument is positive zero or negative zero, then the result is the same as the argument.Otherwise, the result is the double value closest to the true mathematical square root of the argument value.param   a   a value.return  the positive square root of a.        If the argument is NaN or less than zero, the result is NaN.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Cube Root double = cbrt(double) The cube root of a double value. Forpositive finite x, cbrt(-x) ==-cbrt(x); that is, the cube root of a negative value isthe negative of the cube root of that value's magnitude.Special cases:
 If the argument is NaN, then the result is NaN.
 If the argument is infinite, then the result is an infinitywith the same sign as the argument.
 If the argument is zero, then the result is a zero with thesame sign as the argument.The computed result must be within 1 ulp of the exact result.param   a   a value.return  the cube root of a.since 1.5

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Remainder double = iEEEremainder(double,double) Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.The remainder value is mathematically equal to f1 - f2 × n,where n is the mathematical integer closest to the exact mathematical value of the quotient f1/f2, and if two mathematical integers are equally close to f1/f2, then n is the integer that is even. If the remainder is zero, its sign is the same as the sign of the first argument. Special cases:
 If either argument is NaN, or the first argument is infinite, or the second argument is positive zero or negative zero, then the result is NaN.
 If the first argument is finite and the second argument is infinite, then the result is the same as the first argument.param   f1   the dividend.param   f2   the divisor.return  the remainder when f1 is divided by         f2.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Ceiling double = ceil(double) The smallest (closest to negative infinity)double value that is greater than or equal to theargument and is equal to a mathematical integer. Special cases:
 If the argument value is already equal to amathematical integer, then the result is the same as theargument. 
 If the argument is NaN or an infinity orpositive zero or negative zero, then the result is the same asthe argument. 
 If the argument value is less than zero butgreater than -1.0, then the result is negative zero. Notethat the value of Math.ceil(x) is exactly thevalue of -Math.floor(-x).param   a   a value.return  the smallest (closest to negative infinity)          floating-point value that is greater than or equal to          the argument and is equal to a mathematical integer. 

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Floor double = floor(double) The largest (closest to positive infinity)double value that is less than or equal to theargument and is equal to a mathematical integer. Special cases:
 If the argument value is already equal to amathematical integer, then the result is the same as theargument. 
 If the argument is NaN or an infinity orpositive zero or negative zero, then the result is the same asthe argument.param   a   a value.return  the largest (closest to positive infinity)          floating-point value that less than or equal to the argument         and is equal to a mathematical integer. 

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Rount double = rint(double) The double value that is closest in valueto the argument and is equal to a mathematical integer. If twodouble values that are mathematical integers areequally close, the result is the integer value that iseven. Special cases:
 If the argument value is already equal to a mathematical integer, then the result is the same as the argument. 
 If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.param   a   a double value.return  the closest floating-point value to a that is         equal to a mathematical integer.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Arc Tangent Rectangular double = atan2(double,double) Converts rectangular coordinates (x, y)to polar (r, theta).This method computes the phase theta by computing an arc tangentof y/x in the range of -pi to pi. Special cases:
 If either argument is NaN, then the result is NaN. 
 If the first argument is positive zero and the second argument is positive, or the first argument is positive and finite and the second argument is positive infinity, then the result is positive zero. 
 If the first argument is negative zero and the second argument is positive, or the first argument is negative and finite and the second argument is positive infinity, then the result is negative zero. 
 If the first argument is positive zero and the second argument is negative, or the first argument is positive and finite and the second argument is negative infinity, then the result is the double value closest to pi. 
 If the first argument is negative zero and the second argument is negative, or the first argument is negative and finite and the second argument is negative infinity, then the result is the double value closest to -pi. 
 If the first argument is positive and the second argument is positive zero or negative zero, or the first argument is positive infinity and the second argument is finite, then the result is the double value closest to pi/2. 
 If the first argument is negative and the second argument is positive zero or negative zero, or the first argument is negative infinity and the second argument is finite, then the result is the double value closest to -pi/2. 
 If both arguments are positive infinity, then the result is the double value closest to pi/4. 
 If the first argument is positive infinity and the second argument is negative infinity, then the result is the double value closest to 3*pi/4. 
 If the first argument is negative infinity and the second argument is positive infinity, then the result is the double value closest to -pi/4. 
 If both arguments are negative infinity, then the result is the double value closest to -3*pi/4.The computed result must be within 2 ulps of the exact result.Results must be semi-monotonic.param   y   the ordinate coordinateparam   x   the abscissa coordinatereturn  the theta component of the point         (r, theta)         in polar coordinates that corresponds to the point         (x, y) in Cartesian coordinates.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Power double = pow(double,double) The value of the first argument raised to the power of thesecond argument. Special cases:
 If the second argument is positive or negative zero, then the result is 1.0. 
 If the second argument is 1.0, then the result is the same as the first argument.
 If the second argument is NaN, then the result is NaN. 
 If the first argument is NaN and the second argument is nonzero, then the result is NaN. 
 If
 the absolute value of the first argument is greater than 1and the second argument is positive infinity, or
 the absolute value of the first argument is less than 1 andthe second argument is negative infinity,then the result is positive infinity. 
 If 
 the absolute value of the first argument is greater than 1 and the second argument is negative infinity, or 
 the absolute value of the first argument is less than 1 and the second argument is positive infinity,then the result is positive zero. 
 If the absolute value of the first argument equals 1 and the second argument is infinite, then the result is NaN. 
 If 
 the first argument is positive zero and the second argumentis greater than zero, or
 the first argument is positive infinity and the secondargument is less than zero,then the result is positive zero. 
 If 
 the first argument is positive zero and the second argumentis less than zero, or
 the first argument is positive infinity and the secondargument is greater than zero,then the result is positive infinity.
 If 
 the first argument is negative zero and the second argumentis greater than zero but not a finite odd integer, or
 the first argument is negative infinity and the secondargument is less than zero but not a finite odd integer,then the result is positive zero. 
 If 
 the first argument is negative zero and the second argumentis a positive finite odd integer, or
 the first argument is negative infinity and the secondargument is a negative finite odd integer,then the result is negative zero. 
 If
 the first argument is negative zero and the second argumentis less than zero but not a finite odd integer, or
 the first argument is negative infinity and the secondargument is greater than zero but not a finite odd integer,then the result is positive infinity. 
 If 
 the first argument is negative zero and the second argumentis a negative finite odd integer, or
 the first argument is negative infinity and the secondargument is a positive finite odd integer,then the result is negative infinity. 
 If the first argument is finite and less than zero
 if the second argument is a finite even integer, theresult is equal to the result of raising the absolute value ofthe first argument to the power of the second argument
 if the second argument is a finite odd integer, the resultis equal to the negative of the result of raising the absolutevalue of the first argument to the power of the secondargument
 if the second argument is finite and not an integer, thenthe result is NaN.
 If both arguments are integers, then the result is exactly equal to the mathematical result of raising the first argument to the power of the second argument if that result can in fact be represented exactly as a double value.(In the foregoing descriptions, a floating-point value isconsidered to be an integer if and only if it is finite and afixed point of the method {link #ceil ceil} or,equivalently, a fixed point of the method {link #floorfloor}. A value is a fixed point of a one-argumentmethod if and only if the result of applying the method to thevalue is equal to the value.)The computed result must be within 1 ulp of the exact result.Results must be semi-monotonic.param   a   the base.param   b   the exponent.return  the value a^b^.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Absolute Value double = abs(double) The absolute value of a double value.If the argument is not negative, the argument is returned.If the argument is negative, the negation of the argument is returned.Special cases:
 If the argument is positive zero or negative zero, the result is positive zero. 
 If the argument is infinite, the result is positive infinity. 
 If the argument is NaN, the result is NaN.In other words, the result is the same as the value of the expression: Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1) param   a   the argument whose absolute value is to be determinedreturn  the absolute value of the argument.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Maximum double = max(double,double) The greater of two double values. Thatis, the result is the argument closer to positive infinity. Ifthe arguments have the same value, the result is that samevalue. If either value is NaN, then the result is NaN. Unlikethe numerical comparison operators, this method considersnegative zero to be strictly smaller than positive zero. If oneargument is positive zero and the other negative zero, theresult is positive zero.param a an argument.param b another argument.return the larger of a and b.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Minimum double = min(double,double) The smaller of two double values. Thatis, the result is the value closer to negative infinity. If thearguments have the same value, the result is that samevalue. If either value is NaN, then the result is NaN. Unlikethe numerical comparison operators, this method considersnegative zero to be strictly smaller than positive zero. If oneargument is positive zero and the other is negative zero, theresult is negative zero.param a an argument.param b another argument.return the smaller of a and b.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

ULP double = ulp(double) The size of an ulp of the argument. An ulp of adouble value is the positive distance between this floating-point value and the double value next larger in magnitude. Note that for non-NaN x,ulp(-x) == ulp(x).Special Cases:
 If the argument is NaN, then the result is NaN.
 If the argument is positive or negative infinity, then theresult is positive infinity.
 If the argument is positive or negative zero, then the result isDouble.MIN_VALUE.
 If the argument is ±Double.MAX_VALUE, thenthe result is equal to 2^971^.param d the floating-point value whose ulp is to be returnedreturn the size of an ulp of the argumentauthor Joseph D. Darcysince 1.5

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Sign double = signum(double) The signum function of the argument; zero if the argumentis zero, 1.0 if the argument is greater than zero, -1.0 if theargument is less than zero.Special Cases:
 If the argument is NaN, then the result is NaN.
 If the argument is positive zero or negative zero, then the     result is the same as the argument.param d the floating-point value whose signum is to be returnedreturn the signum function of the argumentauthor Joseph D. Darcysince 1.5

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Hyperbolic Sine double = sinh(double) The hyperbolic sine of a double value.The hyperbolic sine of x is defined to be(e^x^ - e^-x^)/2where e is {linkplain Math#E Euler's number}.Special cases:
 If the argument is NaN, then the result is NaN.
 If the argument is infinite, then the result is an infinitywith the same sign as the argument.
 If the argument is zero, then the result is a zero with thesame sign as the argument.The computed result must be within 2.5 ulps of the exact result.param   x The number whose hyperbolic sine is to be returned.return  The hyperbolic sine of x.since 1.5

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Hyperbolic Cosine double = cosh(double) The hyperbolic cosine of a double value.The hyperbolic cosine of x is defined to be(e^x^ + e^-x^)/2where e is {linkplain Math#E Euler's number}.Special cases:
 If the argument is NaN, then the result is NaN.
 If the argument is infinite, then the result is positiveinfinity.
 If the argument is zero, then the result is 1.0.The computed result must be within 2.5 ulps of the exact result.param   x The number whose hyperbolic cosine is to be returned.return  The hyperbolic cosine of x.since 1.5

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Hyperbolic Tan double = tanh(double) The hyperbolic tangent of a double value.The hyperbolic tangent of x is defined to be(e^x^ - e^-x^)/(e^x^ + e^-x^),in other words, {linkplain Math#sinhsinh(x)}/{linkplain Math#cosh cosh(x)}. Notethat the absolute value of the exact tanh is always less than1.Special cases:
 If the argument is NaN, then the result is NaN.
 If the argument is zero, then the result is a zero with thesame sign as the argument.
 If the argument is positive infinity, then the result is+1.0.
 If the argument is negative infinity, then the result is-1.0. The computed result must be within 2.5 ulps of the exact result.The result of tanh for any finite input must havean absolute value less than or equal to 1. Note that once theexact result of tanh is within 1/2 of an ulp of the limit valueof ±1, correctly signed ±1.0 shouldbe returned.param   x The number whose hyperbolic tangent is to be returned.return  The hyperbolic tangent of x.since 1.5

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Hypotuneuse double = hypotuneuse(double,double) Returns sqrt(x^2^ +y^2^)without intermediate overflow or underflow. Special cases:
 If either argument is infinite, then the resultis positive infinity.
 If either argument is NaN and neither argument is infinite,then the result is NaN.The computed result must be within 1 ulp of the exactresult. If one parameter is held constant, the results must besemi-monotonic in the other parameter.param x a valueparam y a valuereturn sqrt(x^2^ +y^2^)without intermediate overflow or underflowsince 1.5

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Expm1 double = expm1(double) Returns e^x^ -1. Note that for values ofx near 0, the exact sum ofexpm1(x) + 1 is much closer to the trueresult of e^x^ than exp(x).Special cases:
 If the argument is NaN, the result is NaN.
 If the argument is positive infinity, then the result ispositive infinity.
 If the argument is negative infinity, then the result is-1.0.
 If the argument is zero, then the result is a zero with thesame sign as the argument.The computed result must be within 1 ulp of the exact result.Results must be semi-monotonic. The result ofexpm1 for any finite input must be greater than orequal to -1.0. Note that once the exact result ofe^x^ - 1 is within 1/2ulp of the limit value -1, -1.0 should bereturned.param   x   the exponent to raise e to in the computation of             e^x^ -1.return  the value e^x^ - 1.

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

Log1p double = log1p(double) The natural logarithm of the sum of the argument and 1.Note that for small values x, the result oflog1p(x) is much closer to the true result of ln(1+ x) than the floating-point evaluation oflog(1.0+x).Special cases:
 If the argument is NaN or less than -1, then the result isNaN.
 If the argument is positive infinity, then the result ispositive infinity.
 If the argument is negative one, then the result isnegative infinity.
 If the argument is zero, then the result is a zero with thesame sign as the argument.The computed result must be within 1 ulp of the exact result.Results must be semi-monotonic.param   x   a valuereturn the value ln(x + 1), the naturallog of x + 1

(From Math.java javadoc. Copyright 2004 Sun Microsystems, Inc. Author: Joseph D. Darcy)

List
Item [Undefined] = item([Undefined][],int)
Length int = length([Undefined][])
Distribution
Uniform Cross Distribution double = uniformCrossDistribution([Undefined],double,double)
Uniform Additive Distribution double = uniformAdditiveDistribution([Undefined],double,double)
Cross Distribution double = crossDistribution([Undefined],double)
Additive Distribution double = additiveDistribution([Undefined],double)

Back to the top