Arithmetic calculations. Extracting a root from a number. Positive rational numbers

The Prolog language is not intended for programming tasks with a large number of arithmetic operations. For this, procedural programming languages \u200b\u200bare used. However, in any Prolog system, ordinary arithmetic operations and functions are included:


The prolog has two numerical types of domains: integers and real numbers. The prologue also allows you to compare arithmetic expressions using relationships:

=, <, <=, >, >=, <>

To implement mathematical actions in Prolog, predicates are used. The following examples demonstrate their use.

Example 1

Find the arithmetic mean of two numbers.

Sr (real, real, real)

Sr (A, B, S): - S \u003d (A + B) / 2.

Sr (8, 12, S), write (S).

Result:

Example 2

Determine if a positive integer is even or odd

Chet (A): - A mod 2 \u003d 0, write (A, ‘- even’) ;   Write (A, ‘- not even’).

Result:

18 - even

Recursion

Recursion is the second tool for organizing repetitive actions in PROLOGUE. Recursive procedure  Is a procedure that calls itself until a certain condition is met that stops the recursion. This condition is called boundary. Recursion is a good way to solve problems that contain a subtask of the same type. A recursive rule always consists of at least two parts, one of which is non-recursive. It defines the boundary condition.

Consider the recursive definition of a rule using the rule example. predok

1. X is the ancestor of Z if X is the parent of Z

predok (X, Z): - roditel (X, Z)

2. X is the ancestor of Z if there is such a Y for which X is the parent and Y is the ancestor of Z.

Predok (X, Z): - roditel (X, Y), predok (Y, Z).

The first part of this rule is non-recursive; it defines the condition for the recursion to complete. The search will stop as soon as the closest ancestor is found - the parent.

Program:

roditel (name, name)

predok (name, name)

roditel (Kolya, Olya).

roditel (olya, masha).

predok (X, Z): - roditel (X, Z).

predok (X, Z): - roditel (X, Y), predok (Y, Z).

predok (Kolya, Masha).

Result:

Example. Recursive factorial calculation

The problem of finding the factorial value n! comes down to finding the factorial value (n-1)! and multiplying the found value by n.

Rule for calculating factorial:

fact (0, 1): -!. % non-recursive part of the rule

2. N! \u003d (N-1)! * N.

fact (N, FN): - M \u003d N – 1, % recursive part of the rule

fact (M, FM), FN \u003d FM * N.

Program:

fact (integer, integer)

fact (0, 1): -!.

fact (N, FactN): - M \u003d N – 1, fact (M, FactM), FactN \u003d FactM * N.

fact (3, FN), write (“3! \u003d”, FN).

The result of the program:

For a visual representation of finding a solution, it is convenient to use the goal tree:


fig. 3 Target tree of factorial calculation

Lists

List  Is an object that contains a finite number of other objects. The list in PROLOGUE can be approximately compared with arrays in other languages, but for lists there is no need to declare a dimension in advance.

The PROLOGUE list is enclosed in square brackets and the list items are separated by commas. A list that contains no items is called empty  a list.

List examples:

a list whose elements are integers:

a list whose elements are strings: [“One”, “Two”, “Three”]

empty list:

List items can be lists: [[-1,3,5],]

To use lists in the PROLOG program, you must describe the domain type in the format in the DOMAINS section.

<имя домена> = <тип элементов>*

For instance,

list \u003d *

A list is a recursive object. It consists of heads  (first element of the list) and tail  (all subsequent elements). The tail is also a list.

For example, - a list with A - head, - tail

The PROLOGUE has an operation “|”, which allows you to divide the list into head and tail.


= ] = ] ] = ] ]

An empty list cannot be divided into head and tail. This structure allows you to use recursion to process the list.

An example of a program that outputs list items.

list \u003d integer *

writelist (): - write (A), nl, writelist (Z).

Theme number 1.

Arithmetic calculations. Interest.

Common fractions. Actions on ordinary fractions.

1º. Integers  - these are the numbers used in the calculation. The set of all natural numbers denotes N, i.e. N \u003d (1, 2, 3, ...).

Shot  called a number consisting of several fractions of a unit. Common fraction  called a number of the form where a natural number n  shows how many equal parts the unit is divided, and the natural number m  shows how many such equal parts are taken. The numbers m  and n  called accordingly numerator  and denominator  fractions.

If the numerator is less than the denominator, then the ordinary fraction is called right; if the numerator is equal to or greater than the denominator, then the fraction is called wrong. A number consisting of integer and fractional parts is called mixed number.

For example, - regular ordinary fractions, - incorrect ordinary fractions, 1 - mixed number.

2º. When performing actions on ordinary fractions, the following rules should be remembered:

1)  The main property of the fraction. If the numerator and denominator of a fraction is multiplied or divided by the same natural number, then we get a fraction equal to this.

For example, a); b) .

The division of the numerator and denominator of a fraction by their common divisor other than unity is called fraction reduction.

2) In order to present the mixed number in the form of an irregular fraction, you need to multiply its integer part by the denominator of the fractional part and add the numerator of the fractional part to the resulting product, write down the resulting amount with the numerator of the fraction, and leave the denominator the same.

Similarly, any natural number can be written as an irregular fraction with any denominator.



For example, a), since; b)   etc.

3) In order to write the wrong fraction as a mixed number (i.e., select the integer from the incorrect fraction), you need to divide the numerator by the denominator, take the quotient from the division as the integer part, leave the remainder as the numerator, leave the denominator the same.

For example, a), since 200: 7 \u003d 28 (stop 4);
  b), since 20: 5 \u003d 4 (left 0).

4) To reduce fractions to the lowest common denominator, you need to find the lowest common multiple (LCL) of the denominators of these fractions (it will be their lowest common denominator), divide the smallest common denominator by the denominators of these fractions (i.e. find additional factors for fractions) , multiply the numerator and denominator of each fraction by its additional factor.

For example, we reduce the fractions to the lowest common denominator:

630: 18 = 35, 630: 10 = 63, 630: 21 = 30.

Means ; ; .

5) Arithmetic rules for ordinary fractions:

a) Addition and subtraction of fractions with identical denominators is performed according to the rule:

b) Addition and subtraction of fractions with different denominators is performed according to rule a), after having reduced the fractions to the lowest common denominator.

c) When adding and subtracting mixed numbers, you can convert them to the wrong fraction, and then perform the actions according to the rules a) and b),

d) When multiplying fractions, use the rule:

e) To divide one fraction into another, you must multiply the dividend by the number inverse of the divisor:

.

f) When multiplying and dividing mixed numbers, they are first converted to the wrong fraction, and then use the rules d) and e).

3º. When solving examples of all actions with fractions, remember that the actions in parentheses are performed first. Both in brackets and outside them, multiplication and division are first performed, and then addition and subtraction.

Consider the implementation of the above rules on an example.

Example 1. Calculate: .

1) ;

2) ;

5)   . Answer: 3.

Didactic material.

Find the value of the expression:

1) ; 2) ;

3) ; 4) ;

5) ; 6) ;

7) ;

8) .

The answers:

Didactic material.

Find the value of the expression:

1) ; 2) ;

3) ; 4) ;

5) ; 6) ;

8) ; 9) ;

10) ; 11) ;

13) ;

15) ;

16) ; 17) ;

18) ; 19) ;

20) .

Find X from the proportion:

21) ;

22) ;

23) ;

24) .

Answers: 1) 84,075; 2) 1; 3) 6; 4) 8; 5) 20; 6) 32; 7) 1; 8) 2; 9) 4; 10) 2; 11) 3; 12) 3; 13) 0,5; 14) 3; 15) 1; 16) 3; 17) 5; 18) ; 19) 1; 20) 9; 21) 1; 22) 5; 23) 25; 24) 5.

Didactic material.

1) Find:

a) 4% of 75; b)% of 330; c) 160% of 82.25.

2) Find the number if:

a) 40% of it is equal to 12; b) 1.25% of it is equal to 55; c) 0.8% of it is equal to 1.84; d) its% are equal.

3) Find how many percent is:

a) the number 15,57 of the number 90; b) the number 150 of the number 120; c) the number 0.3 from 1.9

4) The number,% of which is   is equal to:

a) 0.672 b) 400 c) 672 g) 500 d) 472

5) The number,% of which is   is equal to:

a) 762 b) 580 c) 140 g) 350 d) 7.62

6) How many percent of the number 3 is the difference between it and 3% of the number 20?

7) 18% of 10 are equal to 15% of s. Find with.

