Mathematica
as a calculator                               

You can use Mathematica as an ordinary calculator - type in an expression, press SHIFT + ENTER  and  Mathematica calculates it and gives you the result.
Near the main work rules are ubderlined.

Example 1. Raising the number 3 to the 2th power. You can choose different values if you wish. On the right end of the line the cell is marked by a blue squared bracket . When the cursor is blinking in the cell, press the  SHIFT+ENTER keys simultaniousley. You can go back and execute any chosen cell at any time.  

3^2

9

Mathematica automatically works with infinite accuracy, for example 3 to the 100th power is a number with 48 decimal symbols:

3^100

515377520732011331036461129765621272702107522001

Yu can choose mathematical symbols similarly to WORD by using the palettes. For example open from the menu: File \ Palettes \ BasicInput, so that the previous example can be also written as:

3^100

515377520732011331036461129765621272702107522001

Example 2. We can use variables to store numbers, graphics, lists or any other Mathematica object. But be very careful in naming variables, because the capital letters are different from the miniscule letters.  For instance variables A1 and a1 contain different object:

A1 = "This is A1" a1 = 222 a1 A1

This is A1

222

222

This is A1

Example 3. Two or more expressions can be placed in a single cell and can be executed one after the other. Here is a scalar product of two vectors a and b, whoose components are given in curly brackets. The result will be stored in variable c. Keep in mind that the dot between them as a vector product symbol is manditory.

a = {1, 0, -3, 2} b = {0, 1, 2, 5} c = a . b

{1, 0, -3, 2}

{0, 1, 2, 5}

4

Example 4. Standard mathematical constants and build-in funcions are written with a capital first letter and the argument in square brackets. Note that Mathematica is case sensitive!  You can use palettes as well.

Cos[Pi/4] Tan[π/3]

1/2^(1/2)

3^(1/2)

Example 5. When we want the result to be a number it is enough to give at least one argument as a decimal fraction, i.e.  2.0,  -12.456,  100.  etc. Note the difference:

Sin[π/12] RowBox[{Sin, [, RowBox[{π, /, 12.}], ]}]

(-1 + 3^(1/2))/(2 2^(1/2))

0.258819

Example 6. It is easy to input formulas. When the variables in them have recieved a result beforehand Mathematica will work with numbers, otherwise it will work with symbols. We are going to solve a quadratic equation now and an irrational parametric equation with a parameter k - later. Note that in equations the symbol for logical comparison = = is used , and not the regular equation symbol =.

Solve[5x^2 - 6x + 1 == 0, x]

{{x1/5}, {x1}}

Saving solutions for later use is shown below. Here /. is a symbol for substitute. The % takes the result from the previous command.

x1 = x/. %[[1]] x2 = x/. %%[[2]]

1/5

1

Solve[x^(1/2) + k == 2x, x] x3 = x/. %[[1]] x4 = x/. %%[[2]]

{{x1/8 (1 + 4 k - (1 + 8 k)^(1/2))}, {x1/8 (1 + 4 k + (1 + 8 k)^(1/2))}}

1/8 (1 + 4 k - (1 + 8 k)^(1/2))

1/8 (1 + 4 k + (1 + 8 k)^(1/2))

Example 8. Let us calculate an indefinite integral by choosing the correct integral symbol from the mathematical symbol palette File \ Palettes \ BasicInput. In order to use the variable a as a parameter we need to cancel it since that letter was used in example 2 as a vector. This cancelation is carried out by the symbol  =. (dot):

a=. ∫x^(1/2) (a + x)^(1/2) x a = 5 ∫x^(1/2) (a + x)^(1/2) x

(a + x)^(1/2) ((a x^(1/2))/4 + x^(3/2)/2) - 1/4 a^2 Log[x^(1/2) + (a + x)^(1/2)]

5

(5 + x)^(1/2) ((5 x^(1/2))/4 + x^(3/2)/2) - 25/4 ArcSinh[x^(1/2)/5^(1/2)]

Example 9. Let us see what is the graphics of the integrand function  f=x^(1/2) (a + x)^(1/2) where а=5 in the interval [0, 1] for example.

f = x^(1/2) (a + x)^(1/2) Plot[f, {x, 0, 1}]

x^(1/2) (5 + x)^(1/2)

[Graphics:HTMLFiles/index_38.gif]

⁃Graphics⁃

Example 10. Here is the definite integral of the same integrand function in the interval [0,1] for a=7.  In order to avoid output value of a, we need to add the symbol ; (semicolon).

a = 7 ; ∫_0^1x^(1/2) (a + x)^(1/2) x RowBox[{RowBox[{∫_0, ^, 1.}], x^(1/2) (a + x)^(1/2) x}]

9/2^(1/2) - 49/4 ArcSinh[1/7^(1/2)]

1.8376

Example 11. Bellow we draw a two-dimentional graphics of the function sin (2.5x) + cot (x)  in  the interval [-3π, 2π]. Here Cot[x] is the cotangent function. Then the same graphics is given, but the values of the function are limited between -2 and 2. The vertical asymptotes are drown too.

RowBox[{Plot, [, RowBox[{RowBox[{RowBox[{Sin, [, RowBox[{2.5, x}], ]}], +, Cot[x]}], ,, {x, -3 ... ox[{2.5, x}], ]}], +, Cot[x]}], ,, {x, -3π, 2π}, ,,  , PlotRange {-2, 2}}], ]}]

[Graphics:HTMLFiles/index_44.gif]

⁃Graphics⁃

[Graphics:HTMLFiles/index_46.gif]

⁃Graphics⁃

Example 12. We can draw several graphics around a single axis:

f1 = ArcSin[2x] f2 = ArcCos[x] RowBox[{Plot, [, RowBox[{{f1, f2}, ,,  , RowBox[{{, RowBox[{x, ,, RowBox[{-, 0.5}], ,,  , 0.5}], }}]}], ]}]

ArcSin[2 x]

ArcCos[x]

[Graphics:HTMLFiles/index_51.gif]

⁃Graphics⁃

Example 13. An example of a 3D graphics in Cartesian coordinates when the function is given by a formulae. Bordsers for values must be set every time, so that the system can calculate the needed values. We have added an option for specifying the number of points in the two directions of the net which draw the graphics.

Plot3D[Sin[(x^3 * y)/(x + 2y)], {x, π/2, π}, {y, 0, π}, PlotPoints40]

[Graphics:HTMLFiles/index_54.gif]

⁃SurfaceGraphics⁃

Example 14. Another example of a 3D graphics with a set function formula. When there are asymptotes, Mathematica tries to draw them. In the following example the function Cot (cotangent) is undefined when y=0, which is why there is a отвесна равнина (област на прекъсване).

RowBox[{Plot3D, [, RowBox[{RowBox[{RowBox[{Sin, [, RowBox[{2.5, x}], ]}], +, Cot[ y]}], ,, {x, -π, π}, ,, {y, -π/2, π/2}}], ]}]

[Graphics:HTMLFiles/index_57.gif]

⁃SurfaceGraphics⁃


Created by Mathematica  (October 6, 2007)