manpagez: man pages & more
info mathgl
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.20 Make another data (MGL)

MGL command: combine res adat bdat

Returns direct multiplication of arrays (like, res[i,j] = adat[i]*bdat[j] and so on).

MGL command: evaluate res dat idat [norm=on]
MGL command: evaluate res dat idat jdat [norm=on]
MGL command: evaluate res dat idat jdat kdat [norm=on]

Get array which values is result of interpolation of original array for coordinates from other arrays (for example, res[i,j]=dat[idat[i,j],jdat[i,j]]). All dimensions must be the same for data idat, jdat, kdat. Coordinates from idat, jdat, kdat are supposed to be normalized in range [0,1] (if norm=true) or in ranges [0,nx], [0,ny], [0,nz] correspondingly.

MGL command: hist res dat num v1 v2 [nsub=0]
MGL command: hist res dat wdat num v1 v2 [nsub=0]

Creates num-th points distribution res of the data values of dat in range [v1, v2]. Array wdat specifies weights of the data elements (all weight is 1 if wdat is not specified). Parameter nsub define the number of additional interpolated points (for smoothness of histogram).

MGL command: hist res xdat adat
MGL command: hist res xdat ydat adat
MGL command: hist res xdat ydat zdat adat

Creates distribution res of the data values of adat in axis range [Min, Max]. Array adat look like weights of the data points.

MGL command: momentum res dat 'how' ['dir'='z']

Get momentum (1D-array) of the data along direction dir. String how contain kind of momentum. The momentum is defined like as res_k = \sum_ij how(x_i,y_j,z_k) a_ij/ \sum_ij a_ij if var=‘z’ and so on. Coordinates ‘x’, ‘y’, ‘z’ are data indexes normalized in range [0,1].

MGL command: sum res dat 'dir'

Gets array which is the result of summation in given direction or direction(s).

MGL command: max res dat 'dir'

Gets array which is the maximal data values in given direction or direction(s).

MGL command: min res dat 'dir'

Gets array which is the minimal data values in given direction or direction(s).

MGL command: resize res dat mx [my=1 mz=1]

Makes array res of sizes mx, my, mz with interpolated data of array dat.

MGL command: subdata res dat xx [yy=: zz=:]

Extracts sub-array data res from the original data dat array keeping fixed positive index. For example subdata a b : 2 extracts 3d row (indexes are zero based), subdata a b 4 : extracts 5th column, subdata a b : : 3 extracts 4th slice and so on. Note that symbol ‘:’ is defined ‘:’=-1 in MGL.

MGL command: trace res dat

Gets array of diagonal elements dat[i,i] (for 2D case) or dat[i,i,i] (for 3D case) where i=0...nx-1. Function return copy of dat for 1D case. Data array must have dimensions dat.ny, dat.nz >= dat.nx or dat.ny, dat.nz = 1.

MGL command: transform dat 'type' real imag

Do integral transformation of complex data real, imag on specified direction. The order of transformations is specified in string type: first character for x-dimension, second one for y-dimension, third one for z-dimension. The possible character are: ‘f’ is forward Fourier transformation, ‘i’ is inverse Fourier transformation, ‘s’ is Sine transform, ‘c’ is Cosine transform, ‘h’ is Hankel transform, ‘n’ or ‘ ’ is no transformation.

MGL command: transforma dat 'type' ampl phase

The same as previous but with specified amplitude ampl and phase phase of complex numbers.

MGL command: stfad res real imag dn ['dir'='x']

Short time Fourier transformation for real and imaginary parts. Output is amplitude of partial Fourier of length dn. For example if dir=‘x’, result will have size {int(nx/dn), dn, ny} and it will contain res[i,j,k]=|\sum_d^dn exp(I*j*d)*(real[i*dn+d,k]+I*imag[i*dn+d,k])|/dn.

MGL command: pde res 'ham' ini_re ini_im [dz=0.1 k0=100]

Solves equation du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators. Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Coordinates of the equation (and the solution) are supposed to be in the bounding box. Note, that really this ranges are increased by factor 3/2 for purpose of reducing reflection from boundaries. Parameter dz set the step along evolutionary coordinate z. At this moment, simplified form of function ham is supported – all “mixed” terms (like ‘x*p’->x*d/dx) are excluded. For example, in 2D case this function is effectively ham = f(p,z) + g(x,z,u). However commutable combinations (like ‘x*q’->x*d/dy) are allowed. Here variable ‘u’ is used for field amplitude |u|. This allow one solve nonlinear problems – for example, for non-linear Shrodinger equation you may set ham='p^2+q^2-u^2'. You may specify imaginary part for wave absorption, like ham = 'p^2+i*x*(x>0)', but only if dependence on variable ‘i’ is linear (i.e. ham = hre+i*him). See section PDE sample, for sample code and picture.

MGL command: ray res 'ham' x0 y0 z0 p0 q0 v0 [dt=0.1 tmax=10]

Solves GO ray equation like dr/dt = d ham/dp, dp/dt = -d ham/dr. This is Hamiltonian equations for particle trajectory in 3D case. Here ham is Hamiltonian which may depend on coordiantes ‘x’, ‘y’, ‘z’, momentums ‘p’=px, ‘q’=py, ‘v’=pz and time ‘t’: ham = H(x,y,z,p,q,v,t). The starting point (at t=0) is defined by variables {x0, y0, z0, p0, q0, v0}. Parameters dt and tmax specify the integration step and maximal time for ray tracing. Result is array of {x,y,z,p,q,v,t} with dimensions {7 * int(tmax/dt+1) }. See also pde. See section Beam tracing sample, for sample code and picture.

MGL command: qo2d res 'ham' ini_re ini_im ray [r=1 k0=100 xx=0 yy=0]

Solves equation du/dt = i*k0*ham(p,q,x,y,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators. Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters ray set the reference ray, i.e. the ray around which the accompanied coordinate system will be maked. You may use, for example, the array created by ray function. Note, that the reference ray must be smooth enough to make accompanied coodrinates unambiguity. Otherwise errors in the solution may appear. If xx and yy are non-zero then Cartesian coordinates for each point will be written into them. See section Beam tracing sample, for sample code and picture.

MGL command: jacobian res xdat ydat [zdat=0]

Computates the Jacobian for transformation {i,j,k} to {xdat,ydat,zdat} where initial coordinates {i,j,k} are data indexes normalized in range [0,1]. The Jacobian is determined by formula det||dr_\alpha/d\xi_\beta|| where r={xdat,ydat,zdat} and \ xi={i,j,k}. All dimensions must be the same for all data arrays. Data must be 3D if all 3 arrays {xdat,ydat,zdat} are specified or 2D if only 2 arrays {xdat,ydat} are specified.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2025
Individual documents may contain additional copyright information.