8) After increasing the number by 17%, they received 108.81. The initial number is:

a) 93.05 b) 93 c) 94 g) 92 d) 92.86

9) Some number was reduced by 14%, resulting in 95. This number is accurate to 0.01 equal to:

a) 110.46 b) 110.44 c) 109.59 g) 110.50 d) 110.47

10) The Savings Bank accrues on deposits 2% of the deposit annually. The depositor contributed 15,000 rubles to the bank. What will be the amount in 2 years?

11) For a long-term deposit, the bank pays 10% per annum. At the end of each year, the accrued amount is added to the deposit. An account of 20,000 rubles was opened for this type of deposit, which was not replenished and from which money was not withdrawn for 3 years. What income was received after this period?

12) A depositor on the money put into the bank in a year accrued interest in the amount of 15 thousand rubles. Without taking them, and adding another 85 thousand rubles, he left all the money for another year at the same interest rates. After the second term, the contribution, together with interest accruals, amounted to 275 thousand rubles. How many thousand rubles were originally deposited in the bank? (When solving the problem, it should be noted that the interest rate of the bank cannot exceed 100% per annum).

13) The depositor deposited a certain amount in the bank at 10% per annum. Every year after calculating interest, he adds 5,000 rubles to his account. As a result, after three years, his contribution amounted to 29,860 rubles. What was the amount of the initial contribution?

14) The labor productivity of the second brigade is 20% higher than that of the first brigade, and the labor productivity of the third brigade is 25% lower than the second. How much is the productivity of the third brigade less than the first?

15) The owner of the store twice a year raised cents on goods by an average of 10%. How much has the price of goods increased over the year?

16) Prices for computer equipment on average decreased twice a year by 10%. How many percent decreased the price of computer equipment for the year?

17) Two alcoholic solutions of boric acid of the same mass were poured into one vessel. What concentration solution was obtained as a result if the first solution was five percent (5% boric acid and 95% alcohol), and the second one-percent?

18) How many ml of water do you need to add to 500 ml of a 96% alcohol solution (96% alcohol, 4% water) to get a 40% alcohol solution?

19) From a vessel completely filled with 12% salt solution, 1 liter was poured and 1 liter of water was poured. After that, a 9% salt solution appeared in the vessel. How many liters does a vessel hold?

20) The library has books in English, French and German. English books make up 36% of all books in foreign languages. French - 75% of English, and the remaining 185 books - German. How many books in foreign languages \u200b\u200bare in the library?

21) Fresh mushrooms contain 90% water by weight, and dry - 12%. How many dry mushrooms will come out of 44 kg of fresh?

Answers:6) 80%; 7) 12; 10) 15660; 11) 15606; 12) 150; 13) 10000; 14) 10; 15) 21; 16) 19; 17) 3; 18) 700; 19) 4; 20) 500; 21) 5.

Theme number 2.

Equations The absolute value of a number.

Quadratic equations.

1º. Equation of the form   where a, b, c  Are real numbers, moreover a ≠ 0,are called quadratic equation.

The roots of the quadratic equation   are found by the formula:

.

If the coefficient a \u003d 1then the quadratic equation is called given; if the coefficient a ≠ 1unreduced.

2º. Expression called discriminant  quadratic equation.

If D< 0, то уравнение   has no valid roots; if D \u003d 0, then the equation has one real root (or two identical roots); if D\u003e 0, the equation has two different real roots.

3º. Vieta Theorem. The sum of the roots of the quadratic equation is equal and the product of the roots is equal.

For the roots x 1  and x 2  reduced quadratic equation   Vieta's formulas look like:

4º. Equations of the form,, are called incomplete  quadratic equations.

Incomplete quadratic equations are solved as follows:

5º. Expression called square trinomial  regarding x.

The square trinomial can be decomposed into linear factors by the formula:

where x 1  and x 2 -roots of a square trinomial, i.e. roots of the equation (if the equation has valid roots).

Didactic material.

Solve equations that are linear:

1. ; 2. ; 3. ;

4. ; 5. ;

6. ; 7. ;

10. ; 11. .

Solve the quadratic equations:

12. ; 13. ;

14. ; 15. ;

16. .

Factor in linear factors:

17. ; 18. ; 19. ;

20. ; 21. .

Cut fractions:

22. ; 23. ; 24. ;

25. ; 26. ; 27. .

Simplify the expression:

28. ; 29. .

Find the arithmetic mean of all real roots of the equation:

30. ; 31. ;

32. ; 33. ;

34. ; 35. ;

36. .

Find the distance from the top of the parabola to point M:

Build a function graph:

40. ; 41. ; 42. ;

43. ; 44. ; 45. ;

46. ; 47. ; 48. ;

49. ; 50. ; 51. .

52. According to the graph of a quadratic function, determine the signs of its coefficients and their sums:

Find the rational roots of the equation:

53. ; 54. ; 55. ;

56. ; 57. ; 58. ;

59. ; 60. ; 61. .

Solve the equations:

62. ; 63. ; 64. ;

65. ; 66. ; 67. ;

68. ; 69. ;

70. ; 71. ; 72. .

Theme number 3.

Degrees and roots.

Didactic material.

Calculate:

1. ; 2. ; 3. ;

4. ; 5. ; 6. ;

7. ; 8. ;

9. ; 10. ;

11. ; 12. ;

13. ; 14. ; 15. .

Add the factors under the common root sign:

16. ; 17. ; 18. .

Simplify the expressions:

19. ; 20. ; 21. ;

22. ; 23. ;

24. ; 25. ;

26. ;

27. .

The answers: 19. ; 20. x + 4; 21. 0,5; 22. -1; 23. ; 24. 1; 25. 3; 26. x - y;

Theme number 4.

Interval Method

1º. If the discriminant of the square trinomial D\u003e 0  or D \u003d 0then the square inequality   can be rewritten as   or where x 1  and x 2  - the roots of the square trinomial, and use the interval method to solve it.

2º. To solve any algebraic equations

type (1) or type (2), where x 1, x 2, ..., x n  - real numbers satisfying the condition x 1< x 2 < …< x n , a   k 1, k 2, ..., k n -natural numbers, applicable generalized interval method.

Its essence is as follows: numbers are marked on the coordinate axis x 1, x 2, ..., x nin the interval to the right of x n  put a + sign,

then, moving from right to left, when passing through another point x i  change sign if k i  is an odd number and retain the sign if k i  - even number. Then the set of solutions of inequality (1) will be the union of the intervals, in each of which the + sign is put, and the set of solutions of the inequality (2) will be the union of the intervals in each of which the - sign is put.

Comment.  The generalized interval method is also valid for entire rational inequalities P (x)\u003e 0or Q(x) ≥ 0, and for fractionally rational inequalities or, the latter being equivalent to the inequality   and system   respectively, where P (x), Q (x)  - some polynomials.

Example 11. Solve the inequality.

Solution: Find the roots of the square trinomial:

This inequality is equivalent to the following inequality:. Applying the interval method to the last inequality, we obtain the set of all solutions of the inequality - the interval [-2; 3].

Example 12. Solve the inequality .

Find the roots of the numerator and denominator:

The specified system is equivalent to the following system:

Apply the found roots to the number line. In the intervals from right to left, put the plus and minus signs.

The set of all solutions to this inequality is the union of the intervals in which the minus sign is placed.

Answer: .

Didactic material.

Solve the inequalities:

3. ; 4. .

Solve the system of inequalities:

5. ; 6. .

Find the whole solutions to the system of inequalities:

7. ; 8. .

Solve the inequalities:

9. ; 10. ; 11. ;

12. ; 13. ;

20. ; 21. ; 22. ;

23. ; 24. ;

25. ; 26. ;

27. ; 28. ; 29. ;

30. ; 31. ; 32. .

Theme number 5.

The set of function values.

1º. The set (region) of values \u200b\u200bof E (y)  the functions y \u003d f (x)  called the set of all such numbers y 0, for each of which there is a number x 0  such that f (x 0) \u003d y 0.

2º. The domain of every polynomial of even degree is the interval where m  Is the smallest value of this polynomial, or the interval where n  Is the greatest value of this polynomial.

The domain of every polynomial of odd degree is R.

3º. Value ranges of basic elementary functionsth:

Example 15. Find the set of function values \u200b\u200bif x≤1.

Solution: This function is not defined when x \u003d 0  and, therefore, is given on the set.

