Back to the table of contents

Construction of 2D and 3D plots

3.1 Plotting functions

Mathpar table allows you to build graphics ($tablePlot$), graphs of functions, which are explicitly defined ($plot$) or parametric ($paramPlot$). You can build several different graphs in one coordinate system ($showPlots$).

Setting charting given command set2D(). If the command set2D() has no parameters, the boundaries for the graphs are calculated automatically, and for explicit functions selected interval $[0,1]$ along the horizontal axis. The names of the coordinate axes will be $X$ and $Y$, respectively. Title in the schedule will be absent.

If the command set2D() user not asked, it is automatically set set2D() with no arguments at the beginning of the session the user.

There are 7 basic options of this command with the following parameters: 1) set2D() 2) set2D(x0, x1); 3) set2D(x0, x1, 'title'); 4) set2D(x0, x1, y0, y1); 5) set2D(x0, x1, y0, y1, 'title'); 6) set2D(x0, x1, 'title', 'nameOX', 'nameOY'); 7) set2D(x0, x1, y0, y1, 'title', 'nameOX', 'nameOY').

Numbers $x0$ and $x1$ $(x0<x1)$ sets the interval along the axis of $OX$. Numbers $y0$ and $y1$ $(x0<x1)$ sets the interval along the axis of $OY$. If these parameters are not specified, are calculated automatically. $nameOX$ — signature on the axis $OX$, $nameOY$ — signature on the axis $OY$, $title$ — header graphics.

In addition, permitted to ask one or two keys that should be the last in the list of options: $BW$ and $ES$. $BW$ refers to the construction of Cheraw and white graphics. $ES$ indicates equality zoom scale $x$ axis ranges from $y$. A total of $7*4=28$ different ways to set the parameters environment.

Character line which is depicted in the graph of each of the functions $(plot, tablePlot, paramPlot)$ can be different: the solid line, dotted line, and the line that ends with an arrow. To do this, these options are: '$dash$' (dotted line), '$arrow$' (arrows) and a combination of '$dashAndArrow$', which should be at the end of the parameter list of these functions.

For example, plot( x^2+1, 'dash').

If several separate graphs have names such as P=plot(x^2); Q=tablePlot([[1,2], [3,4]]); in this case they may be represented along with the command showPlots([P, Q]).

The resulting plot can be downloaded from the site. To do this, click on the button $\small \fbox{Download}$, which is located below the graph. The file is on schedule to be downloaded to your computer.

Plots of explicit functions

To obtain the plot of an explicit function $f=f(x)$ the command plot(f). Other options commands: 1) plot(f, [x0, x1]), where $[x0, x1]$ — interval along the axis of $OX$; 2) plot(f, [x0, x1], 'options'), where $[x0, x1]$ — interval along the axis of $OX$, 'options' — takes the following values: 1)'dash' — schedule will be a dashed line;\ 2)'arrow' — the last point on the graph is drawn with an arrow; 3)'dashAndArrow' — schedule will be a dashed line and the last point of the graph is drawn with an arrow. 3) plot(f, 'options'). You can plot functions with parametric variables. The parametric variables are assigned when you set a environment (see ex.3).

No result yet

%\eject To get the graphs of several functions in one figure you must enclose the list of these functions in square brackets, as in the following example.

No result yet

No result yet

No result yet

No result yet

No result yet

No result yet

No result yet

Plots of parametric functions

To obtain the plot of parametric function {$f=x(t)$, $g=y(t)$} the command paramPlot([f, g], [t0, t1]) is used, where $[t0, t1]$ is an interval of variation of $t$. Another version of the command: paramPlot([f, g], [t0, t1], 'options'), where $[t0, t1]$ — the range of values for the parameter change, 'options' — the following values: 1)'dash' — schedule will be a dashed line;\ 2)'arrow' — the last point on the graph is drawn with an arrow; 3)'dashAndArrow' — schedule will be a dashed line and the last point of the graph is drawn with an arrow.

No result yet
No result yet
No result yet
No result yet

No result yet

No result yet
No result yet
No result yet

Plot of table function

To plot a function, which is defined by the table of points you have to execute the command: tablePlot([[x_{1,…, x_{n}],[y_{11},…,a_{1n}],…,[y_{k1},…,a_{kn}]])}. Another version of the command: tablePlot([[x_{1,…, x_{n}],[y_{11},…,a_{1n}],…,[y_{k1},…,a_{kn}]], 'options')} ,where 'options' — the following values: 1)'dash' — schedule will be a dashed line;\ 2)'arrow' — the last point on the graph is drawn with an arrow; 3)'dashAndArrow' — schedule will be a dashed line and the last point of the graph is drawn with an arrow.

No result yet

No result yet

No result yet

No result yet

No result yet

