This page describes the input commands for the Code your math picture web application.
See also the Examples.
3^x
= pow(3,x)
3^2*x
= x*3^2
= 9*x
2^-2
= 1/(2^2)
= 1/4
.facl(5)
.
Colors must be specified 'CSS style', that means by RGB values, by hexadecimal values or by specific names. Example RGB values: Example hexadecimal values: There are also 140 specific color names that can be used, like |
|
gridstroke |
Line color of the next drawn grid. Default: |
dotmarkerfill |
Fill color of all marker dots. This variable needs to be defined before any dot marker is defined. Default: |
dotmarkersize |
Size of all marker dots in pixels. This variable needs to be defined before any dot marker is defined. Default: |
strokewidth |
Line thickness in pixels of the next drawn figure. Default: |
stroke |
Line color of the next drawn figure. Default: |
strokeopacity |
Line color opacity of the next drawn figure (transparent = "0", solid = "1"). Default: |
strokedasharray |
Dash array of the lines of the next drawn figure. Default: Example: |
fill |
Fill color of the next drawn figure. Default: |
fillopacity |
Fill color opacity of the next drawn figure (transparent = "0", solid = "1"). Default: |
fontfamily |
Font family of the next text, like |
fontsize |
Font size in pixels of the next text. Default: |
fontstyle |
Font style of the next text. Possible values: |
fontweight |
Font weight of the next text. Some possible values: |
fontstroke |
Font stroke color of the next text. Default: |
fontstrokewidth |
Font stroke thickness of the next text in pixels. Default: |
fontfill |
Font fill color of the next text. Default: |
textanchor |
Font text anchor of the next text, to align text relative to a given point.
Possible values: |
pointsize |
Size of the next drawn point, in pixels. Default: |
pointfill |
Fill color of the next drawn point. Default: |
perpendsize |
Size of the next perpendicular sign, in pixels. Default: |
initPicture(xmin,xmax,ymin,ymax) |
This is usually the first command. The arguments set the coordinate system, but axes or a grid are not drawn. If If |
axes(dx,dy,labels) |
If axes need to be drawn, this is usually the second command. If no arguments are set, just an x-axis and a y-axis with a tick at every unit multiple are drawn. If dx is set and not dy, ticks are drawn separated at this distance on both x-axis and a y-axis (taking the x-axis and y-axis scale into account). If dy is also set, ticks are drawn separated at this distance on the y-axis and separated at dx distance on the x-axis. labels is a boolean type argument. If set, it can be the first and only, the second and last or the third and last argument.
If it is set as |
grid(gdx,gdy) |
If a grid is needed, this is usually the second or the third command. If no arguments are set, horizontal and vertical lines at every unit multiple are drawn. If gdx is set and not gdy, both vertical and horizontal lines are drawn separated at this distance measured on x and y-axis. If gdy is also set, horizontal lines are drawn separated at this distance and vertical lines separated at gdx distance. |
line(p,q,marker) |
Draws a straight line from p to q. marker defines begin and end markers if given one of the following values:
|
path(plist,marker) |
Draws a path of straight lines from point to point to point... plist defines the points: marker defines begin, mid and end markers if given one of the following values:
|
curve(plist,marker) |
The same as |
loop(p,d,marker) |
Draws a loop from point p to point p. d is a direction vector, e.g. If set, only markers
|
arc(start,end,radius,marker) |
Draws an arc, a segment of a circle. If set, only markers
|
circle(center,radius) |
Draws a circle. |
ellipse(center,rx,ry) |
Draws an ellipse. |
rect(p,q,marker) |
Draws a rectangle with opposite corners at points p and q. If set, only marker
|
triangle(p,q,r,marker) |
Draws a triangle with vertices in points p, q and r. If set, only marker
|
sector(center, r, startangle, angle, marker) |
Draws a circle sector with its center in point center, a radius r, a startangle and a central angle. Angles in degrees. If set, only marker
|
rectround(p,q,rx,ry) |
Draws a rectangle with lower left corner at point p and upper right corner at point q. If set, all corners are rounded by radius rx or, if both set, by radii rx,ry. |
point(p, type, label, pos) |
Draws a mark indicating the position of a point at p. type defines the kind of mark if given one of the following values:
label can be set if type is set, and represents text written at a position pos, relative to point p.
Look at the description of the |
perpend(p,rot) |
Draws a perpendicular sign at point p. rot defines the rotation in degrees around point p. |
text(p,st,pos) |
Draws a text given by st with a default start position at point p. pos defines the position of the text relative to point p if given one of the following values:
|
plot(fun,x_min,x_max,points) |
Plots a single variable function f(x). Functions need to be defined as JavaScript functions, e.g. fun can be a single function or an array of two functions x_min and x_max define for what part of the domain the function is drawn. Default are the edges of the picture. points defines the number of points used (default = 200). Increase the value if the curve becomes jagged. |
polarplot(fun,t_min,t_max,points) |
Plots a polar function r(t), with r being the radius from the origin and t the angle in radians. This function works quit similar as |
animate(mspf,step,fun,max) |
Animation. mspf sets the time (in ms) that one frame takes. step sets the 'change' every one frame. fun is the function to be animated. max sets the maximum value of the variable of the function to be animated. |
e , pi |
The variables |
pow(a,b) |
Returns the value of a to the power of b. |
sqrt(a) |
Returns the square root of a. |
exp(a) |
Returns the value of e^a. Example: |
abs(a) |
Returns the absolute value of a. Example: |
ln(a) |
Returns the natural logarithm (base e) of a. Example: |
lg(a) |
Returns the common logarithm (base 10) of a. Example: |
log(b,a) |
Returns the logarithm of a to base b. Example: |
sin(a) , cos(a) , tan(a) |
Return the sine, cosine and tangent of a (angel a in radians). |
arcsin(a) , arccos(a) , arctan(a) |
Return the arcsine, arccosine and arctangent (in radians) of a. |
sec(a) , csc(a) , cot(a) |
Return the secant, cosecant and cotangent of a (angel a in radians). |
arcsec(a) , arccsc(a) , arccot(a) |
Return the arcsecant, arccosecant and arccotangent (in radians) of a. |
sinh(a) , cosh(a) , tanh(a) |
Return the hyperbolic sine, hyperbolic cosine and hyperbolic tangent of a. |
arsinh(a) , arcosh(a) , artanh(a) |
Return the area hyperbolic sine, area hyperbolic cosine and area hyperbolic tangent of a. |
sech(a) , csch(a) , coth(a) |
Return the hyperbolic secant, hyperbolic cosecant and hyperbolic cotangent of a. |
arsech(a) , arcsch(a) , arcoth(a) |
Return the area hyperbolic secant, area hyperbolic cosecant and area hyperbolic cotangent of a. |
radtodeg(r) |
Converts r in radians to degrees. Example: |
degtorad(d) |
Converts d in degrees to radians. Example: |
mod(a,b) |
Returns a modulo b, the remainder after a dividing by b. Example: |
facl(a,n) |
Returns the product of a and every nth positive integer less than a. Example: Default (n=1) is the factorial function. Example: |
C(n,k) |
Returns the binomial coefficient n choose k. Example: |
min(a,b,c,...,n) |
Returns the number with the lowest value. Example: |
max(a,b,c,...,n) |
Returns the number with the highest value. Example: |
ceil(a) |
Ceiling function. Returns the value of a rounded up to its nearest integer. Example: |
floor(a) |
Floor function. Returns the value of a rounded down to its nearest integer. Example: |
round(a,n) |
Returns the value of a rounded to n places after the decimal point. Example: Default (n=0) returns the value of a rounded to its nearest integer.
Examples: |
chop(a,n) |
Returns the value of a, truncated to n places after the decimal point. Example: |
ran(a,b,n) |
Returns a random number in [a,b] with n digits after the decimal point.
Example: |