Consider x<0 then | x | \u003d -x  and the function takes the form   . Since for x<0 then   . Thus, over the interval, the function takes values \u200b\u200bfrom 5 to + ∞.

If x\u003e 0then | x | \u003d x  and the function has the form   . Since for, then .

Didactic material.

Solve the inequalities:

1. ; 2. ; 3. ;

4. ; 5. ; 6. ;

7. ; 8. ; 9. ;

10. ; 11. ; 12. ;

13. ; 14. ;

15. ; 16. ;

17. ; 18. .

19. At what x  points of the function graph lie above the line?

20. At what x  the graph points are not lower than the graph points of the function ?

Find the set of function values:

21. if; 22. if.

Theme number 6.

Irrational equations.

1º. Irrational  called an equation in which a variable is contained under the sign of the root.

When solving irrational equations, 2 methods are used: the method of raising to the power of both parts of the equation and the method of introducing a new variable (replacing the variable).

2º. The method of raising both sides of the equation to the same degree  consists of the following:

a) transform the given irrational equation to the form ;

b) erect both sides of the resulting equation in ndegree: ;

c) given that, they get the equation and solve it. ; ; ; 32. Solution: Since

Work in MATLAB can be done either in software  mode or in team  mode (mode calculator, dialogue  mode) according to the rule "asked a question, received an answer." This turns MATLAB into an unusually powerful calculator, which is capable of performing not only the usual calculations for a calculator, but also operations with vectors and matrices, complex numbers, series and polynomials. You can almost instantly set and display graphs of various functions: from a simple sinusoid to a complex three-dimensional figure.

The main element of the command mode of working with the system is the main or command window Command window  . It is activated by the team View \u003d\u003e Desktop Layout \u003d\u003e Command Window Only  main menu MATLAB. The structure of the command window is similar to the structure Windows  - applications (Fig. 2).

A string in the text box of the command window marked with an invitation symbol >> with a blinking cursor called input line  or command line. It is designed to enter commands, numbers, variable names, and operation signs that make up an expression from the keyboard. In order for the MATLAB system to execute the entered command or calculate the specified expression, press the key (Enter).

When you enter the cursor can be anywhere in the command line.The entered expressions are evaluated, and the results of calculations and command execution appear in one or more lines of the command window - output lines.

As a result of multiple calculations (keystrokes ) in the command window is automatically performed vertical broaching (scrolling): the lines are shifted one position up, and an input line with an invitation symbol appears at the bottom >> . Information that has left the visible part of the window does not disappear. In MATLAB, previously entered command lines represent a “history” and are stored in command stack  (see section 8).

To view the executed commands and calculation results that do not fit on the screen, there are horizontal and vertical stripes. The use of pull bands is no different from others. Windows  - applications. You can also drag the command window using the keys , , and .

Keys <>   and <↓> , which in text editors serve to move up or down the screen, in MATLAB they work differently. They are used to return previously executed commands to the input line for the purpose of their repeated execution or editing. After the first keystroke<>  the last command entered is displayed in the input line, the second-last press is displayed the second time, and so on.<↓>  Scrolls commands in the opposite direction.


In other words, the text box of the window Command window  It is located in two fundamentally different zones: viewing area  and editing area. The editing area is on the command line, and all other information of the visible part of the command window is in the viewing area.

Until the key is pressed , the expression entered can be edited or deleted. Nothing can be fixed in the viewing area. If you place the cursor in it and press any key on the keyboard, the cursor will automatically be moved to the input line located in the editing area. At the same time, using the keys<←>  and<→>  You can move the cursor on the command line.

The inability to edit a previously entered command by simply placing the cursor on the desired line is one of the features the system   MATLAB.

MATLAB session is called the session. In other words, a session is all that is displayed in the command window while working with the system. Session commands automatically form a list that appears in the window Command history, and the values \u200b\u200bof the variables are saved in the window Workspase  (fig. 1).

For example, the session in fig. 2 displays the results of sequential input of four commands. We discuss these results and note some   features of calculations in the systemMATLAB:

The result of the operation was not assigned a name, so when it was displayed, it was automatically indicated by ans  (ansver is the answer). Under this name, the result of the calculations is stored in the computer's memory and can be used in subsequent calculations until a new unnamed result is obtained during operation. The result of the calculation is displayed in output lines that do not contain an invitation sign. >> ;

\u003e\u003e a \u003d 2/3, A \u003d 2 ^ 3; cos (pi), b \u003d exp (1)

You can enter several commands on the same command line, separating them with commas or semicolons. The MATLAB system executes each command, followed by a comma, and displays the result in separate lines. The result of a command followed by a character<; \u003e, is not displayed on the screen, but it is saved in memory and can be used in subsequent calculations.

The assignment mark is the \u003d signrather than a combined character := adopted, for example, in a programming language Pascalor in the system of symbolic mathematics Maple.

After entering this command line, expression values \u200b\u200bare calculated and stored in memory a \u003d 2/3 \u003d 0, b667, A \u003d 2 3 \u003d 8, ans \u003d cosp \u003d -1, b \u003d e 1 \u003d e \u003d 2.7183 (e -  base of the natural logarithm). Variable value A, Unlike a, ans, bis not displayed due to the symbol<; \u003e. When calculating cospsystem variable used pi -  number p. Number e  is not a system variable, and a built-in elementary function is used to calculate it exp (1). Functions are written in lowercase letters, and their arguments are indicated in parentheses. Argument of the built-in trigonometric function cos  given in radians;

\u003e\u003e disp (A / 2 + ans)

Command disp  (from the word "display") computes the expression 2 3 /2+cosp  and displays the answer, but does not assign it to a variable ansas in normal calculations:

Further disp  used to prevent extra line output ans \u003d  in visual documents;

\u003e\u003e c \u003d .5 + 3-11 + ...

Sometimes you need to enter in the window Command window A command that is too long to fit on one line. As you approach the end of the line, you can enter   (three consecutive points), press the key and continue typing the command on the next line. However, you will not see an invitation symbol on a new line >> .

The session in Fig. 2 contains only the correct commands and the results of their execution. In general, a session is the result of trial and error. Its text, along with the correct definitions, contains messages and warnings about errors (see section 8), overrides of functions and variables, used help information of the command help. If the session is “clogged” with excess information, the user’s dialogue with the system becomes more difficult.

Screen Cleanup Command clc

This command, however, leaves the contents of the windows unchanged. Command history  and Workspase. Therefore, in a “clean” command window, you can use the values \u200b\u200bof the variables obtained before entering the command clc.

If it becomes necessary to edit or repeat a previously executed command, this is easily done using the window Command history. More work with windows Command history  and Workspase  discussed in sections 8 and 9.

VariablesAre named objects that store any data.

Variables can be numeric, matrix, or symbolic, depending on the type of data stored in them. Variable types are not declared in advance. They are determined by the expression whose value is assigned to the variable, i.e. the user does not have to worry about what values \u200b\u200bthe variable will take (complex, real or integer).

Variable name  (her identifier) may contain up to 31   symbol and must not coincide with the names of other variables, functions, commands and MATLAB system variables. The variable name must begin with a letter, may contain numbers and an underscore .   MATLAB is case-sensitive (variables a  and A  not identical).

There are several variable names in MATLAB that are reserved. Variables with these names are called systemic. They are set after the system boots and can be used in arithmetic expressions. System variables can be overridden, that is, if necessary, they can be assigned other values.

The following are the main MATLAB system variables:

ans  - the result of calculating the last expression not saved by the user;

i, j  - imaginary unit () used to specify the imaginary part of complex numbers;

Inf  (infinity) - designation of machine infinity;

NaN - an abbreviation of the words Not-a-Number (not a number), adopted to indicate an indefinite result (for example, 0/0 or Inf / Inf).

pi  Is the number π (   p \u003d 3,141592653589793);

eps  - the error of operations on floating-point numbers, i.e. the interval between the number 1.0   and the next closest floating point number is 2.2204e-16  or 2 -52 ;

realmin  Is the smallest modulo real number ( 2.2251e-308  or 2 -1022 );

realmax  Is the largest modulo real number ( 1.7977e + 308  or 2 1023 ).

Priorities arithmetic operations  MATLAB systems in descending order are as follows:

1. Extinction<^ >.

2. Multiplication<* \u003e and division (from left to right</ \u003e, from right to left<\ >).

3. Addition<+>  and subtraction<–>.

The operations of the same priority occur in order from left to right. To change the order of arithmetic operators, parentheses should be used. In addition to arithmetic operators, MATLAB has relation operators and logical operators.

