Main features of Mathete

The article consists of short examples with explanations of main features of Mathete. It can be used as a reference. When new features appear, I'll update the article appending new options. The source is available for viewing and copying – if something is not clear from the description, look at the source code, copy the examples to yourself.

Text paragraph

To insert a heading use # (hash sign) at the beginning of the line. Number of hash signs determines the level of heading

Heading Level 1 (# at the beginning of the line)

Heading Level 2 (# # at the beginning of the line)

Heading Level 3 (# # # at the beginning of the line)

Heading level 4 (#### at the beginning of the line)

Text can be italic or bold. For italics surround the text by asterisks. For bold – surround the text with a pair of asterisks.

Equations x_alpha=R_t*\(G+x_water/t_strem) can be inserted within alpha_p^F text. Everything between < < and > > is interpreted as an equation. Equation syntax is the same as mathematical paragraphs have (read below)

Mathematical paragraph

Input of numbers

Subparagraphs are separated with semicolon. Calculations are made sequentially in each subparagraph from the left to the right. To separate integer and decimal part the dot is used

12; 45; 67.890

Addition. Subtraction

Use "plus" and "minus" signs accordingly

34 + 56 + 78 - 7; 78.903 - 0.567

Multiplication

Use asterisk(*)

6.78 * 45.6; 3.6 * 9056.7

Division

Use slash /

5/6.789; 4.9076/3.4

Exponentiation

Use ^ symbol or two asterisks in succession

5^6^3; (5/6.78)^3.4

Root

For square root just use \ (back slash) before radicand. For the root of given power type root power before \ sign

\9; 3\((45.67+78.9)/90.7)

Absolute value

For absolute value use vertical lines to the left and to the right of expression

|3|; |-45/3.5|

Factorial

For factorial use exclamation point (pling) in the end of expression

5!; (\81/3)!

Use of symbols. Names. Assigning

You can use any combinations of letters and numbers. The main thing is using letter as a first symbol. You can use letters of any language, not only Latin characters

x; выа; E45;

Use underlining sign to type suffix. That is name_suffix.

x_1; Q_water; T_stream

To enter Greek characters use their names in English. It works for names and suffixes. Example: alpha, Omega.

alpha; Omega_1; Phi_beta

You can assign a value to any name. Use the equal sign (=). In following sub-paragraphs and paragraphs of this article, you can use that name – its value will be set for calculation. Further along the article you can override the value of the name. If the page contains several articles (e.g. article and several comments), then each article has its own namespace. See results in the following example.

x=3; y=5; z=x*y
x=67; v=x*y

You can use multiple naming

x=y=z=7; x*y^7

Variables

You can allow the reader (as well as the author) to choose the values of some names. For this, use input function. In the example below, I simply typed the following: a = input (1.2); b = input (6,8,9). The default value is typed in parenthesis. If you type several numbers separated by a comma, you will thus limit the choice by these values.

a=input(1.2); b=input(6,8,9)

Elementary functions

Trigonometrical functions. Type as you used to – sin(0); cos(1); tan(2);cot(3)

sin(0); cos(1); tan(2);cot(3)

Inverse trigonometric function. asin(0); acos(1); atan(2); acot(3). Note that the value from “standard” period is calculated only

asin(0); acos(1); atan(2);acot(3)

Logarithms. For natural logarithms use ln function, for logarithms with random base use log(expression, base)

ln(10); log(4*8, \2)

Arrays. Vectors

To enter a vector, or if you prefer to call it array, use square brackets and commas to separate the elements. Array elements can be accessed by index, use the following syntax: Array_Name[Index]. The numbering of elements starts from zero. Any expressions can be array elements. In the following example we enter an array, and then we modify its third element, using zero and four element for calculation. In the last subparagraph we simply display new array.

M = [1, 3, 56, 8.9, -7.9, 78]; M[3]=M[1]*M[5]; M

If you need an array as an arithmetic progression, it is convenient to use the following construction: first_element, second_element .. last_element. If progression step is one, the second element may be omitted. In the example below, I typed: X=3,3.2 .. 12; Y=-3 .. 8

X=3,3.2..12; Y=-3..8

You can perform actions and apply functions to arrays. The result is an array of results. In this example we use arrays from the last paragraph.

X_1=X+1; Y_sin = sin(Y)

Yourself functions.

You can define yourself function and use it further as built-in. Syntax is usual. Below I just typed: F(t)=sin(t) + a\ln(t); F(2.3); F(X). Note that I use а variable typed earlier. Try to type another number and re-calculate. Great?!

F(t)=sin(t) + a\ln(t); F(2.5); F(X)

Infinity

Mathete use the concept of infinity. All numbers over 10 in 307th power are considered infinity. The system cannot perform more detailed calculations. All actions will lead to infinity or to uncertainty (NaN in our system). To indicate infinity you should sequentially type two Latin letters "о".

g=18798^324789; p=oo; g*p; g-p; g/p; g*0

Sum.Production

These functions are currently only for displaying. Calculations for them have not yet been made. Use sum for summation, prod for production. These functions have three arguments. The first (and perhaps the only) is the expression for summation (production), the second and third are the limits. Limits can be omitted. Below I typed: S = sum(G_i/k_j); P_delta = prod(B_i); T = sum(F_i, i=0, i=s)/prod(x^2, x=0, x=c)

S = sum(G_i/k_j); P_delta = prod(B_i); T = sum(F_i, i=0, i=s)/prod(x^2, x=0, x=c)

Derivatives

Are also only for displaying. Use diff function.Below I typed:diff((x^5+3x^4)/(12x^2), x); diff(xy+ x^y, [x, y])

diff((x^5+3*x^4)/(12*x^2), x); diff(x*y+ x^y, [x, y])

Integrals

Are also only for displaying. Use integral function. Below I typed: integral((x^5+3x^4)/(12x^2), x); integral(xy+ x^y, [x, y])

integral((x^5+3*x^4)/(12*x^2), x); integral(x*y+ x^y, [x, y])

Ratios. Boolean type

Expressions can be compared. Use the following operators: == equal,!= not equal, > more than, < less than, >= more or equal, <= less or equal. The result is true or false. It's not just the names but Boolean type values. To avoid confusion, they are specially highlighted in blue. Ratios work correctly only with expressions reducible to a number. Ratios should not be used in symbolic computations

2*2 == 4; -3<-2; 8>908; 5>= \25; 81<= ln(pi)

Conditions. Piecewise functions.

If function returns the value depending on condition meeting. The syntax is: if (condition, value_for_meeting_the_condition, value_otherwise). Switch function takes any number of arrays of two elements – condition and value, in case of condition meeting. Below, in addition to familiar structures I used: if(x==2, 10, 0) и e(z) = switch([z<3, -3/4], [z==3, 5], [z > 3, 6])

x=input(2); if(x==2, 10, 0)
t=-1,-0.9..5; e(x)= switch([x<3, -3/4], [x==3, 5], [x > 3, 6])
chart({x1: t, y1: e(t), color1: "grey", type1: "line", label1: "fsdf", x2: [3], y2: [5], color2: "blue", type2: "points", label2: "", width: "200", height: "200", legend: "ne", xaxis: "auto", yaxis: "auto"})

Random numbers

Random(n) function returns random number from 0 to n

K_rand = random(10)

Charts

Let’s build a chart of our function F(t) with arguments X. For charting the best is to use Chart tab paragraph input toolbar. I just typed X in x1 field, and F(X) in field y1 field. I chose the color blue, the type of graph is the solid line. I set the width of 500 and height of 200. And in the description I wrote F(t). That's it!

chart({x1: X, y1: F(X), color1: "blue", type1: "line", label1: "F(X)", width: "500", height: "200", legend: "ne", xaxis: "auto", yaxis: "auto"})

3D charts. Let’s build chart on the following sequences

x = 0,0.1..10; y = sin(x); z=x
chart3d({x: x, y: y, z: z, color: "red", width: "300", xaxis: "auto", yaxis: "auto"})

author: boris 14 jan 2011 14:23 Mathete. Examples show source Bookmark and Share

Comments not allowed

close
wait...