No result yet

Functions that are defined on the points table of values

Plotting functions on the points given by the tabulated values use the command:

pointsPlot([[x_{1,…, x_{n}],[y_{1},…,y_{n}]], [s_{1},…,s_{n}], [kv_{1},…,kv_{n}], [kg_{1},…,kg_{n}])}, where $s_{n}$ — signature points, $kv_{n}$ — rate of rotation about the point (ranges from 0 to 7, and signifies a shift in the ($kv_{n}$ * 45) degrees), $kg_{n}$ — shift factor along the axis $OX$ (if it is negative then the displacement is to the left).

The reduced variants of this command:

pointsPlot([[x_{1,…, x_{n}],[y_{1},…,y_{n}]], [s_{1},…,s_{n}])}

or pointsPlot([[x_{1,…, x_{n}],[y_{1},…,y_{n}]], [s_{1},…,s_{n}], [kv_{1},…,kv_{n}])}

or pointsPlot([[x_{1,…, x_{n}],[y_{1},…,y_{n}]], [s_{1},…,s_{n}], [kv_{1},…,kv_{n}], [kg_{1},…,kg_{n}])}

No result yet

No result yet

No result yet

No result yet

No result yet

No result yet

Construction of various plots of functions in one coordinate system

To construct the plots of functions defined in different ways, you must first build a plot of each function and then execute the command showPlots([f_1, f_2, …, f_n]).

Another version of the command:

showPlots([f1, f2, f3, f4], 'noAxes'), where 'noAxes' — parameter indicating image graphics without axes, or

showPlots([f1, f2, f3, f4], 'lattice'), where 'lattice' — parameter indicating the image graph with the lattice.

No result yet

No result yet

No result yet

Construction of graphs

To construct the graph, use the command

plotGraph([[a_{11,…,a_{1n}],…,[a_{n1},…,a_{nn}]], [[x_{1},…, x_{n}],[y_{1},…,y_{n}]])},

where $[[a_{11},…,a_{1n}],…,[a_{n1},…,a_{nn}]]$ — adjacency matrix,

$[[x_{1},…, x_{n}],[y_{1},…,y_{n}]]$ — matrix of coordinates.

No result yet

In addition, you can run only with the first parameter

plotGraph([[a_{11,…,a_{1n}],…,[a_{n1},…,a_{nn}]])},

where $[[a_{11},…,a_{1n}],…,[a_{n1},…,a_{nn}]]$ — adjacency matrix.

\

No result yet

You need to run a single numeric parameter plotGraph(N), where $N$ — the number of vertices in a graph.

No result yet

3.2 3D function graphs plotting

The environment for plotting 3D graphs is set with the command set3D()

There are several variants for this command: 1) set3D(x0,x1,y0,y1,z0,z1); 2) set3D(x0,x1,y0,y1,z0,z1,gridSize); 3) set3D(x0,x1,y0,y1,z0,z1,gridSize,framesNumber); \ 4) set3D(x0,x1,y0,y1,z0,z1,gridSize,framesNumber,[a1,a2,...]); \.

The numbers $x0$ and $x1$ $(x0<x1)$ define the interval on the $OX$ axis. The numbers $y0$ and $y1$ $(y0<y1)$ define an interval on the $OY$ axis. The numbers $z0$ and $z1$ $(z0<z1)$ specify the interval on the $OZ$ axis. $gridSize$ is responsible for the grid size of the box in space in which the graph is drawn. $framesNumber$ is responsible for the number of frames when plotting a graph with parameters, whose change can be observed as a change of frames. $a1$ and $a2$ are responsible for the final value of the function parameters. These values will be set in the sliders that appear under the text with the user's request. When parameters are changed during frame changes, their values will change in the range from 1.0 to $a1$ for the first parameter.

Explicit 3D function graphs plotting. Server-side building

You can build 3D graphs of the functions that are defined explicitly. To obtain the plot 3D of an explicit function $f=f(x,y)$ the command plot3d(f, [x0, x1, y0, y1]), is used, where $[x0, x1]$ is an interval on the axis $OX$, $[y0, y1]$ is an interval on the axis $OY$.

The obtained plot can be rotated and to increase or decrease.

Moving the mouse holding down the left <<mouse>> button causes the rotation of the coordinate system of schedule. After stopping the movement of the <<mouse>> graphics are redrawn in the new rotated coordinate system. Moving the mouse holding down the left mouse button while pressing $ Shift$ button leads to a change in image scale. After stopping the movement of the <<mouse>> graphics are redrawn in the new scale.

No result yet

No result yet

No result yet

Explicit 3D function graphs plotting. Client-side building