A complete list of operators and reference information on any of them can be obtained in the section ops  MATLAB help using commands helpor doc.

Most calculations are based on value calculations. arithmetic expressions. In them, operands can be constants, variables, or functions. Unlike most algorithmic languages, MATLAB allows the use of operands - arrays (see sections 6, 7, 10). In this case, the result of evaluating the expression can also be an array.

Expressions Concluded Between Two Apostrophes<′ ′ > are treated as lowercase and are not calculated, even if they contain mathematical expressions. Most often they are used to set parameters of functions and their non-numeric values, insert text into graphic objects, and also to describe symbolic variables and expressions. So, line input "2+3"   leads to the result

but not 5 .

When plotting graphs, the characters placed between the apostrophes determine the color of the graph lines, their type and the type of marker with which the lines are labeled.

Mathematical-Calculator-Online v.1.0

The calculator performs the following operations: addition, subtraction, multiplication, division, decimal work, root extraction, exponentiation, percent calculation, and other operations.


Decision:

How to work with a math calculator

   Key    Designation    Explanation
5    digits 0-9    Arabic numerals. Entering natural integers, zero. To get a negative integer, press the +/- key
.    semicolon) Decimal separator. If there is no digit in front of the dot (semicolon), the calculator will automatically insert zero in front of the dot. For example: .5 - 0.5 will be written
+    plus sign    Addition of numbers (integers, decimal fractions)
-    minus sign    Subtraction of numbers (integers, decimal fractions)
÷    division sign    Division of numbers (integers, decimal fractions)
   x    multiplication sign    Multiplication of numbers (integers, decimal fractions)
   root    Extracting a root from a number. When you press the "root" button again, the root is calculated from the result. For example: root of 16 \u003d 4; root of 4 \u003d 2
   x 2    squaring    Squaring a number. When the “squaring” button is pressed again, the result is squared; For example: square 2 \u003d 4; square 4 \u003d 16
   1 / x    fraction    Output to decimal fractions. In numerator 1, in the denominator, the input number
%    percent    Getting a percentage of the number. To work, you must enter: the number from which the percentage will be calculated, the sign (plus, minus, divide, multiply), how many percent in numerical form, the "%" button
(    open bracket    An open bracket to set the priority of the calculation. Must have a closed parenthesis. Example: (2 + 3) * 2 \u003d 10
)    closed bracket    Closed parenthesis to set the priority of the calculation. Must have an open bracket
±    plus minus    Change the sign to the opposite
=    equally    Displays the result of the solution. Also, above the calculator, in the "Solution" field, intermediate calculations and the result are displayed.
   character deletion    Deletes the last character
   FROM    discharge    Reset button. Completely resets the calculator to position "0"

The algorithm of the online calculator with examples

Addition.

Addition of integer natural numbers (5 + 7 \u003d 12)

Addition of integer natural and negative numbers (5 + (-2) \u003d 3)

Addition of decimal fractional numbers (0.3 + 5.2 \u003d 5.5)

Subtraction.

Subtraction of integers (7 - 5 \u003d 2)

Subtraction of integers natural and negative numbers (5 - (-2) \u003d 7)

Subtraction of decimal fractional numbers (6.5 - 1.2 \u003d 4.3)

Multiplication.

The product of integer natural numbers (3 * 7 \u003d 21)

The product of integer natural and negative numbers (5 * (-3) \u003d -15)

Product of decimal fractional numbers (0.5 * 0.6 \u003d 0.3)

Division.

Division of integer natural numbers (27/3 \u003d 9)

Division of integer natural and negative numbers (15 / (-3) \u003d -5)

Division of decimal fractional numbers (6.2 / 2 \u003d 3.1)

Extracting a root from a number.

Extracting a root from an integer (root (9) \u003d 3)

Extracting the root from decimal fractions (root (2.5) \u003d 1.58)

Extracting the root from the sum of numbers (root (56 + 25) \u003d 9)

Extracting the root from the difference of numbers (root (32 - 7) \u003d 5)

Squaring a number.

Squaring an integer ((3) 2 \u003d 9)

Squaring decimal fractions ((2,2) 2 \u003d 4.84)

Decimal conversion.

Calculation of percent of the number

Increase by 15% the number 230 (230 + 230 * 0.15 \u003d 264.5)

Reduce by 5% the number 510 (510 - 510 * 0.35 \u003d 331.5)

18% of the number 140 is (140 * 0.18 \u003d 25.2)

Since ancient times, work with numbers has been divided into two different areas: one directly related to the properties of numbers, the other was related to counting technique. By "arithmetic" in many countries this is usually meant in this last area, which is undoubtedly the oldest branch of mathematics.

Apparently, the greatest difficulty among the ancient calculators was the work with fractions. This can be judged by the papyrus of Ahmes (also called the papyrus of Rind), an ancient Egyptian essay on mathematics dating to about 1650 BC. All fractions mentioned in papyrus, with the exception of 2/3, have numerators equal to 1. The difficulty in handling fractions is also noticeable in the study of ancient Babylonian cuneiform tablets. Both the ancient Egyptians and the Babylonians apparently performed calculations using some kind of abacus. The science of numbers received significant development among the ancient Greeks starting from Pythagoras, around 530 BC. As for the calculation technique itself, much less has been done by the Greeks in this area.

The Romans who lived later, on the contrary, made practically no contribution to the science of numbers, but based on the needs of rapidly developing production and trade, they improved the abacus as a counting device. Very little is known about the origin of Indian arithmetic. Only a few later works on the theory and practice of operations with numbers, written after the Indian positional system was improved by including zero in it, have reached us. When exactly this happened, we do not know for sure, but it was then that the foundations for our most common arithmetic algorithms were laid.

The Indian number system and the first arithmetic algorithms were borrowed by the Arabs. The earliest Arabic textbook of arithmetic that has come down to us was written by al-Khwarizmi around 825. Indian numbers are widely used and explained in it. Later, this textbook was translated into Latin and had a significant impact on Western Europe. The distorted version of the name al-Khwarizmi came to us in the word "algorithm", which, when further mixed with the Greek word arrhythmos  turned into the term "algorithm."

Indo-Arab arithmetic became known in Western Europe mainly due to the work of L. Fibonacci Abacus book (Liber abaci, 1202). The Abacist method offered simplifications similar to using our positional system, at least for addition and multiplication. Abacists were replaced by algorithms that used the zero and the Arabic method of dividing and extracting the square root. One of the first arithmetic textbooks, the author of which is unknown to us, was published in Treviso (Italy) in 1478. It dealt with calculations when making trade transactions. This textbook became the forerunner of many later arithmetic textbooks. Until the beginning of the 17th century more than three hundred such textbooks have been published in Europe. Arithmetic algorithms during this time were significantly improved. In the 16-17 centuries. symbols of arithmetic operations appeared, such as \u003d, +, -, ґ, ё and.

The mechanization of arithmetic calculations.

With the development of society, the need for faster and more accurate calculations grew. This need brought forth four remarkable inventions: Indo-Arabic numerals, decimals, logarithms, and modern computers.

In fact, the simplest counting devices existed before the advent of modern arithmetic, because in ancient times elementary arithmetic operations were performed on an abacus (in Russia scores were used for this purpose). The simplest modern computing device can be considered a slide rule, which is two sliding logarithmic scales, one along the other, which allows multiplication and division, summing and subtracting segments of scales. The inventor of the first mechanical summing machine is considered to be B. Pascal (1642). Later in the same century, G. Leibniz (1671) in Germany and S. Morland (1673) in England invented machines for multiplication. These machines became the forerunners of desktop computers (arithmometers) of the 20th century, which made it possible to quickly and accurately perform addition, subtraction, multiplication, and division operations.

In 1812, the English mathematician C. Babbage began to design a machine for calculating mathematical tables. Although work on the project continued for many years, it remained incomplete. Nevertheless, the Babbage project stimulated the creation of modern electronic computers, the first samples of which appeared around 1944. The speed of these machines was amazing: they could be used to solve problems that took several years or more to complete before, even using arithmometers.

Positive integers.

