Home modules.gotpike.org
Username: Password: [Create Account]
[Forgot Password?]

Modules

ADT
Database
GTK2
GUI
IP
PiJAX
Public
Sql
Stdio
Subversion
System
Tools
Xosd
lua
v4l2
wx

Recent Changes

Public.Parser.XML2 1.50
Public.ZeroMQ 1.1
Public.Template.Mustache 1.0
Public.Protocols.XMPP 1.4
Sql.Provider.jdbc 1.0

Popular Downloads

Public.Parser.JSON2 1.0
Public.Parser.JSON 0.2
GTK2 2.23
Public.Web.FCGI 1.8
Public.Parser.XML2 1.48


Pike Module Reference:

module version 6, prepared

  MODULE module
Modules
Complex
Derivatives
Fourier
Fractal
Functions
Integration
LinearAlgebra
Minimization
ODE
Roots
Statistics

  MODULE module.ODE
Methods
RungeKutta()

Method RungeKutta

array module.ODE.RungeKutta(float x0, float xmax, float y0, float h, function f)

Description

The Runge-Kutta method. Given the point (x0 , y0) / y0 = f(x0) and the step h, solves the differential equation dy / dt = f(x,y) ;

Parameter x0

The point where the integration begins

Parameter xmax

The point to finish the integration

Parameter y0

The initial condition to y.

Parameter f

The function which gives df/dt = f(x, y) ;

  MODULE module.Statistics
Methods
mean()
standarDeviation()

Method mean

float module.Statistics.mean(array serie)

Description

Computes the mean of a time series


Method standarDeviation

float module.Statistics.standarDeviation(array serie)

Description

Computes the standar deviation of a time series.

  MODULE module.LinearAlgebra
Classes
NMatrix

Methods
ColumnFromArray()

Method ColumnFromArray

object(NMatrix) module.LinearAlgebra.ColumnFromArray(array a)

Description

Returns a column Matrix from an array

  CLASS module.LinearAlgebra.NMatrix
