::class math public subclass string

OO wrapper for the mathematical functions in the rxMath package
with methods renamed to their more commonly used names. Precision
of the results is the precision used by the invoker of the methods.

Requires

'rxmath' LIBRARY
Definition at line 6 of math.cls

Public Class Methods

Pi pi ()
Yields the value of PI

Public Methods

aNum - self's arccosine value in the unit specified by type acos (type='D')
Gives the arccosine, where the result is in degrees(D), radians(R) or grades(G)
aNum - self's arcsine value in the unit specified by type asin (type='D')
Yields the arcsine, where the result is in degrees(D), radians(R) or grades(G)
aNum - self's arctangent value in the unit specified by type atan (type='D')
Returns the arctangent, where the result is in degrees(D), radians(R) or grades(G)
aNum - the cosine value cos (type='D')
Result is the cosine, where self's angle is in degrees(D), radians(R) or grades(G)
aNum - self's hyperbolic cosine value cosh ()
Returns the hyperbolic cosine
aNum - the cotangent value cotan (type='D')
Returns the cotangent, where self's angle is in degrees(D), radians(R) or grades(G):
aNum - representing e**(self) exp ()
Returns the exponential function (e**x)
aNum - angle in Radians fromDegrees ()
Turns Degrees into Radians
aNum - angle in Degrees fromRadians ()
Turns Radians into Degrees
  init (precision=(.context~digits))
Init is called from .math~new.
aNum - self's natural logarithm log ()
Retrieves a number's natural logarithm (inverse of exp)
aNum - self's base10 logarithm log10 ()
Returns the base 10 logarithm
Pi pi ()
Gives the value of Pi
aNum - self raised to the power specified as argument power (power)
Calculates a number raised to a specified power
aNum - the sine value sin (type='D')
Determines the sine, where self's angle is in degrees(D), radians(R) or grades(G)
aNum - self's hyperbolic sine value sinh ()
Finds the hyperbolic sine
aNum - being self's square root sqrt ()
Calculates this objects square root
aNum - the tangent value tan (type='D')
Returns the tangent, where self's angle is in degrees(D), radians(R) or grades(G):
aNum - self's hyperbolic tangent tanh ()
Calculates the hyperbolic tangent
aNum - angle in Degrees toDegrees ()
Turns Radians into Degrees
aNum - angle in Radians toRadians ()
Turns Degrees into Radians

Public Attributes

  precision
The precision of the arguments and results

Feature Detail

::attribute precision
The precision of the arguments and results
Default is the NUMERIC DIGITS default
Maximum is rxmath's maximum: 16

Definition at line 14 of math.cls
Dynamically referenced by
math.cls line 32 "self~precision = precision"
math.cls line 35 "self~precision = .context~digits"
math.cls line 42 "numeric digits self~precision"
math.cls line 49 "numeric digits self~precision"
math.cls line 56 "numeric digits self~precision"
math.cls line 63 "numeric digits self~precision"
math.cls line 70 "return RxCalcPi(self~precision)"
math.cls line 76 "return RxCalcPi(self~precision)"
math.cls line 82 "return RxCalcSqrt(self,self~precision)"
math.cls line 88 "return RxCalcExp(self,self~precision)"
math.cls line 96 "return RxCalcPower(self,power,self~precision)"
math.cls line 102 "return RxCalcLog(self,self~precision)"
math.cls line 108 "return RxCalcLog10(self,self~precision)"
math.cls line 116 "return RxCalcSin(self,self~precision,type)"
math.cls line 124 "return RxCalcCos(self,self~precision,type)"
math.cls line 132 "return RxCalcTan(self,self~precision,type)"
math.cls line 140 "return RxCalcCotan(self,self~precision,type)"
math.cls line 146 "return RxCalcSinH(self,self~precision)"
math.cls line 152 "return RxCalcCosH(self,self~precision)"
math.cls line 158 "return RxCalcTanH(self,self~precision)"
math.cls line 166 "return RxCalcArcSin(self,self~precision,type)"
math.cls line 174 "return RxCalcArcCos(self,self~precision,type)"
math.cls line 182 "return RxCalcArcTan(self,self~precision,type)"

::method init
Init is called from .math~new.
Since .math is a subclass of .string a peculiar thing happens in that the
first argument to ~new is not passed to ~init. That's why only the second
argument ( the precision in digits of arguments and results ) is parsed.
Following is an example of how to create a new .math instance:
Parameters
precision=(.context~digits) - where the default is taken from .context
Example
.math~new(114.2334,16) which results in a invocation of ~init as above:
Definition at line 24 of math.cls

::method toRadians
Turns Degrees into Radians
Returns
aNum - angle in Radians
Example
aRad = .math~new(30)~toRadians
Definition at line 41 of math.cls

