next up previous contents
Next: Base Constants Up: Mathematical Functions Previous: MOD Modulus Operation   Contents

Subsections

SQRT Square Root of an Array

Usage

Computes the square root of the argument matrix. The general syntax for its use is

   y = sqrt(x)

where x is an N-dimensional numerical array.

Example

Here are some examples of using sqrt

--> sqrt(9)
ans = 
  <double>  - size: [1 1]
    3.000000000000000      
--> sqrt(i)
ans = 
  <complex>  - size: [1 1]
    0.70710677        0.70710677    i  
--> sqrt(-1)
ans = 
  <dcomplex>  - size: [1 1]
    6.12303176911189e-17     1.000000000000000    i  
--> x = rand(4)
x = 
  <double>  - size: [4 4]
 
Columns 1 to 2
    0.814723686393179         0.632359246225410      
    0.905791937075619         0.0975404049994095     
    0.126986816293506         0.278498218867048      
    0.913375856139019         0.546881519204984      
 
Columns 3 to 4
    0.957506835434298         0.957166948242946      
    0.964888535199277         0.485375648722841      
    0.157613081677548         0.800280468888800      
    0.970592781760616         0.141886338627215      
--> sqrt(x)
ans = 
  <double>  - size: [4 4]
 
Columns 1 to 2
    0.902620455337225         0.795210189965779      
    0.951731021389772         0.312314592997845      
    0.356352095957784         0.527729304536946      
    0.955706992827310         0.739514380661380      
 
Columns 3 to 4
    0.978522782276579         0.978349093239701      
    0.982287399491247         0.696689061721828      
    0.397005140618542         0.894583964135732      
    0.985186673560202         0.376678030454678


Samit K. Basu 2005-03-16