Let be A  and B  Are two finite sets that do not have common elements, and let A  contains n  elements, and B  contains m  elements. Then the set Sconsisting of all elements of sets A  and Btaken together is a finite set containing, say, s  elements. For example, if A  consists of elements ( a, b, c), a bunch of IN  - from elements ( x, y), then the set S \u003d A + B  and consists of elements ( a, b, c, x, y) Number s  called amount  numbers n  and m, and we write it like this: s \u003d n + m. There are numbers in this entry. n  and m  are called terms, the operation of finding the amount is addition. The operation symbol “+” is read as “plus”. A bunch of Pconsisting of all ordered pairs in which the first element is selected from the set Aand the second from the set Bis a finite set containing, say, p  elements. For example, if, as before, A = {a, b, c}, B = {x, y) then P \u003d aґB = {(a,x), (a,y), (b,x), (b,y), (c,x), (c,y)). Number p  called work  numbers a  and b, and we write it like this: p \u003d aґb  or p \u003d a × b. The numbers a  and b  in the work are called factors, the operation of finding the product - multiplication. The operation symbol ґ reads as “times”.

It can be shown that the following fundamental laws of addition and multiplication of integers follow from these definitions:

- the law of commutability of addition: a + b \u003d b + a;

- the law of addition associativity: a + (b + c) = (a + b) + c;

- the law of commutability of multiplication: aґb \u003d bґa;

