METSIM MATHEMATICAL FUNCTIONS
THE FOLLOWING ARE MATH FUNCTIONS FOR USE IN APL EXPRESSIONS AND FUNCTIONS
Air and Water
Td FAHM Tw ; Returns the absolute humidity from the dry bulb Td and wet bulb Tw.
Td FVPA Tw ; Returns the vapor pressure of water in air at dry bulb Td and wet
bulb Tw. .
FVPR Tc ; Returns the vapor pressure (kPa) of water at temperature Tc
(Celsius).
Date and Time
FDAT 1 ; Returns the current date.
FDAT 2 ; Returns the current date and time.
FDAY date ; Returns 5 values, the date, negative days since 1900, year, month,
day.
FDAY -day ; Returns 5 values, the date, negative days since 1900, year, month,
day.
FDAY ymd ; Returns 5 values, the date, negative days since 1900, year, month,
day.
R = date -day ymd (year month day)
e.g. 20030101 -37621 2003 1 1
Financial
r FNPV nv ; Returns net present value of cash flow vector nv at rate r.
FROR nv ; Returns the rate of return for the cash flow vector nv.
Numeric Matrices
FCOL nv ; Returns a numeric matrix with vector nv in the first column.
ns FINT nm ; Returns the interpolated values for ns from matrix nm.
xy FIN2 nm ; Returns the two-way interpolated value from matrix nm.
nv FMCL nm ; Returns the product of nv times the columns in matrix nm.
nv FMRW nm ; Returns the product of nv times the rows in matrix nm.
ns FSRT nm ; Returns the matrix nm sorted along column ns.
FTDA nv ; Returns a numeric matrix with vector nv in the first row.
FWPA nm ; Returns a numeric matrix with each row the weight fractions of that
row.
C FFOR nm ; Formats numeric matrix with column width C with maximum decimals.
C FFO2 nm ; Formats numeric matrix with column width C with integers.
FFIL nm ; Fills matrix M replacing 0's with interpolated values.
Numeric Vectors
FAVE nv ; Returns the average value of vector nv.
nv FDEF dv ; Returns vector nv with the zero values replaced by defaults from
vector dv. .
FDIF nv ; Returns a vector of the differences between values of vector nv.
FDLD nv ; Returns a vector nv without and duplicate numbers.
ns FIND nv ; Returns the locations of ns in vector nv.
FNEG nv ; Returns the negative values from vector nv.
FNST nv ; Returns the sorted vector of nv.
FNZR nv ; Returns the non zero values of nv.
FPOS nv ; Returns the positive values in nv.
ns FRNA nv ; Returns the ns point running average of vector nv.
FRND nv ; Returns the rounded off vector nv.
FSTD nv ; Returns the standard deviation of vector nv.
FWPC nv ; Returns the weight fraction of vector nv.
FRNG nv ; Returns the range, minimum and maximum vales of vector nv.
Programming
FZDV ns ; Returns a value ns or 1 if ns equals 0. Prevents zero divide
errors.
Temperature
FCEN Tf ; Returns the Celsius equivalent of Fahrenheit Tf.
FFAR Tc ; Returns the Fahrenheit equivalent of Celsius Tc.
FLDT t,t ; Returns the log mean dela temperature.
Text Matrices
FAST tm ; Returns the text matrix tm sorted alphabetically.
ts FFND tm ; Returns the location (rows) of text string ts in text matrix tm.
FDAB T ; Deletes all blanks from text T.
FDEB T ; Deletes extraneous blanks from text T.
FDLB T ; Deletes leading blanks from text T.
FDTB T ; Deletes trailing blanks from text T.
FALL T ; Alligns text matrix T to the left.
FALR T ; Allings text matrix T to the right.
Trigonometry
FCOS A ; Returns the cosine of angle A (degrees).
FSIN A ; Returns the sine of angle A (degrees).
FTAN A ; Returns the tangent of angle A (degrees).
FCAR D ; Returns area of circle of diameter D.
Stream
S FMUL ns ; Multiplies stream S by the factor ns.
FSHC S ; Calculates the stream heat content after a change in temperature.
FTEM S ; Calculates the stream temperature after a change in heat content.
FSSE S,F,s; Sets the value of stream S equal to F times the value of stream s.
FZER S ; Sets all numeric values of stream S equal to zero.
FZERO S ; Sets all numeric values of stream S equal to zero
and all labels to blanks.
A FSUB B ; Subtracts stream B from stream A, A=A-B.
S FADD F ; Adds streams, stream S equals sum of all streams F.
Miscellaneous
FTHP ; Returns total HP from all unit operations.
FTKW ; Returns total KW from all unit operations.
FUCM ; Insert *'s in component names of usused components.
1 FLNG LAT ; Plots the daily solar energy in Langleys at latitude L.
FPCP X ; Converts vector of weights retained to vector of fraction passing.
FPCR X ; Converts vector of fraction passing to vector of weights retained.
X FPOL C ; Solves polynomial equation with coefficients C and X to the powers 0
1,etc.
N FPOLY XY ; Fits a polynomial equation to data XY, with N coefficients.