::method fromDegrees
Turns Degrees into Radians
Returns
aNum - angle in Radians
Example
radians = .math~new(30)~fromDegrees
Definition at line 48 of math.cls

::method toDegrees
Turns Radians into Degrees
Returns
aNum - angle in Degrees
Example
degrees = .math~new(3.5467)~toDegrees
Definition at line 55 of math.cls

::method fromRadians
Turns Radians into Degrees
Returns
aNum - angle in Degrees
Example
degrees = .math~new(3.5467)~fromRadians
Definition at line 62 of math.cls

::method pi class
Yields the value of PI
Returns
Pi
Example
PI = .math~pi
Definition at line 69 of math.cls
Dynamically referenced by
math.cls line 43 "return self*self~pi/180"
math.cls line 50 "return self*self~pi/180"
math.cls line 57 "return self*180/self~pi"
math.cls line 64 "return self*180/self~pi"

::method pi
Gives the value of Pi
Returns
Pi
Example
angle = .math~new(30); PI = angle~pi
Definition at line 75 of math.cls

::method sqrt
Calculates this objects square root
Returns
aNum - being self's square root
Example
number = .math~new(16); root = number~sqrt
Definition at line 81 of math.cls

::method exp
Returns the exponential function (e**x)
Returns
aNum - representing e**(self)
Example
x=.math~new(somenumber); etopowerx = x~exp
Definition at line 87 of math.cls

::method power
Calculates a number raised to a specified power
Parameters
power - the power to which self will be raised
Returns
aNum - self raised to the power specified as argument
Example
n = .math~new(aNumber); powered = n~power(6.5)
Definition at line 94 of math.cls

::method log
Retrieves a number's natural logarithm (inverse of exp)
Returns
aNum - self's natural logarithm
Example
result = .math~new(aNumber)~log
Definition at line 101 of math.cls

::method log10
Returns the base 10 logarithm
Returns
aNum - self's base10 logarithm
Example
result = .math~new(4.6765434)~log10
Definition at line 107 of math.cls

::method sin
Determines the sine, where self's angle is in degrees(D), radians(R) or grades(G)
Parameters
type='D' - type of self's angle unit (D, R or G), D is default
Returns
aNum - the sine value
Example
aSin = .math~new(45)~sin('D')
Definition at line 114 of math.cls

::method cos
Result is the cosine, where self's angle is in degrees(D), radians(R) or grades(G)
Parameters
type='D' - type of self's angle unit (D, R or G), D is default
Returns
aNum - the cosine value
Example
aCos = .math~new(1)~cos('R')
Definition at line 122 of math.cls

::method tan
Returns the tangent, where self's angle is in degrees(D), radians(R) or grades(G):
Parameters
type='D' - type of self's angle unit (D, R or G), D is default
Returns
aNum - the tangent value
Example
aTan = .math~new(50)~tan('G')
Definition at line 130 of math.cls

::method cotan
Returns the cotangent, where self's angle is in degrees(D), radians(R) or grades(G):
Parameters
type='D' - type of self's angle unit (D, R or G), D is default
Returns
aNum - the cotangent value
Example
aCotan = .math~new(50)~cotan
Definition at line 138 of math.cls

::method sinh
Finds the hyperbolic sine
Returns
aNum - self's hyperbolic sine value
Example
aSinh = .math~new(aNumber)~sinh
Definition at line 145 of math.cls

::method cosh
Returns the hyperbolic cosine
Returns
aNum - self's hyperbolic cosine value
Example
aCosh = .math~new(aNumber)~cosh
Definition at line 151 of math.cls

::method tanh
Calculates the hyperbolic tangent
Returns
aNum - self's hyperbolic tangent
Example
aTanh = .math~new(aNumber)~tanh
Definition at line 157 of math.cls

::method asin
Yields the arcsine, where the result is in degrees(D), radians(R) or grades(G)
Parameters
type='D' - result's unit (D, R or G), D is default
Returns
aNum - self's arcsine value in the unit specified by type
Example
aRad = .math~new(57.2)~asin('R')
Definition at line 164 of math.cls

::method acos
Gives the arccosine, where the result is in degrees(D), radians(R) or grades(G)
Parameters
type='D' - result's unit (D, R or G), D is default
Returns
aNum - self's arccosine value in the unit specified by type
Example
aDeg = .math~new(aNumber)~acos
Definition at line 172 of math.cls

::method atan
Returns the arctangent, where the result is in degrees(D), radians(R) or grades(G)
Parameters
type='D' - result's unit (D, R or G), D is default
Returns
aNum - self's arctangent value in the unit specified by type
Example
aGrade = .math~new(90)~atan('G')
Definition at line 180 of math.cls

Get RexxLiterate at SourceForge.net. Fast, secure and Free Open Source software downloads
Generated on 22 Sep 2013 21:20:34 for OO_RexxMath by rexxliterate  0.0.1