- the law of associativity of multiplication: aґ(bґc) = (aґbc;

- distribution law: aґ(b + c)= (aґb) + (aґc).

If a  and b  Are two positive integers and if there is a positive integer csuch that a \u003d b + cthen we say that a  more b  (this is written like this: a\u003e b), or what b  smaller a  (this is written like this: b) For any two numbers a  and b  one of three relations holds: either a \u003d beither a\u003e beither a.

The first two fundamental laws indicate that the sum of two or more terms does not depend on how they are grouped and in what order they are located. Similarly, from the third and fourth laws it follows that the product of two or more factors does not depend on how the factors are grouped and what their order is. These facts are known as the “generalized laws of commutativity and associativity” of addition and multiplication. It follows from them that when writing the sum of several terms or the product of several factors, the order of the terms and factors is not significant and you can omit the brackets.

In particular, the repeated amount a + a + ... + a  of n  terms equal nґa. Repeated work aґaґ ... ґa  of n  multipliers agreed to denote a n; number a  called reason, and the number nreproduction rate, the repeated work itself is n degree  the numbers a. These definitions make it possible to establish the following fundamental laws for exponents:

Another important consequence of the definitions: aґ1 = a  for any integer a, and 1 is the only integer possessing this property. The number 1 is called unit.

Divisors of integers.

If a, b, c  Are integers and aґb \u003d cthen a  and b  are divisors of a number c. Because aґ1 = a  for any integer a, we conclude that 1 is the divisor of any integer and that any integer is a divisor of itself. Any integer divisor aother than 1 or agot the name own divisor  the numbers a.

Any integer other than 1 and not having its own divisors is called prime number. (An example is a prime number 7.) An integer that has its own divisors is called compound number. (For example, the number 6 is composite, since 2 divides 6.) From what has been said, the set of all integers is subdivided into three classes: unit, prime numbers and compound numbers.

In number theory, there is a very important theorem that states that "any integer can be represented as a product of primes, and up to the order of factors such a representation is unique." This theorem is known as the "main theorem of arithmetic." It shows that prime numbers serve as the “building blocks” from which, using multiplication, all integers other than unity can be built.

If a certain set of integers is given, then the largest integer that is a divisor of each number included in this set is called greatest common factor  a given set of numbers; the smallest integer whose divisor is each number from a given set is called least common multiple  given set of numbers. So, the greatest common factor of 12, 18, and 30 is 6. The least common factor of the same numbers is 180. If the greatest common factor of two integers a  and b  equal to 1, then the numbers a  and b  are called mutually simple. For example, the numbers 8 and 9 are coprime, although not one of them is prime.

Positive rational numbers.

As we have seen, integers are abstractions arising from the process of recounting finite sets of objects. However, integers are not enough for the needs of everyday life. For example, when measuring the length of the tabletop, the accepted unit of measurement may turn out to be too large and may not fit an integer number of times in the measured length. To cope with this difficulty, with the help of the so-called fractional  (ie, literally “broken”) numbers, a smaller unit of length is introduced. If d  Is some integer, then the fractional unit is 1 / d  determined by property dґ1/d  \u003d 1, and if n  Is an integer then nґ1/d  we write just like n/d. Such new numbers are called "ordinary" or "simple" fractions. Integer n  called numerator  fractions, and the number ddenominator. The denominator shows how many equal shares the unit was divided, and the numerator shows how many such shares were taken. If n  d, the fraction is called correct; if n \u003d d  or n\u003e dthen wrong. Integers are treated as fractions with a denominator of 1; for example, 2 \u003d 2/1.

Since the fraction n/d  can be interpreted as the result of division n  units per d  equal shares and taking one of such shares, a fraction can be considered as a “quotient” or “ratio” of two integers n  and d, and the line of fraction to understand as a sign of division. Therefore, fractions (including integers as a special case of fractions) are usually called rational  numbers (from lat. ratio - relation).

Two fractions n/d  and ( kґn)/(kґd) where k  - an integer, can be considered as equal; e.g. 4/6 \u003d 2/3. (Here n = 2, d  \u003d 3 and k  \u003d 2.) This fact is known as the “main property of a fraction”: the value of any fraction will not change if the numerator and denominator of the fraction are multiplied (or divided) by the same number. It follows that any fraction can be written as the ratio of two mutually prime numbers.

It also follows from the interpretation of the fraction proposed above that, as the sum of two fractions n/d  and m/dhaving the same denominator, you should take a fraction ( n + m)/d. When adding fractions with different denominators, you must first convert them, using the main property of the fraction, into equivalent fractions with the same (common) denominator. For instance, n 1 /d 1 = (n  1 h d 2)/(d  1 h d  2) and n 2 /d 2 = (n  2 h d 1)/(d  1 h d  2) where

One could act differently and first find the smallest common multiple, say, mdenominators d  1 and d  2. Then there are integers k  1 and k  2 such that m \u003d k  1 h d 1   \u003d k  2 h d  2, and we get:

With this method, the number m  commonly called least common denominator  two fractions. These two results are equivalent by the definition of equality of fractions.

The product of two fractions n 1 /d  1 and n 2 /d  2 is taken equal to the fraction ( n  1 h n 2)/(d  1 h d 2).

The eight fundamental laws given above for integers are also valid if a, b, c  understand arbitrary positive rational numbers. In addition, if two positive rational numbers are given n 1 /d  1 and n 2 /d  2, then we say that n 1 /d 1 > n 2 /d  2 if and only if n  1 h d 2 > n  2 h d 1 .

Positive real numbers.

The use of numbers to measure the lengths of line segments suggests that for any two given line segments Ab  and CD  some segment must exist UVpossibly very small, which could be delayed an integer number of times in each of the segments Aband CD. If such a common unit of length UV  exists then segments Ab  and CD  are called commensurate. Already in antiquity, the Pythagoreans knew about the existence of incommensurable segments of straight lines. A classic example is the side of a square and its diagonal. If we take the side of the square as a unit of length, then there is no rational number that could be a measure of the diagonal of this square. You can verify this by reasoning from the contrary. Indeed, suppose that a rational number n/d  there is a measure of the diagonal. But then segment 1 / d  could be postponed n  times on the diagonal and d times on the side of the square, contrary to the fact that the diagonal and side of the square are incommensurable. Therefore, regardless of the choice of unit of length, not all line segments have lengths expressed by rational numbers. So that all line segments can be measured using a certain unit of length, the number system should be expanded so that it includes numbers representing the results of measuring the lengths of line segments incommensurable with the selected unit of length. These new numbers are called positive. irrational  by numbers. The latter, together with positive rational numbers, form a wider set of numbers, the elements of which are called positive valid  by numbers.

If OR  - horizontal half-line, starting from a point O, U  - point on ORdifferent from the origin O, and OU  selected as a unit line, then each point P  half straight OR  can be associated with a single positive real number pexpressing the length of the segment OP. Thus, we establish a one-to-one correspondence between positive real numbers and points other than Oon the half straight OR. If p  and q  - two positive real numbers corresponding to points P  and Q  on the ORthen we write p\u003e q,  p \u003d q  or p depending on the point P  to the right of the point Q  on the ORcoincides with Q  or located to the left of Q.

The introduction of positive irrational numbers has significantly expanded the scope of arithmetic. For example, if a  - any positive real number and n  - any integer, then there is a single positive real number bsuch that b n \u003d a. This number b  called root ndegree of a  and is written as where the symbol in its outlines resembles a Latin letter rwith which the latin word begins radix  (root) is called radical. It can be shown that

These relationships are known as the basic properties of radicals.

From a practical point of view, it is very important that any positive irrational number can be approximated arbitrarily accurately by a positive rational number. This means that if r  - positive irrational number and e  Is an arbitrarily small positive rational number, then one can find positive rational numbers a  and bsuch that a and b. For example, the number is irrational. If you choose e  \u003d 0.01, then; if you choose e  \u003d 0.001 then.

Indo-Arab numeral system.

Algorithms, or calculation schemes, arithmetic depend on the number system used. It is quite obvious, for example, that the calculation methods invented for the Roman numeral system may differ from the algorithms invented for the current Indo-Arab system. Moreover, some number systems may be completely unsuitable for constructing arithmetic algorithms. Historical evidence suggests that prior to the adoption of the Indo-Arab numeric notation system, there were no algorithms at all that made it possible to easily add, subtract, multiply and divide numbers using “pencil and paper”. Over the long years of the existence of the Indo-Arab system, numerous algorithmic procedures specially adapted for it have been developed, so that our modern algorithms are the product of a whole era of development and improvement.

In the Indo-Arabic numeral system, each entry denoting a number is a set of ten basic characters 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, called numbers. For example, the Indo-Arabic designation of the number four hundred twenty-three has the form of a sequence of digits 423. The meaning of a digit in the Indo-Arabic notation of a number is determined by its place, or position, in the sequence of digits that make up this entry. In our example, the number 4 means four hundred, the number 2 - two dozen and the number 3 - three units. A very important role is played by the digit 0 (zero), used to fill in empty positions; for example, the entry 403 means the number four hundred and three, i.e. dozens are missing. If a, b, c, d, e  mean single numbers then in the indo-arabic system abcde  means abbreviated notation integer

Since each integer allows a single representation in the form

where n  Is an integer, and a 0 , a 1 ,..., a n  - digits, we conclude that in this number system each integer can be represented in a unique way.

The Indo-Arab numeral system allows you to compactly record not only integers, but also any positive real numbers. We introduce the notation 10 - n  for 1/10   nwhere n  Is an arbitrary positive integer. Then, as can be shown, any positive real number is representable, and uniquely, in the form

This record can be compressed by writing as a sequence of numbers

where is the decimal point between a  0 and b 1 indicates where the negative powers of 10 begin (in some countries a period is used for this purpose). This method of writing a positive real number is called the decimal decomposition, and the fraction represented as its decimal decomposition is called decimal.

It can be shown that for a positive rational number, the decimal expansion after the decimal point either breaks off (for example, 7/4 \u003d 1.75) or repeats (for example, 6577/1980 \u003d 3.32171717 ...). If the number is irrational, then its decimal decomposition does not break off and does not repeat. If the decimal expansion of the irrational number on some decimal place is cut off, we get its rational approximation. The further to the right of the decimal place the sign is located on which we cut off the decimal expansion, the better the rational approximation (the smaller the error).

In the Indo-Arabian system, a number is recorded using ten basic digits, the value of which depends on their place or position, in the number record (the value of a digit is equal to the product of the digit by some power of 10). Therefore, such a system is called a decimal positional system. Positional number systems are very convenient for building arithmetic algorithms, and this explains the widespread use of the Indo-Arabic number system in the modern world, although different symbols can be used to designate individual numbers in different countries.

Names of numbers.

Names of numbers in the Indo-Arabic system are built according to certain rules. The most common way to name numbers is to first divide the number into groups of three digits from right to left. These groups are called "periods." The first period is called the period of "units", the second - the period of "thousands", the third - the period of "millions", etc., as shown in the following example:

Each period is read as if it were a three-digit number. For example, period 962 reads as “nine hundred and sixty-two.” To read a number consisting of several periods, a group of numbers in each period is read, starting from the leftmost and then in order from left to right; after each group is the name of the period. For example, the above number reads as “seventy three trillion eight hundred forty two billion nine hundred sixty two million five hundred thirty two thousand seven hundred and ninety eight.” Note that when reading and writing integers, the union “and” is usually not used. The name of the category of units is omitted. Trillions are followed by quadrillion, quintillion, sextillion, septillion, octillion, nonillion, decillion. Each period has a value 1000 times the value of the previous one.

In the Indo-Arabic system, it is customary to adhere to the following procedure for reading the numbers to the right of the decimal point. Here the positions are called (in order from left to right): “tenths”, “hundredths”, “thousandths”, “ten thousandths”, etc. The correct decimal fraction is read as if the digits after the decimal point form an integer, after which the position name of the last digit on the right is added. For example, 0.752 reads as "seven hundred and fifty-two thousandths." A mixed decimal number is read by combining the rule for naming integers with the rule for naming regular decimal fractions. For example, 632,752 reads as "six hundred thirty two point seven hundred fifty two thousandths." Note the word "integers" pronounced before the decimal point. In recent years, decimal numbers are increasingly read more simply, for example, 3,782 as "three comma seven hundred eighty two."

Addition.

Now we are ready to analyze the arithmetic algorithms that we are introduced to in elementary school. These algorithms relate to operations on positive real numbers written as decimal expansions. We assume that the elementary tables of addition and multiplication are memorized.

Consider the addition problem: calculate 279.8 + 5.632 + 27.54:

First, we summarize the same powers of 10. The number 19 × 10 –1 is divided according to the distribution law into 9 × 10 –1 and 10 × 10 –1 \u003d 1. We move the unit to the left and add to 21, which gives 22. In turn, we divide the number 22 into 2 and 20 \u003d 2 × 10. The number 2CH10 is moved to the left and added to 9CH10, which gives 11CH10. Finally, we divide 11 × 10 into 1 × 10 and 10 × 10 \u003d 1 × 10 2, transfer 1 × 10 2 to the left and add to 2 × 10 2, which gives 3 × 10 2. The final amount is 312,972.

It is clear that the calculations performed can be presented in a more concise form, at the same time using it as an example of the addition algorithm taught in school. To do this, we write out all three numbers one below the other so that the decimal points are on the same vertical:

Starting on the right, we find that the sum of the coefficients at 10 –3 is 2, which we write in the corresponding column under the line. The sum of the coefficients at 10 –2 is 7, which is also written in the corresponding column under the line. The sum of the coefficients at 10 –1 is 19. We write the number 9 under the line, and transfer 1 to the previous column, where there are units. Given this unit, the sum of the coefficient in this column turns out to be 22. We write one deuce under the line, and transfer the other to the previous column, where there are tens. Taking into account the transferred two, the sum of the coefficients in this column is 11. We write one unit under the line, and transfer the other to the previous column, where there are hundreds. The sum of the coefficients in this column is equal to 3, which is written below the line. The required amount is 312,972.

Subtraction.

Subtraction is the opposite of addition. If three positive real numbers a, b, cinterconnected so that a + b \u003d cthen we write a \u003d c - b, where the symbol “-” is read as “minus”. Finding a number a  by known numbers b  and c  called "subtraction." Number ccalled decrementable, the number b  - “deductible”, and the number a  - “the difference.” Since we are dealing with positive real numbers, the condition c\u003e b.

Consider the subtraction example: calculate 453.87 - 82.94.

First of all, borrowing the unit to the left if necessary, we transform the decomposition of the decremented one so that its coefficient for any power of 10 is greater than the coefficient subtracted for the same power. From 4 × 10 2 we borrow 1 × 10 2 \u003d 10 × 10, adding the last number to the next term of the expansion, which gives 15 × 10; similarly, we borrow 1 × 10 0, or 10 × 10 –1, and add this number to the penultimate term of the expansion. After that, we get the opportunity to subtract the coefficients for the same powers of 10 and easily find the difference 370.93.

The record of subtraction operations can be presented in a more concise form and get an example of the subtraction algorithm studied at school. We write the deductible under the decremented so that their decimal points are on the same vertical. Starting on the right, we find that the difference in the coefficients at 10 –2 is 3, and we write this number in the same column under the line. Since in the next column on the left we cannot subtract 9 from 8, we change the three in the position of the units to be reduced by two and consider the number 8 in the tenth position as 18. After subtracting 9 from 18 we get 9, etc., i.e. .

Multiplication.

Consider first the so-called “Short” multiplication is the multiplication of a positive real number by one of the single-digit numbers 1, 2, 3, 4, 5, 6, 7, 8, 9, for example, 32.67ґ4. Using the law of distributivity, as well as the laws of associativity and commutativity of multiplication, we get the opportunity to split the factors into parts and arrange them in a more convenient way. For instance,

These calculations can be written more compactly as follows:

The compression process can continue. Write the factor of 4 under the multiplier of 32.67, as indicated:

Since 4ґ7 \u003d 28, we write the number 8 under the bar, and 2 we place the multiplicative over the number 6. Further, 4ґ6 \u003d 24, which, taking into account the transferred from the column on the right, gives 26. We write number 6 under the bar, and 2 we write over the number 2 of the multiplier. Then we get 4ґ2 \u003d 8, which, in combination with the transferred two, gives 10. We sign the number 0 under the bar, and the unit over the number 3 of the multiplier. Finally, 4ґ3 \u003d 12, which, given the transferred unit, gives 13; the number 13 is written under the line. Putting a decimal point, we get the answer: the product is 130.68.

A “long” multiplication is simply a repeated “short” multiplication. Consider, for example, multiplying 32.67 by 72.4. Place the multiplier under the multiplier, as indicated:

Performing a short multiplication from right to left, we get the first partial product of 13.068, the second - 65.34 and the third - 2286.9. According to the law of distributivity, the work to be found is the sum of these private works, or 2365,308. In the written record, the decimal point in private works is omitted, but they must be correctly positioned with “steps” in order to then add up and get the complete work. The number of decimal places in the product is equal to the sum of the number of decimal places in the multiplier and factor.

Division.

Division is the opposite of multiplication; just as multiplication replaces repeatedly repeated addition, division replaces repeatedly repeated subtraction. Consider, for example, the following question: how many times is 3 contained in 14? Repeating the operation of subtracting 3 from 14, we find that 3 “enters” 14 four times, and the number 2 “remains”, ie

The number 14 is called divisible, number 3 - divider, number 4 - private  and the number 2 is the remainder. In words, the resulting ratio can be expressed as follows:

dividend \u003d (divisor ґ quotient) + remainder,

0 Ј remainder

To find the quotient and the remainder of dividing 1400 by 3 by repeatedly subtracting 3, it would take a lot of time and labor. The procedure could be significantly accelerated by first subtracting from 1400 by 300, then from the remainder by 30, and finally by 3. After quadrupling the subtraction of 300, we would get a remainder of 200; after subtracting six times from 200 the number 30, the remainder would be equal to 20; finally, after subtracting six times from 20 of the number 3, we get the remainder 2. Therefore

The quotient and the remainder that were required to be found are equal, respectively, to 466 and 2. The calculations can be organized and then subsequently subjected to compression as follows:

The above reasoning is applicable if the dividend and divisor are any positive real numbers expressed in decimal system. We illustrate this with the example of 817.65ё23.7.

First, the divider must be converted to a whole number using a decimal point shift. In this case, the decimal point of the dividend is shifted by the same number of decimal places. The divisor and dividend are arranged as shown below:

We determine how many times the divisor is contained in the three-digit number 817, the first part of the dividend, which we divide by the divisor. Since it is estimated that it is contained three times, we multiply 237 by 3 and subtract the product of 711 from 817. The difference 106 is less than the divisor. This means that the number 237 is included in the trial dividend no more than three times. The number 3, written under the number 2 divider below the horizontal line, is the first digit of the quotient to be found. After we take down the next digit of the dividend, we get the next trial dividend 1066, and we need to determine how many times the divisor 237 fits into the number 1066; suppose 4 times. We multiply the divisor by 4 and get the product 948, which is subtracted from 1066; the difference turns out to be 118, which means that the next digit of the quotient is 4. Then we take down the next digit of the dividend and repeat the whole procedure described above. This time, it turns out that the trial dividend 1185 is exactly (without remainder) divided by 237 (the remainder of the division finally turns out to be 0). Having separated the decimal point in the quotient as many digits as are separated in the divisible (recall that we previously transferred the decimal point), we get the answer: the quotient is 34.5.

Fractions.

Fraction calculations include addition, subtraction, multiplication, and division, as well as simplification of complex fractions.

The addition of fractions with the same denominator is done by adding the numerators, for example,

1/16 + 5/16 + 7/16 = (1 + 5 + 7)/16 = 13/16.

If fractions have different denominators, then they must first be reduced to a common denominator, i.e. turn into fractions with the same denominators. To do this, we find the smallest common denominator (the smallest number multiple of each of these denominators). For example, when adding 2/3, 1/6 and 3/5, the smallest common denominator is 30:

Summing up, we get

20/30 + 5/30 + 18/30 = 43/30.

Subtraction of fractions is the same as their addition. If the denominators are the same, then subtraction reduces to subtracting the numerators: 10/13 - 2/13 \u003d 8/13; if fractions have different denominators, then first you need to bring them to a common denominator:

7/8 – 3/4 = 7/8 – 6/8 = (7 – 6)/8 = 1/8.

When fractions are multiplied, their numerators and denominators are multiplied separately. For instance,

5/6ґ4/9 = 20/54 = 10/27.

To divide one fraction into another, it is necessary to multiply the first fraction (divisible) by the fraction inverse to the second (divisor) (in order to get the inverse fraction, you need to swap the numerator and denominator of the original fraction), i.e. ( n 1 /d  1) ё ( n 2 /d 2) = (n  1 h d 2)/(d  1 h n  2). For instance,

3 / 4ё7 / 8 \u003d 3 / 4ґ8 / 7 \u003d 24/28 \u003d 6/7.

A mixed number is the sum (or difference) of an integer and a fraction, for example, 4 + 2/3 or 10 - 1/8. Since an integer can be considered as a fraction with a denominator equal to 1, a mixed number is nothing but the sum (or difference) of two fractions. For instance,

4 + 2/3 = 4/1 + 2/3 = 12/3 + 2/3 = 14/3.

A complex is called a fraction that has a fraction either in the numerator, or in the denominator, or in the numerator and denominator. Such a fraction can be turned into a simple one:

Square root.

If n rsuch that r 2 = n. Number   r  called square root  of n  and is indicated. The school is taught to extract square roots in two ways.

The first method is more popular because it is simpler and easier to apply; calculations by this method are easily implemented on a desktop calculator and generalized to the case of cubic roots and roots of a higher degree. The method is based on the fact that if r  1 - approaching the root, then r 2 = (1/2)(r 1 + n/r  1) - a more accurate approximation of the root.

We illustrate the procedure by calculating the square root of a number between 1 and 100, say, the number 40. Since 6 2 \u003d 36, and 7 2 \u003d 49, we conclude that 6 is the best approximation to in integers. A more accurate approximation to is obtained from 6 as follows. Dividing 40 by 6, we get 6.6 (with rounding to the first decimal place) even  tenths). To get the second approximation to, average two numbers 6 and 6.6 and get 6.3. Repeating the procedure, we get an even better approximation. Dividing 40 by 6.3, we find the number 6.350, and the third approximation is equal to (1/2) (6.3 + 6.350) \u003d 6.325. Another repetition gives 40ё6.325 \u003d 6.3241106, and the fourth approximation turns out to be equal to (1/2) (6.325 + 6.3241106) \u003d 6.3245553. The process can continue as long as you like. In the general case, each subsequent approximation may contain twice as many digits as the previous one. So, in our example, since the first approximation, the integer 6, contains only one digit, we can keep two signs in the second approximation, in the third - four and in the fourth - eight.