Also, graphs of functions that are explicitly defined can be plotted with the command explicitPlot3d(f, xMin, xMax, yMin, yMax, zMin, zMax), where the numbers $xMin, xMax, yMin, yMax, zMin, zMax$ define a region in space having the shape of a box, in which the explicit function is represented.

In addition, the following set of arguments are allowed: $(f, xMin, xMax, yMin, yMax, zMin, zMax, gridSize)$, where $gridSize$ is responsible for the size of the grid of the box in which the graph is plotted.

You can specify only one function, as follows: explicitPlot3d(f), in this case, it is supposed to represent the function $f$ in a cube $20\times20\times20$, whose center is at the origin.

Using explicitPlot3d() you can rotate the coordinate system by moving the mouse pointer with the left button pressed. You can also shift the origin of the coordinate system by moving the mouse pointer with the right button pressed.

To plot the graph of a function in time with changing parameters you should first specify the number of frames. Then, you should set the final value of parameters using the sliders. To build the graph, you should press the 'Plot' button. The value of the number of frames and parameters on the sliders can be specified via set3D().

No result yet

No result yet

Plotting 3D graphs of functions that are parametrically defined. Server-side building

Mathpar allows you to build 3D graphs of functions that are specified parametrically.

To plot a graph, you need to pass 3 functions $f(x,y)$, $g(x,y)$, and $h(x,y)$ using the command paramPlot3d([[[f], [g], [h]], [x0, x1, y0, y1]), where $[x0, x1]$ — interval on the $OX$-axis, $[y0, y1]$ — interval on the $OY$-axis.

Sphere

No result yet

Thor

No result yet

Spiral

No result yet

Logarithmic spiral

No result yet

"Seashell"

No result yet

Shamrock

No result yet

Dini surface

No result yet

Tape Mobius

No result yet

Cube

No result yet

Cylinder

No result yet

Cone

No result yet

Truncated cone

No result yet

Hourglass

No result yet

Plotting 3D graphs of functions that are parametrically defined. Client-side building

Also, graphs of functions that are defined parametrically can be plotted with the command parametricPlot3d(f, g, h, uMin, uMax, vMin, vMax, gridSize), where the 3 functions $f(u,v)$, $g(u,v)$ and $h(u,v)$ for the axes $OX$, $OY$, $OZ$ are specified. The numbers $uMin, uMax, vMin, vMax$ specify the range for the parameters of functions f, g and h. $gridSize$ is responsible for the grid size of the box in which the graph is plotted.

You can rotate the coordinate system by moving the mouse pointer with the left button pressed. You can also shift the origin of the coordinate system by moving the mouse pointer with the right button pressed.

To plot the graph of a function in time with changing parameters, you should first specify the number of frames. Then, you should set the final value of parameters using the sliders. To build the graph, you should press the 'Plot' button. The value of the number of frames and parameters on the sliders can be specified via set3D().

Parametric thor

No result yet

Parametric spiral

No result yet

Ploting of 3D graphs of functions that are defined implicitly

You can build 3D graphs of the functions that are defined implicitly. To construct the graph of an implicit function $ f(x,y,z)=0$ use the command

implicitPlot3d(f, x0, x1, y0, y1,z0, z1),

where the numbers $xMin, xMax, yMin, yMax, zMin, zMax$ set the box in the space, which is represented by an implicit function.

You can specify only one function, like this

implicitPlot3d(f)

in this case it is assumed that there will be shows the function $ f $ in the cube $ 20\times 20 \times 20$, which is placed on a center origin.

You can rotate the coordinate system by moving the mouse pointer while holding down the left button. You can move the coordinate system by moving the mouse pointer while holding down the right button.

It is possible, optionally, to specify the coordinates of the light source, the color of the surface and the grid size. The default grid of 50 points on each edge of the box.

The color format $RGB$ (red, green, blue) is given a number

$R * 256 * 256+ G *256 + B$,

where each letter denotes a non-negative integer not exceeding 255. For example, $ 255 * 256 * 256 $ — red, and $ 255 * 256 * 256 + 255 * $ 256 — yellow (red + green).

Allowed, in addition, the following sets of arguments:

$(F, xMin, xMax, yMin, yMax, zMin, zMax, gridSize)$,

$(F, xMin, xMax, yMin, yMax, zMin, zMax, lightX, lightY, lightZ, gridSize)$,

$(F, xMin, xMax, yMin, yMax, zMin, zMax, lightX, lightY, lightZ, color, gridSize)$.

To plot the graph of a function in time with changing parameters, you should first specify the number of frames. Then, you should set the final value of parameters using the sliders. To build the graph, you should press the 'Plot' button. The value of the number of frames and parameters on the sliders can be specified via set3D().

No result yet

Hyperboloid

No result yet

Red sphere.

No result yet

Yellow surface with a central symmetry.

No result yet

Organ pipes.

Plot different 3D graphs of functions in one coordinate system

To plot the graphs of functions defined in different ways, you need to execute the command \command{showPlots3D}{(f, g)}, where f and g are commands for building other graphs of a function.

You can set the environment parameters with set3D().

You can rotate the coordinate system by moving the mouse pointer with the left button pressed. You can also shift the origin of the coordinate system by moving the mouse pointer with the right button pressed.

To plot the graph of a function in time with changing parameters, you should first specify the number of frames. Then, you should set the final value of parameters using the sliders. To build the graph, you should press the 'Plot' button. The value of the number of frames and parameters on the sliders can be specified via set3D().

No result yet

3.3 Geometry

paintElement'operator1; operator2; ... operatork; ', is a drawing tool for school geometry.

Operators are defined like this: operator $(arg_1: type_1, .. arg_n: type_n = default)$: returnType $arg_1, .. arg_n$ - list of operator arguments. $type_1, .. type_n$ - types of arguments, strings or numbers, or other object. = default is the value to use if no argument is given. returnType is the type of the returned object.

Operators can have an additional label argument: string, which defines the signature of the figure, and the requirement to display in the figure: • label not set - the shape is used as an intermediate shape and is NOT drawn. • label = \% \% - the figure is drawn, but without a caption. • label =\% text\% - the shape is labeled with text.

Figure signature: operator (arg_1, .. arg_n) .display (\% text\%);

Lines are delimited by percent signs, not quotation marks as in mfthpar.

\subsection {Example (draw circle)}

Circle (radius: r1, center: Point = Point (x1, y1)). You can use different methods of creating a circle: • Circle (r1, Point (x1, y1)); • Circle (r1); - the center will automatically be at x1 = 0, y1 = 0. • R = r1; P = Point (x1, y1) .display (“\% O1\%); C = Circle (R, P);

\subsection {Operators}

Point (x: number1, y: number2) is the point constructor. • x, y - point position.

No result yet

Line (point1: Point, point2: Point) - line constructor. • point1, point2 - line points. The order doesn't matter.

No result yet

Polygon (point1, point2, ..., pointN: Point []) - a polygon constructor, a figure that is a list of points connected by line segments. The last point is connected to the first. • point1, point2, ..., pointN - Polygon vertices. The length of the vertex list is not limited.

No result yet

Rectangle (width: number1, height: number2, bottomLeft: Point = Point (1, 1)) - the constructor of the horizontal rectangle. • width - the width of the rectangle. • height - the height of the rectangle. • bottomLeft - bottom left point of the rectangle.

No result yet

Square (size: number, bottomLeft: Point = Point (x1, y1)) - square constructor. • size - the length of the side of the square. • bottomLeft - bottom left point of the square.

begin {verbatim} paintElement (pl = Square (2, Point (4,0)). display (); ’);

Triangle (point1: Point, point2: Point, point3: Point) - three-point triangle constructor. The order doesn't matter. • point1, point2, point3 - triangle points.

No result yet

Circle (radius: number1, center: Point = Point (x1, y1)) is the circle constructor. • radius - radius of the circle. • center - the center of the circle.

No result yet

Ellipse (width: number1, height: number2, center: Point = Point (x1, y1)) - ellipse constructor. • width - horizontal semiaxis of the ellipse. • height - vertical semiaxis of the ellipse. • center - the center of the ellipse.

No result yet

normal (point: Point1, line: Line1): Point - draw a perpendicular from point to line. Returns the intersection point of a perpendicular and a line. • point - the point from which the perpendicular is restored. • line - a straight line to which the perpendicular is restored.

No result yet

median (point: Point, line: Line): Point - build a median from point to section. Returns the midpoint of a line segment. • point - the point from which to build the median. • line - the segment on which the median is based.

No result yet

Text (text:\% string1\%, leftBottom: Point1, fontSize: number = 10) - write text starting at a certain point. • text - the actual text. • leftBottom - bottom left (starting) point of the text. • fontSize - text font size.

No result yet

middle (line: Line): Point - find the midpoint of the line segment. • line - the segment whose middle you want to find.

No result yet

incircle (triangle: Triangle): Circle - draw a circle inscribed in the tracker. • triangle - a triangle into which the circle should be inscribed

No result yet

Circumcircle (triangle: Triangle): Circle - draw a circle around the triangle. • triangle - a triangle around which you want to describe a circle

No result yet

lineCircleCross (line: Line, circle: Circle): Point [] - find and return points of intersection of a line and a circle. • line - a line that can cross the circle. • circle - a circle that can cross the line.

No result yet

circlesCross (circle1: Circle, circle2: Circle): Point [] - find and return points of intersection of two circles. • circle1, circle2 - circles that can be crossed.

No result yet

Back to the table of contents