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

4.17 Data manipulation

MGL command: hist RES xdat adat
MGL command: hist RES xdat ydat adat
MGL command: hist RES xdat ydat zdat adat
Method on mglGraph: mglData Hist (const mglData &x, const mglData &a, const char *opt="")
Method on mglGraph: mglData Hist (const mglData &x, const mglData &y, const mglData &a, const char *opt="")
Method on mglGraph: mglData Hist (const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *opt="")
C function: HMDT mgl_hist_x (HMGL gr, HCDT x, HCDT a, const char *opt)
C function: HMDT mgl_hist_xy (HMGL gr, HCDT x, HCDT y, HCDT a, const char *opt)
C function: HMDT mgl_hist_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *opt)

These functions make distribution (histogram) of data. They do not draw the obtained data themselves. These functions can be useful if user have data defined for random points (for example, after PIC simulation) and he want to produce a plot which require regular data (defined on grid(s)). The range for grids is always selected as axis range. Arrays x, y, z define the positions (coordinates) of random points. Array a define the data value. Number of points in output array res is selected as maximal value of res size and the value of mglFitPnts.

MGL command: fill dat 'eq'
MGL command: fill dat 'eq' vdat
MGL command: fill dat 'eq' vdat wdat
Method on mglGraph: void Fill (mglData &u, const char *eq, const char *opt="")
Method on mglGraph: void Fill (mglData &u, const char *eq, const mglData &v, const char *opt="")
Method on mglGraph: void Fill (mglData &u, const char *eq, const mglData &v, const mglData &w, const char *opt="")
C function: void mgl_data_fill_eq (HMGL gr, HMDT u, const char *eq, HCDTv, HCDTw, const char *opt)

Fills the value of array according to the formula in string eq. Formula is an arbitrary expression depending on variables ‘x’, ‘y’, ‘z’, ‘u’, ‘v’, ‘w’. Coordinates ‘x’, ‘y’, ‘z’ are supposed to be normalized in axis range. Variable ‘u’ is the original value of the array. Variables ‘v’ and ‘w’ are values of arrays v, w which can be NULL (i.e. can be omitted).

MGL command: pde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
Method on mglGraph: mglData PDE (const char *ham, const mglData &ini_re, const mglData &ini_im, float dz=0.1, float k0=100, const char *opt="")
C function: HMDT mgl_pde_solve (HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, float dz, float k0, const char *opt)

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. Parameters Min, Max set the bounding box for the solution. 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 nonlinear 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 solving hints, for sample code and picture.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 13, 2012 using texi2html 5.0.