Methods
LU()
`*()
`+()
`-()
backSubstitution()
columns()
create()
determinant()
dims()
get()
getColumn()
inverse()
mult()
productByScalar()
rows()
show()
solveLinearEquations()
sub()
sum()
swapRows()
transpose()
Description

A NMatrix object is a matrix.


Inherit Matrix

  • Math.Matrix

  • Method create

    void module.LinearAlgebra.NMatrix()->create(int|array fst, void|int snd)

    Description

    You can create a NMatrix object giving an array or two ints: the number of rows and columns.


    Method get

    float module.LinearAlgebra.NMatrix()->get(int i, int j)

    Description

    Using get you obtain the element at row i, column j of the NMatrix.


    Method dims

    array(int) module.LinearAlgebra.NMatrix()->dims()

    Description

    Returns an array ({ rows, columns })


    Method rows

    int module.LinearAlgebra.NMatrix()->rows()

    Description

    Number of rows of a NMatrix


    Method columns

    int module.LinearAlgebra.NMatrix()->columns()

    Description

    Number of columns of a NMatrix


    Method show

    void module.LinearAlgebra.NMatrix()->show()

    Description

    Shows a NMatrix on the screen.


    Method productByScalar

    object(NMatrix) module.LinearAlgebra.NMatrix()->productByScalar(int|float n)

    Description

    Multiplies a NMatrix by a scalar, multiplying all its elements by that scalar.


    Method swapRows

    object(NMatrix) module.LinearAlgebra.NMatrix()->swapRows(int i, int j)

    Description

    Returns a new NMatrix, with rows i and j swapped.


    Method mult

    object(NMatrix) module.LinearAlgebra.NMatrix()->mult(object(NMatrix) b)

    Description

    Multiplies two matrices.


    Method `*

    object(NMatrix) module.LinearAlgebra.NMatrix()->`*(object(NMatrix) a)

    Description

    a * b


    Method sub

    object(NMatrix) module.LinearAlgebra.NMatrix()->sub(object(NMatrix) b)

    Description

    a - b


    Method sum

    object(NMatrix) module.LinearAlgebra.NMatrix()->sum(object(NMatrix) b)

    Description

    a + b


    Method `+

    object(NMatrix) module.LinearAlgebra.NMatrix()->`+(object(NMatrix) b)

    Description

    a + b


    Method `-

    object(NMatrix) module.LinearAlgebra.NMatrix()->`-(object(NMatrix) b)

    Description

    a - b


    Method transpose

    object(NMatrix) module.LinearAlgebra.NMatrix()->transpose()

    Description

    Returns a new matrix, transposed of the original matrix.


    Method getColumn

    object(NMatrix) module.LinearAlgebra.NMatrix()->getColumn(int i)

    Description

    Returns a NMatrix object, with the same content of the i column of the original matrix.


    Method LU

    array module.LinearAlgebra.NMatrix()->LU()

    Description

    This does the LU decomposition of the matrix. Returns an array ({ L , U , permutation_matrix , signum })


    Method backSubstitution

    object(NMatrix) module.LinearAlgebra.NMatrix()->backSubstitution(object(NMatrix) L, object(NMatrix) U, object(NMatrix) P, object(NMatrix) w)

    Description

    Given the LU decomposition of a NMatrix, solves the linear equations system AX = w


    Method solveLinearEquations

    object(NMatrix) module.LinearAlgebra.NMatrix()->solveLinearEquations(object(NMatrix) w)

    Description

    Solves the linear equations system AX = w


    Method inverse

    object(NMatrix) module.LinearAlgebra.NMatrix()->inverse()

    Description

    Returns the inverse of the matrix.


    Method determinant

    float module.LinearAlgebra.NMatrix()->determinant()

    Description

    Returns the determinant of a matrix.

      MODULE module.Minimization
    Classes
    Simplex

    Methods
    SimpleQuestWith1stDerivatives()

    Import


    Method SimpleQuestWith1stDerivatives

    float module.Minimization.SimpleQuestWith1stDerivatives(function df, array range, int NITER, float tol_rel)

    Description

    Finds the minimum of a function using the first derivative of a function

      CLASS module.Minimization.Simplex
    Methods
    create()
    minimize()
    Description

    A simplex is a set of N + 1 points in a N dimensional space. It's one of the most beautiful methods to minimize a function of more than 1 variable.


    Method create

    void module.Minimization.Simplex()->create(function function2minimize, array points)

    Description

    To create a Simplex, we give a function to minimize and an array of points. Exemple: if we want to minimize a function of two variables, f(x,y), we must call Simplex with f(x,y) and an array of 3 elements: ({ ({x1, y1 }) , ({x2, y2}) , ({x3, y3}) })


    Method minimize

    array module.Minimization.Simplex()->minimize(int NITER, float tol_rel)

    Description

    To minimize a Simplex, we can do NITER iterations and tolerate a relative error of tol_rel.

      MODULE module.Derivatives
    Methods
    derive()
    derive2()

    Method derive

    function module.Derivatives.derive(function f, float h)

    Description

    This function returns the derivative of f calculated simply applying the definition, with step h


    Method derive2

    function module.Derivatives.derive2(function f, float h)

    Description

    This function returns the derivative of f calculated by a better algorhytm.

      MODULE module.Fourier
    Methods
    DiscreteFourierTransformation()
    InverseDiscreteFourierTransformation()
    PowerSpectrum()

    Import


    Import


    Method DiscreteFourierTransformation

    array module.Fourier.DiscreteFourierTransformation(array data, int max)

    Description

    Does the discrete fourier transformation of some data.


    Method InverseDiscreteFourierTransformation

    array module.Fourier.InverseDiscreteFourierTransformation(array data, int max)

    Description

    Does the inverse discrete fourier transformation of data.


    Method PowerSpectrum

    array module.Fourier.PowerSpectrum(array data, int max)

    Description

    Power spectrum of data. This first does a discreteFourierTransformation of data, them computes the powerSpectrum.

      MODULE module.Roots
    Methods
    Bisection()
    NewtonRaphson()
    RegulaFalsi()
    Steffensen()

    Method Bisection

    float module.Roots.Bisection(function f, array range, float error_p, int iterations)

    Description

    This function tries to find a root of f , given the interval (a,b) where you think that It's fitted.

    Parameter f

    The function that we are tryint to find a root.

    Parameter range

    The interval ({ a, b }) where we think that the root is fitted.

    Parameter error_p

    The relative error that It's allowed to the solution.

    Parameter iterations

    The maxim number of iterations that the method can do trying to find the root.


    Method NewtonRaphson

    float module.Roots.NewtonRaphson(function f, function df, float point, float error_abs, int iterations)

    Description

    This function tries to find a root of f using the Newton-Raphson method.

    Parameter f

    The function

    Parameter df

    The derivative of f

    Parameter point

    A point to start the method from x = point

    Parameter error_abs

    The absolute error that we tolerate to the solution

    Parameter iterations

    The maximum number of iterations that we can do trying to find the root.


    Method Steffensen

    float module.Roots.Steffensen(function f, float point, float error_abs, int iterations)

    Description

    This function tries to find a root of f using the Newton-Raphson method.

    Parameter f

    The function

    Parameter point

    A point to start the method from x = point

    Parameter error_abs

    The absolute error that we tolerate to the solution


    Method RegulaFalsi

    float module.Roots.RegulaFalsi(function f, array range, float error_p, int iterations)

    Description

    This function tries to find a root of f , given the interval (a,b) where you think that It's fitted. It uses the Regula-Falsi method. The paramethers have the same meaning than in Bisection.

      MODULE module.Functions
    Methods
    Weierstrass()

    Method Weierstrass

    function module.Functions.Weierstrass(float lamda, float s, void|int iterations)

    Description

    The Weierstrass function. s is the fractal dimension, lamda must be greather than one.

      MODULE module.Integration
    Methods
    SimpleMontecarlo()

    Import


    Method SimpleMontecarlo

    array module.Integration.SimpleMontecarlo(function f, array interval, int points)

    Description

    Uses a simple Montecarlo algorithm to integrate f in the interval .

    Parameter f

    The function to integrate

    Parameter interval

    The interval ({ a, b }) where we wish to do the integral.

    Parameter points

    The number of points that the montecarlo algorithm has to use.

      MODULE module.Fractal
    Methods
    BurlagaKlein()
    GenerateHiguchiData()
    GenerateLinearData()
    GenerateLogisticData()
    GeneratePowerSpectrumExponentData()
    GenerateSinusoidalData()
    GenerateWeierstrassData()
    Higuchi()
    PowerSpectrumExponent()
    SimpleFractalDimension()

    Import


    Import


    Import


    Import


    Import


    Method Higuchi

    array module.Fractal.Higuchi(array serie, int kmin, int kmax, float error_percent, void|function stepper)

    Description

    This function computes the Higuchi fractal dimension of a time serie.

    Parameter serie

    The time serie we want to analize.

    Parameter kmin

    Minimum value of the paramether we have to use to compute the fractal dimension

    Parameter kmax

    Maximum value of the paramether we have to use to compute the fractal dimension

    Parameter error_percent

    Percentual error of each point in serie

    Parameter stepper

    A function which, given a value of k, returns the next value of k to use.


    Method GenerateLinearData

    array module.Fractal.GenerateLinearData(float a, float b, int n)

    Description

    Generates n points following a linear distribucion y = a x + b ;


    Method GenerateSinusoidalData

    array module.Fractal.GenerateSinusoidalData(int n)

    Description

    Generates n points following a sinusoidal function. Only one period.


    Method GenerateLogisticData

    array module.Fractal.GenerateLogisticData(float r, float x0, int n, int transitori)

    Description

    Generates n points from the logistic map x -> r x (1-x)


    Method GenerateHiguchiData

    array module.Fractal.GenerateHiguchiData(int n)

    Description

    Generates n points from a random walk (also called Fractional Brownian Function ), with fractal dimension 1.5 .


    Method BurlagaKlein

    array module.Fractal.BurlagaKlein(array serie, int kmin, int kmax, float error_percent, void|function stepper)

    Description

    This function computes the Burlaga and Klein's fractal dimension of a time serie.

    Parameter serie

    The time serie we want to analize.

    Parameter kmin

    Minimum value of the paramether we have to use to compute the fractal dimension

    Parameter kmax

    Maximum value of the paramether we have to use to compute the fractal dimension

    Parameter error_percent

    Percentual error of each point in serie

    Parameter stepper

    A function which, given a value of k, returns the next value of k to use.


    Method SimpleFractalDimension

    array module.Fractal.SimpleFractalDimension(array serie, int kmin, int kmax, float error_percent, void|function stepper)

    Description

    This function computes the fractal dimension of a time serie simply using as the curve length abs( y1 - y2 ). Very primitive method, It's here only to compare with BK and Higuchi methods.

    Parameter serie

    The time serie we want to analize.

    Parameter kmin

    Minimum value of the paramether we have to use to compute the fractal dimension

    Parameter kmax

    Maximum value of the paramether we have to use to compute the fractal dimension

    Parameter error_percent

    Percentual error of each point in serie

    Parameter stepper

    A function which, given a value of k, returns the next value of k to use.


    Method GenerateWeierstrassData

    array module.Fractal.GenerateWeierstrassData(int n, float xmin, float xmax, float lamda, float s)

    Description

    Generates n points from the Weierstrass function. s is the fractal dimension of the graph. lamda must be greather than 1.


    Method GeneratePowerSpectrumExponentData

    array module.Fractal.GeneratePowerSpectrumExponentData(int n, float exponent, float angle_max)

    Description

    Generates points following an exponential power expectrum law, where P(k) ~ k^(-exponent). The angle is picked from a Uniform distribution between 0 and angle_max (in degree).


    Method PowerSpectrumExponent

    array module.Fractal.PowerSpectrumExponent(array serie, int kmax, float error_p)

    Description

    Tries to do a log-log adjust to get the exponent from a power spectrum which follows an exponential law.

      MODULE module.Complex
    Classes
    Complex

    Methods
    Exp()

    Variable i

    object(Complex) module.Complex.i

    Description

    The imaginary unit.


    Method Exp

    object(Complex) module.Complex.Exp(object(Complex) a)

    Description

    Exponential of a Complex number.

      CLASS module.Complex.Complex
    Methods
    `-()
    cast()
    conjugate()
    create()
    imPart()
    module()
    realPart()
    Description

    A complex number x = a + ib


    Method create

    void module.Complex.Complex()->create(float|int real, float|int imaginari)

    Description

    We can create a complex given Its real and imaginary part, or only with one argument: an array.


    Method realPart

    float|int module.Complex.Complex()->realPart()

    Description

    Returns the real part of the complex number.


    Method imPart

    float|int module.Complex.Complex()->imPart()

    Description

    Returns the imaginary part of the complex number.


    Method `-

    object(Complex) module.Complex.Complex()->`-(object(Complex) a)

    Description

    a - b


    Method cast

    string module.Complex.Complex()->cast(string what)

    Description

    We can cast a Complex number to a string in a form Real + i * Imaginary


    Method module

    float module.Complex.Complex()->module()

    Description

    Returns the module of a complex number.


    Method conjugate

    object(Complex) module.Complex.Complex()->conjugate()

    Description

    Given a + ib, returns a -ib

    gotpike.org | Copyright © 2004 - 2019 | Pike is a trademark of Department of Computer and Information Science, Linköping University