rgp (version 0.4-1)

safeDivide: Some simple arithmetic and logic functions for use in GP expressions

Description

safeDivide a division operator that returns 0 if the divisor is 0. safeLn a natural logarithm operator that return 0 if its argument is less then 0. ln is the natural logarithm. positive returns true if its argument is greater then 0. ifPositive returns its second argument if its first argument is positive, otherwise its third argument. ifThenElse returns its second argument if its first argument is TRUE, otherwise its third argument.

Usage

safeDivide(a, b)
safeSqroot(a)
safeLn(a)
ln(a)
positive(x)
ifPositive(x, thenbranch, elsebranch)
ifThenElse(x, thenbranch, elsebranch)

Arguments

a
A numeric value.
b
A numeric value.
x
A numeric value.
thenbranch
The element to return when x is TRUE.
elsebranch
The element to return when x is FALSE.