Splus function: sq()

sq()

Description

Returns the square of a number.

Usage

     sq(x)

Required arguments

x Numeric or complex (vectors are legal). Missing values are ok also.

Details

This function doesn't use "^" function. So if that has been redefined, sq() will still generate a traditional square.

Other functions it depends on

This function doesn't require any other hand-written functions. It only uses "*" so unless that is redefined, it will do the right thing.

Examples

     sq(7)
     sq(3+5i)
     sq(1:10)

Definition code

sq <- function(x) 
   {
      y <- x*x;
      return(y);
   }