SciLib.Math
Class Num

java.lang.Object
  extended by SciLib.Math.Num

public final class Num
extends java.lang.Object

This class contains some methods to construct numerical data.


Constructor Summary
Num()
           
 
Method Summary
static vector cos(vector v)
          Compute cos(x) for all elements x in the vector v
static vector cuberoot(vector y)
          Compute cuberoot(x) for all elements x in the vector y
static vector decibel(vector x)
          Compute decibel(x) for all elements x in the vector v.
static vector diric(vector x, int n)
          Compute Dirichlet(x,n) for all elements in the vector x
static vector exp(vector v)
          Compute exp(x) for all elements x in the vector v
static integerVector factor(int n)
          Generate a vector of prime factors of n.
static vector gaussian(int n)
          Make a vector of length n with the normally distributed double values.
static vector imp(int pos, int length)
          Make an impulse signal of length "length" at position "pos"
static vector log(vector v)
          Compute log(x) for all elements x in the vector v
static vector log10(vector v)
          Compute log10(x) for all elements x in the vector v
static vector log2(vector v)
          Compute log2(x) for all elements x in the vector v
static vector polynomial(double[] coef, double[] x)
          Make a vector that contains all values of a polynomial at all points in the array x
static vector polynomial(vector coef, vector x)
          Make a vector that contains all values of a polynomial at all points in the vector x
static integerVector primes(int n)
          Generate a vector of prime numbers less than or equal to n.
static vector rect(int from, int to, int length)
          Make a rectangle signal.
static vector sigmoid(vector y)
          Compute sigmoid(x) for all elements x in the vector y
static vector sigmoid2(vector y)
          Compute sigmoid2(x) for all elements x in the vector y
static vector sin(vector v)
          Compute sin(x) for all elements x in the vector v
static vector sinc(vector x)
          Compute sinc(x) for all elements in the vector x
static vector sineWave(double freq, int n, int length)
          Make a sinewave that has fundamental frequency "freq" by a combination of n sinus functions
static vector sineWave(double freq, int n, vector t)
          Make a sinewave that has fundamental frequency "freq" by a combination of n sinus functions
static vector uniform(int n)
          Make a vector of length n with the uniform distributed double values between 0 1nd 1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Num

public Num()
Method Detail

cos

public static vector cos(vector v)
Compute cos(x) for all elements x in the vector v

Parameters:
v - A vector
Returns:
A vector

decibel

public static vector decibel(vector x)
Compute decibel(x) for all elements x in the vector v.

Parameters:
x - A vector
Returns:
A vector

diric

public static vector diric(vector x,
                           int n)
Compute Dirichlet(x,n) for all elements in the vector x

Parameters:
x - A vector
n - An integer
Returns:
A vector

exp

public static vector exp(vector v)
Compute exp(x) for all elements x in the vector v

Parameters:
v - A vector
Returns:
A vector

gaussian

public static vector gaussian(int n)
Make a vector of length n with the normally distributed double values.

Parameters:
n - An integer
Returns:
A vector

imp

public static vector imp(int pos,
                         int length)
Make an impulse signal of length "length" at position "pos"

Parameters:
pos - The impulse position
length - The length of the signal
Returns:
A vector

log

public static vector log(vector v)
Compute log(x) for all elements x in the vector v

Parameters:
v - A vector
Returns:
A vector

log10

public static vector log10(vector v)
Compute log10(x) for all elements x in the vector v

Parameters:
v - A vector
Returns:
A vector

log2

public static vector log2(vector v)
Compute log2(x) for all elements x in the vector v

Parameters:
v - A vector
Returns:
A vector

polynomial

public static vector polynomial(double[] coef,
                                double[] x)
Make a vector that contains all values of a polynomial at all points in the array x

Parameters:
coef - The array that contains all coefficients of the polynomial
x - An array
Returns:
A vector

polynomial

public static vector polynomial(vector coef,
                                vector x)
Make a vector that contains all values of a polynomial at all points in the vector x

Parameters:
coef - The vector that contains all coefficients of the polynomial
x - A vector
Returns:
A double value

rect

public static vector rect(int from,
                          int to,
                          int length)
Make a rectangle signal.

Parameters:
from - From index
to - To index
length - The length of the signal
Returns:
A vector

sin

public static vector sin(vector v)
Compute sin(x) for all elements x in the vector v

Parameters:
v - A vector
Returns:
A vector

sinc

public static vector sinc(vector x)
Compute sinc(x) for all elements in the vector x

Parameters:
x - A vector
Returns:
A vector

sineWave

public static vector sineWave(double freq,
                              int n,
                              int length)
Make a sinewave that has fundamental frequency "freq" by a combination of n sinus functions

Parameters:
freq - The fundamental frequency
n - The number of harmonic components
length - The length of the signal vector
Returns:
A vector

sineWave

public static vector sineWave(double freq,
                              int n,
                              vector t)
Make a sinewave that has fundamental frequency "freq" by a combination of n sinus functions

Parameters:
freq - The fundamental frequency
n - The number of harmonic components
t - The time vector
Returns:
A vector

uniform

public static vector uniform(int n)
Make a vector of length n with the uniform distributed double values between 0 1nd 1.

Parameters:
n - An integer
Returns:
A vector

primes

public static integerVector primes(int n)
Generate a vector of prime numbers less than or equal to n.

Parameters:
n - An integer
Returns:
An integerVector

factor

public static integerVector factor(int n)
Generate a vector of prime factors of n.

Parameters:
n - An integer
Returns:
An integerVector

sigmoid

public static vector sigmoid(vector y)
Compute sigmoid(x) for all elements x in the vector y

Parameters:
y - A vector
Returns:
A vector

sigmoid2

public static vector sigmoid2(vector y)
Compute sigmoid2(x) for all elements x in the vector y

Parameters:
y - A vector
Returns:
A vector

cuberoot

public static vector cuberoot(vector y)
Compute cuberoot(x) for all elements x in the vector y

Parameters:
y - A vector
Returns:
A vector