If the number n  does not lie between 1 and 100, then it should be previously divided (or multiplied) n  by some power of 100, say, on kso that the product is in the range from 1 to 100. Then the square root of the product will be in the range from 1 to 10, and after it is extracted, we, multiplying (or dividing) the resulting number by 10   k, we find the desired square root. For example, if n  \u003d 400000, then we first share 400000 per 100 2 and we get the number 40 lying in the range from 1 to 100. As shown above, it is approximately 6.3245553. Multiplying  this number is 10 2, we get 632.45553 as an approximate value for, and the number 0.63245553 serves as an approximate value for.

The second of the above procedures is based on algebraic identity ( a + b) 2 = a 2 + (2a + b)b. At each step, the part of the square root already obtained is taken as a, and the part that still needs to be determined is for b.

Cubic root.

To extract the cubic root from a positive real number, there are algorithms similar to the square root extraction algorithms. For example, to find the cube root of a number n, first we approximate the root by some number r  1 . Then we build a more accurate approximation r 2 = (1/3)(2r 1 + n/r  1 2), which in turn gives way to an even more accurate approximation r 3 = (1/3)(2r 2 + n/r  2 2) etc. The procedure for constructing ever more accurate approximations of the root can continue as long as you like.

Consider, for example, calculating the cubic root of a number between 1 and 1000, say, the number 200. Since 5 3 \u003d 125 and 6 3 \u003d 216, we conclude that 6 is the integer closest to the cubic root of 200. Therefore, we choose r  1 \u003d 6 and sequentially calculate r 2 = 5,9, r 3 = 5,85, r  4 \u003d 5.8480. In each approximation, starting from the third, it is allowed to keep the number of characters, which is one less than twice the number of characters in the previous approximation. If the number from which the cubic root is to be extracted is not between 1 and 1000, then it must first be divided (or multiplied) by some, say, k-th, the degree of the number 1000 and thereby bring in the desired range of numbers. The cubic root of the newly obtained number lies in the range from 1 to 10. After it is calculated, it must be multiplied (or divided) by 10   kto get the cubic root of the original number.

The second, more complex, algorithm for finding the cubic root of a positive real number is based on the use of algebraic identity ( a + b) 3 = a 3 + (3a 2 + 3ab + b 2)b. Currently, algorithms for extracting cubic roots, as well as roots of higher degrees, are not studied in high school, since they are easier to find using logarithms or algebraic methods.

Euclidean Algorithm.

This algorithm was described in Beginnings Euclid (c. 300 BC). With it, the greatest common divisor of two integers is calculated. For the case of positive numbers, it is formulated as a procedural rule: “Divide the larger of the two numbers by the smaller. Then divide the divisor by the remainder of the division and continue to do the same until the last divisor is completely divided by the last remainder. The last of the divisors will be the greatest common divisor of the two given numbers. "

As a numerical example, consider two integers 3132 and 7200. The algorithm in this case is reduced to the following actions:

The largest common factor is the last factor, the number 36. The explanation is simple. In our example, we see from the last line that the number 36 divides the number 288. From the penultimate line it follows that the number 36 divides 324. So, moving from line to line up, we see that the number 36 divides 936, 3132 and 7200 We now state that 36 is a common divisor of 3132 and 7200. Let g  Is the largest common divisor of the numbers 3132 and 7200. Since g  divides 3132 and 7200, from the first line it follows that g  divides 936. From the second line we conclude that g  divides 324. So, going down from line to line, we are convinced that g  divides 288 and 36. And since 36 is a common divisor of the numbers 3132 and 7200 and is divided by their largest common divisor, we conclude that 36 is this greatest common divisor.

Verification

Arithmetic calculations require constant attention and, therefore, are fraught with errors. Therefore, it is very important to check the results of calculations.

1. Addition of a column of numbers can be checked by adding the numbers in the column first from top to bottom, and then from bottom to top. The rationale for this method of verification is the generalized law of commutativity and associativity of addition.

2. Subtraction is checked by adding the difference to the subtracted - the result should be minuscule. The rationale for this verification method is the definition of the subtraction operation.

3. Multiplication can be checked by rearranging the multiplier and the multiplier. The justification for this method of verification is the law of commutativity of multiplication. You can check the multiplication by breaking the factor (or multiplicable) into two terms, by performing two separate multiplication operations and adding up the resulting products - you should get the original product.

4. To check the division, you need to multiply the quotient by the divisor and add the remainder to the product. It should be a dividend. The rationale for this verification method is the definition of the division operation.

5. Checking the correct extraction of the square (or cubic) root consists in squaring the resulting number into a square (or cube) - the original number should be obtained.

An especially simple and very reliable way to check the addition or multiplication of integers is the technique, which is a transition to the so-called "Modulo 9 comparisons." We call "excess" the remainder of dividing by 9 the sum of the digits that recorded this number. Then, with respect to “excesses,” two theorems can be formulated: “the excess of the sum of integers is equal to the excess of the sum of excess of terms”, and “the excess of the product of two integers is equal to the excess of the product of their excess”. The following are examples of checks based on this theorem:

The method of transition to comparisons modulo 9 can be used to check other arithmetic algorithms. Of course, such a check is not infallible, since the work with “excesses” is subject to errors, but such a situation is unlikely.

Interest.

Percentage is a fraction whose denominator is 100; percent can be written in three ways: as an ordinary fraction, as a decimal fraction, or using the special designation percent%. For example, 7 percent can be written as 7/100, as 0.07, or as 7%.

An example of the most common type of interest problems is the following: “Find 17% of 82.” To solve this problem, you need to calculate the product 0.17ґ82 \u003d 13.94. In works of this kind, 0.17 is called the rate, 82 is called the base, and 13.94 is called the percentage. The three mentioned quantities are related by the ratio

Rate ґ base \u003d percentage share.

If any two quantities are known, the third can be determined from this ratio. Accordingly, we get three types of tasks "percent".

Example 1. The number of students enrolling in this school has grown from 351 to 396 people. How many percent has this number increased?

The increase was 396 - 351 \u003d 45 people. Writing the fraction 45/351 in percent, we get 45/351 \u003d 0.128 \u003d 12.8%.

{!LANG-eca033d969e0a944f8e8112c13c8f028!}{!LANG-7a19359c8b9b6348f41e9f3daddf1f5d!}

{!LANG-9200718121b1b3507b4332ede26f26eb!}

{!LANG-7b04cedbfe2be8b2101354ab186d0657!}{!LANG-1b2643bdc65e5307c090dae7225b371b!}

{!LANG-93a5c6c2b2d3655355858eb2e15df3f2!}

{!LANG-e90e7821add9b22224ddabf7dac05073!}

{!LANG-6c12433a3e3b8c7893b45ec30220b7d3!}

{!LANG-4a560b45ac7744f0888d293f17968d6c!}

{!LANG-eabc7ba01dabb9cccfa471641b45a7b9!}

{!LANG-902dfe67d01876a2a04809e7d0fbf351!}

{!LANG-ad58cbf276134eecd6023f602626ecf1!}

{!LANG-d49c267a6d4db095e567991882a16c69!}

{!LANG-f7d9c8df12d72f2e10d68346ad7b0798!}

{!LANG-8c67e728e10578594b0fc5581b6d8bb5!}

{!LANG-ec65060e1b338353b3a4a2377cfc0345!}

{!LANG-ac7f1e7d66e969b1d7688c307d1ac24f!}

{!LANG-609c9e64af6fc35a452717cede28ada1!}

{!LANG-4662742772c4f34d2e29420e7e2c80a9!}

{!LANG-cbb4aa66778f634de5c63ccd0093fe49!}

{!LANG-8517a1e973c39e2175926ebe894db819!}

{!LANG-89a30b1d30c5fa7b5a29ba6bf1e31843!}

{!LANG-9468099c245e59d07cb7ee193b347290!} n{!LANG-6d368502cc1684e56a138bb0e88283c8!} x{!LANG-12b840da9f6b60fc1bf5a2b766328a3d!} {!LANG-392b105058e992a95c797aaff50a0f71!} = n. Number x{!LANG-e49907aa77d8641d1b0e94deda6f7a5d!} {!LANG-08b907b5fa923c1a5ff10af14dae8a7a!}  the numbers n{!LANG-639e2cbff6c364af987bfc5f43f90050!} x{!LANG-0c1a0a41e54611b48156347178c55f33!} n{!LANG-3909ddc57cf2583500e310bc8a1042fb!}

{!LANG-732abf6fadb03d665b51726b09ac5d11!}

{!LANG-2f145e5f058fd7b5ab120610127a9109!}

{!LANG-82905ccc10fbaeac798c5de55f31c71a!}

{!LANG-719d2262b3022aa59f141530ed1aed49!}{!LANG-b88183735cd0e92c27c17e0be9293fd0!}
{!LANG-d93713f79cf7a73d3c574b2138144471!} {!LANG-e427442ec2e3270e031953609dc62a51!}{!LANG-3de21ff86fb1083f2896de4fd4b1ffb8!}
{!LANG-07090e180b98cb4e7dc5990044e28c09!} {!LANG-422728584b8d4042da2e24b2dd00e4bd!}{!LANG-d4a0211fdeccb82a4e943d9bad82220a!}
{!LANG-cab7adcece09997f77da4cea2d523b8d!} {!LANG-315e3c03819f5227f6e6e879a1b0a7ad!}{!LANG-006c61057e4c90b816bf24e4900a4bee!}
{!LANG-98e36ee0afb00636c238da1f903cb91e!} {!LANG-91202f4848841e5bf38454fe6791da62!}{!LANG-32fb565ecc12f73fe5cf36a03c575b53!}