Contacts

The variable is not determined by the Matkad. Defining variables in Mathcad. MathCAD language elements

Calculations

This chapter is devoted to the basics of computing in Mathcad. It contains all the necessary information about the use of variables and functions, assignment operators, numerical output and symbolic output (see Section 3.1), as well as other operators (see Section 3.2). In conclusion, the basic means of controlling the calculation process in MathCAD are described (see Section 3.3) and a few words will fail about how error messages are issued during calculations (see Section 3.4).

3.1. Variables and functions

Basic Mathematics Tools is transactions with variable values \u200b\u200band functions. In Mathcad, variables, operators and functions are implemented in an intuitive form, that is, the expressions in the editor are entered and calculated as they would be written on a sheet of paper. The procedure for calculations in the MathCAD document is also obvious: Mathematical expressions and actions are perceived by the processor from left to right and top down.

We list the main actions that the user can make to determine and output variables and functions.

3.1.1. Definition of variables

To determine the variable, it is enough to enter its name and assign it a certain-topoe value, for which the assignment operator serves (see the next section).

3.1.2. Assigning variable values

To assign a new value to a variable, for example, a variable x do equal to 10:

  • Enter the variable name of the variable in the desired place.
  • Enter the assignment operator using the key<:> or by pressing the corresponding Definition button on the Calculator or Evaluation (expression) toolbar, as shown in Fig. 3.1.
  • Enter the new value of the variable (10) to the displayer.

Fig. 3.1. The result of the assignment operator

The result of the listed actions is shown in Listing 3.1.

An assignment operator button for convenience is placed immediately into two Calculator panels (calculator) and evaluation.

Listing 3.1. Assigning a variable numerical value

Enter the new value of the variable is possible both in the form of a number and as a mathematical expression containing other variables (Listing 3.2) and functions (see the following sections), as well as in the form of a string expression (Listing 3.3.). In the latter case, a variable s is not numerical, and a string type.

Listing 3.2. Assigning a variable calculated expression value

Listing 3.3. Assigning a string value variable

If a variable with some name is created in this document For the first time, to enter the assignment operator, instead of a colon, it is allowed to use the "\u003d" equality symbol, which MathCAD will automatically replace the assignment symbol.

In some cases, this is not possible, in particular, when the value is assigned to a variable whose name is reserved by MathCAD. For example, assign the value of a variable named n, only inserting a colon, since by default, this name is indicated in Mathcad the dimension of power (Newton).

To override the value of the variable defined in the document, the assignment operator should not be introduced not to the sign of equality, but a colon, or use the toolbar.

Not quite appropriate to the generally accepted mathematical style, the type of the assignment operator (not \u003d, A: \u003d\u003d) is, in fact, a compromise associated with the mathcad assignment as a programming system. This operator shows that it acts, in contrast to others, not from left to right, and on the right left, since the value (right) is set by the variable (left). And if the uninitiated mathematics appearance This operator can enter into a certain error, then the MathCAD user speaks directly about the action performed in this document: the value of the variable is not displayed on the screen (as the sign says \u003d), and some value is assigned (: \u003d) to this variable.

To prepare reports, however, it may be necessary to change the display of the assignment operator from the default characters ": \u003d" on the equality symbol. This is done for a specific assignment operator using the View Definition AS item of the context menu (Fig. 3.2) or for the entire document using the Tools / Worksheet Options / Display command) (Service / Document Options / Display) (see section. "Some Display Management Operators "Ch. 2).

Fig. 3.2. Various display of the assignment operator

In addition to the disassembled assignment operator (and it is used most often), there is also the possibility of global assignment.

3.1.3. Functions

Functions in MathCAD are written in the usual for mathematics form:

  • f (x, ...) - function;
    • f - function name;
    • x, ... - list of variables.

It is easiest to enter a function writing to a document using a keyboard.

In Mathcad, you can formally divide the functions into two types:

  • built-in functions;
  • user defined functions.

The use of functions of both types in the calculations is exactly the same, with the exception that any embedded function can be immediately used anywhere in the document in the insertion of the built-in functions to the document in section. "Acquaintance with Mathcad" ch. 1), and the user function is pre- Determine in the document until the calculation of its value.

3.1.4. Definition of user function

In order to determine the user function, for example f (x, y) \u003d x2-cos (x + y):

  • Enter the feature of the function (F) in the desired place.
  • Enter the left bracket "(", the names of the variables through the comma of x, y and the right bracket ")". When entering the left bracket and the comma will automatically appear the corresponding hinders.
  • Enter the assignment operator from the toolbar or pressing the key<:>.
  • Enter the expression that defines the function x 2 -COS (X + Y) into the appeared placeholder using the keyboard or toolbars.

The result of the input is illustrated with a listing 3.4.

Listing 3.4. Definition of user function

All variables present to the right in expressing the function definition should either be included in the list of function arguments (in brackets, left after the name of the function), or must be defined earlier. Otherwise, an error message will be displayed, and the name of an indefinite variable will be highlighted in red (Fig. 3.3).

Fig. 3.3. Error message ("This variable or function is not previously defined")

3.1.5. The output of values \u200b\u200bof variables and functions

To calculate in the document some mathematical expression that can consist of variables, operators and functions (built-in and defined by the user):

  • Enter this expression, for example x y.
  • Press the key<=>.

As a result, the calculated value of the expression appears to the right of the entered equality sign (Listing 3.5, the penultimate line). You can not change the contents of the expression to the right of the equality sign, since it is the result of the MathCAD computing processor, completely hidden from the eye of the user. Sometimes (when the expression contains functions that implement different numerical methods, often in complex combinations), the calculation algorithms are very intricate and occupy a significant time. The fact that some document expression is in the calculation stage, testifies its green frame framing and the inability to take any action with the MathCAD program.

Listing 3.5. Calculating the expression.

Note that before calculating the value of the mathematical expression, you must determine the value of each variable in it (the first two lines of Listing 3.5). The calculated expression may contain any number of variables, operators and functions. The output of the current value of a variable is given in the last line of listing 3.5, and the function values \u200b\u200bare in Listing 3.6 and 3.7.

Listing 3.6. Output value function.

Listing 3.7. Output values \u200b\u200b(continued listing 3.6)

When determining the functions of the user through various variables, an important role is played by the presence of the names of these variables in the list of arguments or the definition of them higher in the text of the document. For example, the output results of the value of the function f (x, y) in Listing 3.6 would remain exactly the same if before or after determining the function to assign the variables x and in some values. This is because the values \u200b\u200bof the argument are specified directly in the function of calculating the function. If you determine the function f (x) as it is done in Listing 3 8, it will depend on the value of the variable y at the time of definition f (x) (i.e. y \u003d 5), since it does not enter the list of arguments F (x). In fact, f (x) \u003d x 2 -cos (x + 5). Even if somewhere below in the program, the user will override the value of y, Mathcad will still remember the function f (x) as an expression X2-COS (x + 5) (Listing 3.9).

Listing 3.8. To define user functions

Listing 3.9. To define user functions (continued listing 3.8)

Carefully treat mandatory requirement Coincidences of the number of arguments when determining and output the functions value. Compare, for example, listings 3.6 and 3.8, in which, despite the same expression on the right side of the definition F, two substantially different functions f (x, y) and f (x) are created, respectively

Introducing the equal sign for calculating mathematical expressions in Math-CAD, you actually apply the calculation operator or numerical output (Numerical evaluation). It can also be entered by pressing the button with the equality sign on one of the toolbar: Calculator (calculator) or evaluation (expressions) (see Fig. 3.1). The numerical output operator means that all calculations are carried out with numbers, and various built-in algorithms are implemented by the corresponding numerical methods.

3.1.6. Symbolic output

Along with the numerical output, Mathcad has the ability to symbolic, or analytical, calculating the values \u200b\u200bof the expression. For symbolic calculations There are a number of special funds that will be discussed in detail later (see ch. 5), the simplest of them is a symbolic output statement (Symbolic Evaluation). It is indicated by the symbol - "and in most cases it is used in the same way as a numerical output operator, but the inner difference between the action of these two operators is huge. If the numerical output is in the usual sense of the word "programmed" calculation by formulas and numerical methods, hidden from the user's eye, then the character output is the result of the system artificial Intelligencebuilt into Mathcad and called a symbolic processor. The work of the symbolic processor is also invisible (and, most often, it is even difficult to imagine) to the user and is to analyze the text of mathematical expressions. Of course, a much narrower circle of formulas can be calculated symbolically, if only because, generally speaking, relatively not such a large part of mathematical tasks allows an analytical solution.

To try to calculate a symbolized mathematical expression, for example, in SIN (Arcsin (C x)), where B, C, x - some variables:

  • Enter this expression: in sin (asin (with x)).
  • Enter the character output operator with key combination +<>or by pressing the corresponding button (Fig. 3.4) on the Symbolic panel (symbolism) or evaluation (expressions).

Fig. 3.4. Button inserting a symbolic output operator

After that, to the right of the symbol of the symbol output operator, a specific analytical value of the expression appears (Listing. 3.10) or an error message "No Answer Found" (the answer is not found). If the MathCAD character processor cannot analytically simplify the expression, then it will be represented to the right of the sign - "in the same form as the left.

Listing 3.10. Symbol with expression

Listing 3.11. Symbolic output of expressions that failed to simplify

Look more carefully to Listing 3.10 and 3.11: for character output, it is not necessary to pre-determine the variables included in the left part of the expression! If the variables were still assigned earlier than some values, the symbol processor simply substitutes them into a simplified formula and give the result with these values \u200b\u200b(see as an example two of the following listing - 3.12 and 3.13).

In the same way as the numerically values \u200b\u200bof the functions are calculated, you can calculate them and using a symbolic processor. Compare the corresponding results, which are presented in Listing 3.12 (of course, symbol and numerical answers are equal: 9 COS (8) \u003d - 1.31). Similarly, you can "characterize the values \u200b\u200bof the variables. For example, assign a function of a function or complex expression to some variable (Listing 3.13, the second line) and then output the value of the variable in the symbol form.

Listing 3.12. Numerical and symbolic function value

Listing 3.13. Numerical and symbolic conclusion

According to the above examples, the advantage of symbolic calculations is to issue an analytical result, which is often more valuable for mathematics. Therefore, based on the specifics specific tasks, decide whether along with numerical calculations try to get both a symbolic solution.

3.1.7. Permissible variable and functions names

In conclusion, we list which characters can, and which cannot be applied in the names that the user gives variables and functions, and list a number of restrictions on assigning names. Permissible characters:

  • large and small letters - Mathcad distinguishes the register: so, the names x and x determine different variables. In addition, Mathcad distinguishes the font, for example, the names x and x are perceived as different;
  • numbers from 0 to 9;
  • infinity symbol (keys ++);
  • barcode (keys +);
  • greek letters - they are inserted with the Greek panel (Greek symbols);
  • underscore symbol;
  • percent symbol;
  • lower index.

Use the lower index in determining the names of variables and functions, not coming by it with the vector variable index. To enter a name with the lower index, for example, K max: Enter the letter "k", then the point ".", After which the input lines will be empty slightly lower, and only then the MAX lower index itself.

Now consider restrictions on variable names and functions:

  • the name cannot start with the figure, the symbol of underscore, a stroke or percentage;
  • the infinity symbol should be only the first in the name;
  • all letters in the name must have one style and font;
  • names cannot match the names of embedded functions, constants and dimensions, such as SIN or TOL. Nevertheless, their overridency is allowed, but then the built-in function is no longer used on the initial purpose;
  • Mathcad does not distinguish between variable names and functions: if you first determine the function F (x), and then the variable F, then the remaining part of the document will be lost * access to the function f (x).

In some cases, it is desirable to use variable and functions names containing MathCAD statement characters or other characters that cannot be inserted in the names directly. For this there are two possibilities.

First, the name made up from any symbols and enclosed in square brackets, Mathcad will be perceived correctly (Fig. 3.5, on top). For example, to enter a name:

  • Press keys ++ - A pair of square brackets with the place of the place inside will appear inside.
  • Enter a sequence of any characters into a sequencer, for example A + B.

Fig. 3.5. Special characters in variable names

Secondly, if you are not satisfied with the presence of square brackets in the name, then insert special symbols in it can be slightly more difficult. For example, to enter the name A + B:

  • Enter the first character (A), which must be permissible for MathCAD names.
  • Press keys ++ To go to a special "text" editing mode.
  • Enter the sequence of any characters (+).
  • Press the keys again ++To return to normal edit mode. Now you can continue to enter permissible characters in the name (b).

The result of these actions is shown in the bottom line Fig. 3.5. If it is required that the name begins with special symbol (The middle row Fig. 3.5), then you need to perform all items 1-4, introducing an arbitrary permissible character at the beginning of the name, and at the end of the input is simply washing it.

3.2. Operators

Each operator in MathCAD denotes some mathematical action in the form of a symbol. In complete agreement with the terminology adopted in mathematics, a number of actions (for example, addition, division, transposition of the matrix, etc.) is implemented in Mathcad in the form of embedded operators, and other actions (for example, SIN, ERF, etc.) - In the form of built-in functions. Each operator acts on one or two numbers (variable or function), which is called operands. If at the time of inserting the operator of one or both operands is not enough, then the missing operands will be displayed in the form of hinders. A symbol of any operator in the desired place of the document is introduced one of two main ways:

  • by pressing the corresponding key (or keyboard shortcuts) on the keyboard;
  • by pressing the mouse pointer the corresponding button on one of the mathematical toolbar.

Recall that most mathematical panels contain the mathematical statements grouped in meaning, and you can call these panels to the screen by pressing the corresponding button on the Math panel (mathematics).

Everywhere in this section, we will only consider the second way of inserting the operator the same who prefers to use the keyboard, will find a list of hotkeys in Appendix 2.

Above, we considered the features of the use of three operators: assignments (see Section 3.1.2), numerical (see Section 3.1.5) and symbolic output (see Section 3.1.6). We will analyze in this section of the action of other MathCAD statements and the ability to identify user statements.

3.2.1. Arithmetic operators

Operators denoting the main arithmetic actions are entered from the Calculator panel (calculator) shown in Fig. 3.6:

  • addition and subtraction: + - (Listing 3.14);
  • multiplication and division: / + (Listing 3.15);
  • factorial:! (Listing 3.16);
  • module number: | x | (Listing 3.16);
  • square root: (Listing 3.17);
  • root n-th degrees: (Listing 3.17);
  • the construction of x degree y: x y (listing 3.17);
  • changing priority: brackets (Listing 3.18);
  • numerical output: \u003d (all listings).

Fig. 3.6. Calculator panel

Listing 3.14. Operators of addition, subtraction and denial

Listing 3.15. Division and multiplication operators

Listing 3.16. 0Pheurry factorial and module

Listing 3.17. Removing root and exercise operators

Listing 3.18. Priority Change Operator ()

As you can see, with this panel you can enter not only the listed operators, but also their frequently used combinations, for example, the construction of the exhibitors to the degree, mixed work and division, as well as an imaginary unit and the number I. Note that the division operator is allowed in both one and two lines, which is ensured by the presence of two corresponding buttons on the Calculator panel.

Recall that in the MathCAD editor, you can select the display of the multiplication operator (see section. "Manage the display of some operators" ch. 2). In order to change it:

  • Right-click on the expression containing the multiplication operator.
  • Select the first view of the View Multiplication AS context menu item.
  • To the submenu, select the point corresponding to the multiplication view style: as a conventional point (DOT), points with a reduced distance from it to factors (Narrow Dot), a thick point (LARGE DOT), cross (X), without a symbol with a small distance Between the factors (Thin Space), generally together (no space). To view how the expression in the last two performances will look, you need to remove the selection from it. To return the default view, select Default on the context menu submenu.

Some operators, for example, such as an integrated pairing operator, no tool panels (Listing 3.19). It has to be entered exclusively from the keyboard by pressing the key<"> within the mathematical region.

Listing 3.19. Comprehensive conjugation operator

3.2.2. Computational operators

Computing operators are inserted into documents using the Calculus toolbar (calculations). When you press any of the buttons in the document there is a symbol of the corresponding mathematical action provided with several hinders. The amount and location of the placeholders is determined by the type of operator and exactly corresponds to their generally accepted mathematical recording. For example, when inserting an operator of the amount (Fig. 3.7), you must specify four quantities: the variable for which the summation should be made, the lower and upper limits, as well as the expression itself, which will stand under the sum of the amount (an example of the completed amount of the amount, see below in Listing 3.22).

In order to calculate an indefinite integral, two placeholders should be filled: the integrand and integration variable.

Fig. 3.7. Inserting the operator summation

After entering any computing operator, it is possible to calculate its value or numerically by pressing the key<=>or symbolized using the symbolic output operator.

We list the main computing operators and give the simplest examples of their application:

  • differentiation and integration;
    • derivative (Listing 3.20);
    • Nth derivative (Listing 3.20);
    • certain integral (Listing 3.21);
    • uncertain integral (Listing 3.21).
  • summation and calculation of the work;
    • amount (Listing 3.22);
    • product (Listing 3.22);
    • the sum of the ranked variable (Listing 3.23);
    • production of a ranked variable (Listing 3.23).
  • limits (Listing 3.24);
    • bilateral;
    • left;
    • right.

Listing 3.20. Operators calculating derivatives

Listing 3.21. Integration operators

Listing 3.22. Summation and calculation operators

Listing 3.23. Summary Operators and Calculation of Work

On the assignment and features of the use of ranked variables will be described in the next chapter (see section. "Rated variables" ch. 4).

Listing Z.24. Symbolic calculation operators limits

In contrast to others, the limit search operators can only be calculated symbolite (see ch. 5).

Summation and calculation operators are actually more convenient recording of + and x operators with a large number of operands. But the computational search operators of derivatives and integrals differ significantly from multiplication and addition operators by the fact that they are implemented on the basis of certain numerical methods, which in the hidden (invisible for the user) are launched by the MathCAD computing processor. In the numerical calculation of the integrals and derivatives, it is necessary, at least in general terms, to represent the principle of operation of the relevant algorithms in order to avoid errors and surprises in obtaining results (numerical methods of integration and differentiation are devoted to ch. 7).

Fig. 3.8. Search infinite row

It is important to note that it is possible to calculate the integrals with one or both endless limits, as well as in symbolic form to look for the values \u200b\u200bof infinite limits, sums (rows) and works. For ease of entering, the button with infinity symbol is placed on the same Calculus (calculation) toolbar. An example of inserting an infinity symbol in the problem of finding an infinite row is shown in Fig. 3.8.

3.2.3. Logic operators

The result of the action of logical, or boolean, operators are only numbers 0 (if a logical expression recorded with their help, true) or 1 (if the logical expression is false). To calculate the value of a logical expression, for example 1 \u003d 1 (Fig. 3.9):

  • Insert the corresponding operator from the Boolean panel (Booleans).
  • In the appears of the hinders, insert the operands (two units).
  • Press the key<=>to get the answer.

Fig. 3.9. Insert a logical operator

The expression I "i \u003d i is absurd at first glance. However, in fact, everything is right. To the right of the output statement recorded a logical expression 1 * 1 (note that the logical sign of equality looks differently than the usual), which is true. Therefore, the value of this expression is 1, which is shown to the right of the equality sign.

List logical operators:

  • more (Greater Than);
  • less (less than that);
  • more or equal (greater than or equal);
  • less or equal (Less Than or Equal);
  • equal (Equal);
  • nOT EQUAL TO);
  • and (and);
  • or (OR);
  • excluding or (Exclusive OR);
  • denial (not).

Operands in logical expressions can be any numbers. However, if the operator in meaning is applicable only to 0 and 1, then any unequal zero by default is accepted equal to 1. But as a result, it can still be possible either 0 or 1. For example, ¬ (-0.33) \u003d 0.

Examples of the operation of logical operators are shown in Listing 3.25 and 3.26.

Listing 3.25. Comparison operators.

Listing 3.26. Boolean operators.

Logical operators are extremely important when writing to solve algebraic equations and inequalities in an acceptable form for Mathcad.

3.2.4. Matrix operators

Matrix operators are designed to perform various actions over vectors and matrices. Since most of them are implementing numerical algorithms, they will be described in detail in detail in part III (see ch. 9).

3.2.5. Operators expression

Almost all computing operators were considered above (see Section 3.1). They are grouped on the Evaluation panel.

  • Estimate numerically (see section. 3.1.5)
  • Calculate symbol (Evaluate Symbolically) (see section. 3.1.6)
  • Assignment (Definition) (see Section 3.1.2)
  • Global Definition (Global Definition)

Consider the difference between the operators of the usual assignment and global assignment (the process of its insertion into the document is shown in Fig. 3.10). In order to calculate an expression containing a single variable or function, it is necessary that this variable earlier in the document is assigned to any value. Otherwise, an error message will be issued (Fig. 3.11). However, if in any part of the document (for example at the very bottom), insert the global assignment operator, the variable will be defined in any part of the document (Listing 3.27).

Listing 3.27. Action of the assignment and global assignment operators

Fig. 3.10. Global assignment button on the Evaluation panel

Fig. 3.11. Normal assignment affects only the following part of the document.

As can be seen from the listing 3.27, the usual, or local, the assignment of the variable x acts from the moment x: \u003d 10 until the global assignment x \u003d 5. Generally speaking, MathCAD analyzes the documents for assigning variables into two passages: first recognize all global assignment operators first recognize, And all expressions in the document from top to bottom and left to the right are calculated in accordance with them, and with the second pass, the local assignment operators are analyzed in the same manner, and all expressions are calculated with the amendment on them. We give an important example of the interaction of the global and local assignment (Listing 3.28).

Listing 3.28. Interaction of global and local assignment

Note that, despite the local assignment of the variable x: \u003d 10 in the third line of the listing, the value of the variable y is calculated after all the same in accordance with the global value x \u003d 5, since the variable y itself is globally defined through the variable x.

Carefully treat the definition of global variables and, in order to avoid confusion, try not to override them locally. Use the global assignment only to determine the constants and, if possible, avoid cases when the output operator precedes the global assignment operator to improve the readability of documents.

In the same way as you globally assign the value of the variable, it is allowed to globally define functions (Listing 3.29).

Listing 3.29. Global user definition

The global assignment operator can be displayed not only in the form of identical equality, but also as a regular sign of equality. To do this, call the context menu on the operator and in the View Definition AS submenu, select Equal (equality).

3.2.6. Creating a user operator

Requesting user requests can not be exhausted by a set of built-in MathCAD operators. To insert into documents, the Evaluation panel (expressions) is used to insert the user's operators.

Select the name of the operator

The user operator may have an absolutely any name (see previously section "Names containing operators and special characters" of this chapter). However, based on the meaning of the operators, it is logical to give them names in the form of symbols. It is convenient to do with the collection of characters in MathCAD help information. Select Help / Quicksheets in the Help / QuickSheets top menu and then enter the latest Extra Math Symbols (optional characters) of the opened crib. There you will see a whole collection of characters, any of which can simply drag the mouse pointer to the desired place of the document.

Assign the operator some action shall follow the same as user functions.

Creating a binary operator

To create a binary operator, for example, the implementation of X by 2:

  • Enter the name of the operator, for example, bin.
  • Dial the bracket sign<(>, then a list of two operands through a comma,<х>, <,>, <у>then closing bracket<)>.
  • Enter the assignment operator<: >.
  • Enter the expression depending on the operands, the action of which must be assigned to the operator (X-y 2).

Creating an unary operator

The unary operator is created in the same way, only instead of two operands separated by a comma, you should enter only one operand. For example, to create an operator with the name%, which implements the transfer of the number of interest in interest and the speeding to the multiplication of it by 100 (Listing 3.30):

  • Enter the name of the operator. To do this, press keys.<а>, + ++,<%>, then again ++, then erase in the name of the letter "A".
  • After the sign%, type the bracket "(", then "x11, then another bracket") ".
  • <:>.
  • Enter the expression X100.

Listing 3.30. Creating a unary user operator

Using a binary operator

There are two types of insertion of the user binary operator to a document that differ only in the display in the document. To insert the operator in the form of a graph (or tree):

  • Press the Tree Operator (Operator Tree) button on the Evaluation panel (Fig. 3.12, right).
  • Enter the name of the operator (on the top of the graph) and the operand values \u200b\u200b(in the branch of the tree).
  • Enter the assignment operator by pressing the key<=>.

The result of the operator is shown in Fig. 3.12, below left.

In addition to the tree form of the operator, it is allowed to use it as a "operand-name operand" sequence - another operand (Fig. 3.12, the second line on the left). To enter such a form of an operator, you should press the adjacent Infix Operator button (operator inside) with an XFY image.

Fig. 3.12. Application of a custom binary operator

Using a unary operator

The insertion of the unary operator is absolutely similar, only instead of two operands you need to enter one (Fig. 3.13). The unary operator is inserted by pressing the Prefix Operator button on the Evaluation panel or the POSTFIX Operator buttons (after). The first way is illustrated with the right side of Fig. 3.13 (at the time of insertion) and the result of the operation of the operator (left), and the result of the operator inserts on the second path - the left lower line of the same drawing

Fig. 3.13. Application of a user unary operator

3.3. Computing management

The MathCAD document is in the full sense of the word computer program, and the MathCAD system itself is a real programming system, the truth-oriented mathematics, and not on a professional programmer. Most of the other programming environments (familiar to the reader on the implementation of such languages \u200b\u200bas C, Fortran, Beysik, etc.) share the editing of the program code and their execution that can be caused by commands intended for this. In Mathcad and the program code, and the result of their execution is combined in one document. However, the formulas editing functions and their calculations are performed separately, and the user has the ability to manage all the most important options for calculations.

3.3.1. Computation modes

All examples that we consider in this book implicitly suggest that the automatic calculation mode is enabled. It is activated by default when creating an empty document, so if expressions containing output operators are entered, they are calculated immediately. Generally speaking, there are two calculation modes:

  • automatic mode (Automatic Mode) - all calculations are carried out automatically as formulas input;
  • manual mode (Manual Mode) - the beginning of calculations of each formula or the entire document is performed by the user.

The calculation mode can be selected using the Tools / Calculate / Automatic Calculation command (Service / Recalculation / count automatically), as shown in Fig. 3.14. If the check box is checked in this menu bar, it means that the automatic mode is enabled if there is no flag, then the document in the manual computing mode is edited. To change the mode, simply select this menu item (for example, by pressing the mouse button in the situation shown in Figure 3.14, turn on the manual mode).

Computing mode is set independently for each document. Several documents calculated in various modes can be opened at the same time.

The advantages and disadvantages of each mode are obvious. On the one hand, automatic calculations simplify work with the document, since the calculation results appear in real time, and the user has the ability to analyze them immediately. On the other hand, if computing is complex, they can take a lot of time (which is especially noticeable on computers with a not too powerful processor and a small amount of RAM). Therefore, it is often often necessary to continue the editing of the document, it takes a rather long expectation of the completion of the calculations in particular, if you change any expression at the beginning of a large document that affects subsequent calculations, then they are all recalculated again. In such cases, it is often more convenient to edit text in manual mode, and the calculations include as needed.

Fig. 3.14. Select calculation mode

3.3.2. Interruption of calculations

Mathcad performs document calculations, as is customary in most programming environments: from top to bottom and left to right. While the next expression is in the calculation process (computing or symbolic processor), it is highlighted by a green frame (Fig. 3.15), and any user actions to further edit the document are blocked. If you are not too fast, and the formulas are quite complex, then you can observe how the green frame jumps from one expression to another

To interrupt the protracted calculation process, press the key. A dialog box shown in Fig. 3.16, in which you need to confirm the interruption of calculations (OK). In this case, the expressions that Mathcad did not have time to calculate will be marked with red documents. Interrupted calculations are resumed by pressing the key Or Team Tools / Calculate / Calculate Now (Mathematics / Recalculation / Recalculation)

Fig. 3.15. The process of calculating the expression

Fig. 3.16. Calculation Interrupt Dialog

3.3.3. Calculations in manual mode

If the checkbox in the Tools / Calculate / Automatic Calculation command (service / count / count) is removed, the user must run the calculations independently

  • In order to calculate all the formulas in the entire document, run the Tools / Calculate / Calculate Worksheet command (Math / Recalculate / Recalculate All).
  • To calculate all the formulas in the visible part of the document, select Tools / Calculate / Calculate Now (Service / Recalculate / Recalculate) or press the key Or click on the button with the image of the equality sign (Calculate) on the standard toolbar
  • Interrupt calculations can be in the usual way by pressing the key .

You can control the size of the visible part of the document using the change in the displacement of the document

When editing text in manual mode, neither calculations nor the construction of graphs are not performed, and the corresponding places in the expressions are formally noted by the placeholders (Fig. 3.17)

Fig. 3.17. To run the calculations in manual mode, press the CALCULATE button.

3.3.4. Disabling the calculation of individual formulas

Mathcad allows you to disable the calculation of any formula. At the same time, it will not affect subsequent calculations. In order not to calculate a specific formula in the document:

  • Right-click on the formula.
  • Select Disable Evaluations in the context menu, as shown in Fig. 3.18.

The equivalent method of turning off the calculation of the individual formula is to call the Properties dialog box through the context menu item (see Fig. 3.18) or the Format main menu. In the Properties dialog, go to the Calculation tab and set the Disable EvalUations checkbox there.

The result of turning off the formula from the calculation process is illustrated with a listing of 3.31. It disables the second from the assignment operators, which can be judged by the presence of a black square at once for the formula. Accordingly, in the last line, the output value of the variable x "does not feel" the assignment turned off and remains equal to 3.

Listing 3.31. Calculation of the second assignment operator turned off

Fig. 3.18. Disabling the calculation of the formula using the context menu

3.3.5. Optimization of calculations

A distinctive feature of new versions of Mathcad are improved acceleration capabilities of numerical calculations by applying elements of symbolic mathematics. Immediately before the numerical calculation of Mathcad, it is automatically trying to simplify expression using a symbol processor. This is called optimization. Due to the fact that the version of the version of the work of the character processor is improved, the symbolic transformation often significantly accelerates the calculations. Optimization mode is included either in the entire document or for individual formulas.

To enable or disable the optimization mode of all expressions in the active document, select Tools / Optimize / Worksheet (Service / Optimization / Document), as shown in Fig. 3.19. The content of the document depicted on the same figure helps to understand the mathematical meaning of the optimization mode: to speed up the calculation of the lower (defined) integral, it is advantageous to use its analytical solution defined by the symbolic processor.

To change the optimization mode for a separate formula, without changing the selected mode for the remaining document expressions, select this formula input lines and select Tools / Optimize / Equation in the top menu (Service / Optimization / Equation).

Fig. 3.19. Computing optimization mode

3.3.6. WORKSHEET OPTIONS dialog box

Along with the setted methods for setting computing modes, they are also conveniently installed for the entire document on the Calculations tab of the Worksheet Options dialog box (document options) called using the Tools / Worksheet Options command. Three flags set the inclusion of the corresponding calculation mode (Fig. 3.20).

  • Recalculate Automatically (Recalculate Automatically) - Enable Automatic Computing Mode.
  • Use Strict Singularity Checking for Matrices - the option that appears in the MathCAD 2001 version, which is important with some operations with matrices. It means an additional check on the singularity of the matrix before using numerical algorithms, which allows, in order to avoid improper use of the numerical method, to give a pre-message error message if the syngular matrix.
  • Optimize Expressions Before Calculating - Enable optimization mode.
  • USE EQUALITY FOR BOOLEAN COMPARISONS - When the check box is selected, a rigid criterion of accurate equality of numbers is used (more precisely, the number when compared is considered equal, if they differ in module less than 10 -307). If the flag is removed, a softer criterion is used (the relative difference of numbers by module is less than 10 -12).

Fig. 3.20. Managing computing mode in the Worksheet Options dialog box

In addition to checkboxes, there is also a pair of switches that allows you to implement a new accelerated computation mode (Higher Speed \u200b\u200bCalculation). It is included in the selection of the Higher Speed \u200b\u200bCalculation switch depicted in Fig. 3.20. To disable the accelerated computing mode, select the Backward Compatibility Switch (backward compatibility). In this case, the calculations will be carried out without additional speed optimization, exactly the same as in previous versions (MATVCSD 2000 and below) the need for such calculations may occur if you suddenly encountered error messages in documents created in previous versions of Mathcad and Correctly in them working.

3.4. Error messages

When the MathCAD processor for one or another reasons cannot calculate the expression, it displays an error message instead of an answer (Fig. 3.21). If the cursor is outside the formula with an error, then it is the name of a function or a variable that caused an error is marked in red (from above in Fig. 3.21). When you click on such a formula, a text message about an error type framed by a black rectangle appears (Fig. 3.21, below).

Fig. 3.21. Error message

If some expressions cause an error, they are simply ignored, and the following expressions in the document are still calculated. Of course, if the formulas that caused the error affect the values \u200b\u200bof the following formulas, they will also be interpreted as erroneous. Therefore, encountering error messages in the document, find the most first of them first. Often, its elimination allows you to get rid of subsequent errors.

No matter how well you have mastered the MathCAD system, error messages will still appear in the documents. They can be associated with both spelling errors and more serious internal reasons requiring knowledge of numerical calculation algorithms. The art of mathematics is largely in the ability to analyze erroneous situations and find the right way out of them.

Mathcad 7.0 Professional is a universal tool for working with formulas, graphs and texts. It has powerful computing functions and the possibility of analytical transformations.

Instruction

  • Mathcad processes the document from left to right and top down. Therefore, by specifying the value of the variable, it will be possible to use it in all further calculations. To determine the variable, enter its name. The symbol of the assignment is the "colon" sign. After it, specify the specific value you want to assign a variable.
  • You can equate a certain number, numerical expression, formula from other variables previously specified earlier. Let, for example, you need to define a quantity variable, equal to 50. Enter the text from the keyboard: "Quantity: 50". "Quantity: \u003d 50" appears on the screen. In the arithmetic menu of the program there is a special assignment button: \u003d.
  • If you want to change the Quantity value, erase the Backspace 50 key and enter the desired expression or number. Press Enter and the variable will take a new value. Also change the values \u200b\u200bof all variables in any way depend on quantity. If MathCAD detects an incorrect operation (for example, dividing to zero), the expression will turn into a red color, a tip message appears next to the operator.
  • Let now need to calculate the value of the function for the Function variable. In this case, the function itself depends on the quantity variable: function \u003d sin (1/2 * quantity). Note FUNCTION This expression: function: \u003d sin (1/2 * Quantity). After starting the program, the result will appear on the screen.
  • All calculations in Mathcad can accompany comments and explanations. Click in the free place of the screen with the mouse, click INSERT and select Text Region in the menu bar. In the text frame that appears, start entering text. To enter the second line, press ENTER and continue typing text. So, the assignment operation you can accompany the type "x equal to 6" commentary. You can comment on any step of the program. In some cases, this helps a person working with the code, to understand the essence of what is happening and not confused in the algorithm.
  • This application is an alphabetical list of diagnostic error messages in mathematical expressions. They appear when you try to enter, process or calculate the expression in which Mathcad detects an error. To describe diagnostic messages for the character processor, see the chapter "Symbimal Calculations".

    If Mathcad finds an error when trying to calculate a function defined by the user, it marks the error message name, and not its definition. In this case, check the definition of the function to understand what caused an error.

    Nested blocks - keyword Given. used twice in the string without subsequent Find. or Minerr.Mathcad does not allow nested blocks of solutions to equations, although it is possible to determine the functions through the blocks of solutions of equations and then use them in other blocks of solving equations. See chapter "Solution of Equations";

    Range are unacceptable - Attempt to use a discrete argument inside a block of solving equations. To solve the system of equations for many parameter values, see the section "How to look for the roots" on page 353;

    Imbalance brackets (unmatched pARENTHESIS) -you have entered or tried to calculate the expression containing the left bracket without the right right. Correct the expression, removing the left bracket or putting the right in the right place;

    Long expression in symbols -the result of the symbolic transformation is so long that it cannot be placed in a working paper;

    Long Input List too. lONG) -it introduced too many elements in the list separated by commas. This may happen when trying to display more expressions on the schedule than Mathcad is allowed, or when trying to create a table with more than fifty elements;

    Must be a range (MUST bE. range) -anything that is not a discrete argument is used in a place where it is required, for example, as an index for summation. The index for summation is located under the sum of the amount and must be predefined as a discrete argument;

    Must be square - This error message notes a non-commercial matrix in an operation in which a square is required, for example, when calculating the determinant, handling or erecting a matrix into a degree;

    Must be dimensionless (must bE. dimensionless) -the specified expression has dimension, although the situation requires it to be dimensionless. Units cannot be used for arguments of some functions (for example, cos. and In)or in an indicator. For example, the expression CO5 (LL) is invalid;

    Must be a vector (must bE. vector) -this message notes a scalar or matrix in an operation requiring the vector argument;

    Must be real (must bE. real) -imaginary or complex expression is used where MathCAD requires a real-valued expression. For example, MathCAD requires real-valued arguments for some built-in functions and real-valued indexes;

    Must be increasing (must bE. increasing) -vector whose elements are not arranged in a strict increase, used as an argument of one of the functions. ISPline, PSPline, CSPline, Interp, Linterp and hist.The first argument of these functions should be a vector with strictly increasing elements. (In this case, it should be remembered that if Origin is O, Mathcad includes the element elements with a zero index, and if it is not clearly defined, its value is relying equal to zero);

    Must be an array (must bE. array) -an attempt to perform an operation that can be performed only on an array, with a scalar. For example, you can see this error message when trying to transpose number, since in such a context, the transpose operation does not make sense;

    Must be a multidimensional array - You should use a matrix having more than one line or more than one column;

    Must be nonzero (must bE. nonzero) -attempt to calculate the built-in function from zero, although it is not defined for zero;

    Must be positive (must bE. pOSITIVE) -this message notes the drawing in which one of the boundaries along the axis using a logarithmic scale is zero or negative. MathCAD can display only positive values \u200b\u200bon the logarithmic axis;

    Must be a scalar (must bE. scalar) -a vector or matrix expression is used where the scalar is required, for example, as an argument of the identity function;

    Should be a three-dimensional vector (must be 3-vector) -an attempt to find a vector art from operands that are not three-dimensional vectors. Vector product is defined only for vectors with three elements;

    Must be whole (must bE. integer) -used an unemployed expression where an integer is required, for example, as an argument function identity. or as an index, lower or top. (Although you can define discrete arguments with fractional values, for example x: \u003d 1, 1.1 .10 - they cannot be used as lower indices);

    Let's say only one array (ONLY one. array. allowed) -attempting to enter more than one array in the input field for the level of level lines. MathCAD in this case allows no more than one array, since the level of the level lines can represent no more than one function at the same time;

    Duplicate (Duplicate) -attempting to identify one variable twice in one definition. This message appears when you create the vector on the left side of the definition and use one name in this vector twice;

    Index outside the boundaries (index out. of. bounds) -this message marks an index that refers to the non-existent value of the array. Such a message can be seen when using a negative upper or lower index (or index smaller than Origin, if original\u003e 0) either when using the upper or lower index for reference to an array element with a number greater than is possible according to the definition in the document;

    Low lower indexes (Tooo few subscripts) -for the matrix one lower index is used. An indication of the elements of the matrix is \u200b\u200bpossible using the two lower indices separated by the comma;

    Can not be determined (cannot bE. denned) -to the left of the definition symbol (: \u003d) placed an indefinable expression. MathCAD allows the following types of expressions to the left of the definition symbol:

    Simple variable name: h.

    The name of the variable with the lower index: x;

    The name of the variable with the upper index: x.

    The variable name matrix generated by pressing M. The matrix can contain only simple variable names or variable names with lower indexes

    Name of function with arguments: j (x, y)

    Using other types of expressions incorrectly. If you need to calculate the result instead of determining the variable, you should put a sign of equality (\u003d) instead of pressing the colon;

    Does not contain upper indexes (cannot take subscript) -the upper index is not used for the matrix, but for something else;

    Does not contain lower indexes (cannot take subscript) -the lower index is not used for a vector or matrix, but for something else;

    Not name (not a. name) -number or other combination of characters are used where MathCAD requires a name, for example as the second function argument root.Examples of what is not name: / (x)) (function), 3 (number), x + 2. (expression);

    Invalid operation with an array (illegal array. operation) -"Attempting to apply a function or operator to a vector or matrix that require scalar arguments. For example, this message can be seen when you try to use a sine function to a square root from the matrix if you need to apply the operator or the function to each matrix element, use the vectorization operator as described. in the chapter "Vectors and matrices";

    Incorrect feature name (illegal function. name) -used expression that Mathcad interprets as a function, but the name of the function is incorrect. This message will appear, for example, in the case of the use of the number as the name of the function: 6 (x).Most often it occurs if the type statement is missing *, which causes Mathcad to interpret brackets in expression as a feature feature, and not as a grouping of operations;

    Incorrect use Origin (Illegal Origin) -ORIGIN is defined through the mis value or value with a value greater than 16,000,000. This message marks the first use of the index after the wrong use of Origin;

    Invalid context (illegal cONTEXT) -the operator or function is used in the context forbidden by MathCAD. For example, this message can be seen in the following cases:

    a semicolon is used somewhere outside the correct definition of the range. (Point with a comma in this case is displayed as dot)You can use a semicolon only in the range definition for the discrete function argument Write. or Append. Used somewhere outside the left side of the definition. These functions cannot be used in expressions or on the right side of determining the name of the existing function is used as the name of the variable or the name of the existing variable is used as the name of the function;

    Wrong factor (illegal factor) -in the field of entering units at the end of the expression that returns a numerical result, an incorrect expression was introduced. Valid real nonzero scalar values \u200b\u200bare allowed;

    Invalid order (invalid oRDER) -notes an attempt to calculate the derivative with the specified order, which is not an integer from 0 to 5 inclusive;

    Invalid vector size (WRONG size vector) -this message indicates the Fourier transform function, the argument of which has the number of elements other than the permissible, fFT requires a vector as an argument with the number of elements 2 °, where p -an integer, greater 1. IFFT requires a vector with 1 + 2 "by elements where N is an integer, greater than 0. If Origin is zero, Mathcad automatically turns on the zero index element as a component of the argument vector;

    Incorrect accuracy of approximation (illegal tolerance) -this message notes an expression using TOL integral, or entering Root, find or Minerr for which TOL 3\u003e 1 or TOL<^ 0. Для устранения этой ошибки нужно где-либо выше отмеченного выражения установить значение TOL между нулем и единицей;

    Uncertain dimension - Expression with measurement units is erected into a degree comprising a discrete argument or vector. MathCAD cannot determine the dimension of the result that will change depending on the indicator of the degree. If the expression has dimension, it can be erected only into a degree with a fixed real indicator;

    Undefindet -the feature-shown in the negative image is not defined. To determine if you enter the name of the variable with the subsequent colon (:) and the expression or number, its defining. This message often means that the equality sign is used to determine the variable (\u003d) instead of a colon. To create a definition, use colon. If the equal sign is used, Mathcad believes that you need calculate The value of the variable. This message also appears with incorrect use of the variable in the global definition. If the variable is used on the right side of the global definition, it must be determined globally above His. If a locally defined variable or variable is used, the global definition of which is below its place of use, MathCAD notes that the variable is not defined. Message " undefined"it often indicates that somewhere above the working document contains an error. If the definition incorrectly, then below in the document, any expressions depending on this definition are shown in a negative image;

    Wrong range (illegal range) -the discrete argument is defined incorrectly. When determining the range, use one of the following forms:

    RVAL: \u003d NL. P2 RVAL: \u003d NL, N2. p2.

    It is recruited by pressing the RVAL: NL keys; N2 and RVAL: NL, N2; N2, respectively. In determining the range, it is permissible to use a maximum of one comma and one point with a comma. If the second form of recording is used, the value p2. must lie between the values p and p3, but not equal p;

    Non-zero value (no scalar value) -a vector or expression containing a discrete argument is used where the scalar value is required. For example, you can see this message when you try to introduce equal view h.: \u003d /, if / is a discrete argument. You can not define one discrete argument through another directly, for this you should use expressions like xi.This error often occurs when building graphs, if you enter the name of the vector in the input field h. instead xi;

    Incompatible units (incompatible units) -notes the expression in which other operations with expressions having different dimensions are subtracted or performed. For example, this error message can be seen when trying:

    fold or subtract two expressions that have different dimensions, for example 3 kg + 5 seconds

    create a vector, matrix or table, in which not all elements have the same dimension

    create a drawing in which two expressions having different dimensions are deposited on one axis;

    Mind of array sizes (Array size mISMATCH) -an attempt to perform an operation with vectors or matrices, the dimensions of which are not suitable for this operation. Many operations require their vector arguments to be one size, such as a product or function. linterp. and co / g. Addition and subtraction of vectors and matrices also require matching dimension. Multiplication of matrices requires that the number of columns of the first matrix coincides with the number of rows of the second;

    No relevant Given (NO matching. Given) -this message indicates functions. Find. or Minerr. Without the words appropriate Given.Each block of solving equations starting with the word Given, Must end the word Find. or Minerr;

    Inappropriate comma (misplasd cOMMA) -the comma is used where it should not be. You can use the comma in one of the following cases:

    to divide the arguments of functions

    to separate the first two elements of the range in determining the discrete argument

    for the separation of the values \u200b\u200bthat are postponed in the drawing along one axis

    to split items in the input table

    to separate the lower indexes of the matrix element.

    Use of the comma for any other purposes in Mathcad is unacceptable;

    Feature - Attempt to calculate the function or perform an operation with an invalid value. For example, this message can be seen when divided into zero or attempt to draw a degenerate matrix (with zero determinant);

    There is no convergence - MathCAD is not able to calculate the result of integration, differentiation, functions root, find or Minerr. With the required accuracy. For more information, see the descriptions of the relevant operators and functions;

    Error in block (Error iN. solve block) -you can see this message when calculating the user function expressed through a block of solving equations containing an error. To eliminate this error, eliminate the error in the solution of equations. (If you use the equation solutions block directly without defining the function through it, you can get a detailed diagnostic message);

    Error in Constant (Error iN. constant) -Mathcad interprets the specified expression as an incorrect constant. Mathcad perceives everything starting with the digit as a constant. If you enter the number and directly behind it, Mathcad interprets it as an incorrect constant. A complete list of all possible corrective forms of constants is given in the section "End of the numbers" of the application;

    Error in the list (error iN. list) -this feature contains an incorrect list of arguments. The correct definition of the function begins in this way:

    cC, y, z. .): \u003d

    The list of arguments in brackets can consist of one or several names separated by the comma. Any other type of list is incorrect. This error message appears also if an invalid list is created in another context, for example, in the list of expressions for the class axis of the graphics;

    Definition area error (Domain error) -attempting to calculate the value of a function that has an argument leaving for the definition area. For example, an attempt to calculate 1P (0).

    File Error (File error) -the system has encountered an error when reading the file using the function Read. or Readprn.See the chapter "Data Files", where the valid data file formats are described;

    Definition Stack Overflow (Definition Stack Overflow) - used too many functions;

    Stack overflow (stack overflow ^. - The calculation of the expression led to the overflow of the MathCAD internal stack. It may be the result of "ohms too complex expression or recursive function;

    Overflow -an attempt to calculate the expression that the largest number can be represented by MathCAD (approximately 10 307). This may happen not only when the end result is in itself, but also in case of exceeding this limit by any intermediate result;

    Lost Digit Figures (Significance lOST) -this message marks an attempt to derive a function from the value that lies outside the range where the function can be calculated accurately. For example, it will appear when trying to calculate SIN (10 100). Since the value of SIN (IQI 00) depends on completely defined numbers of the number IQI 00, then any value that Mathcad will be able to return, will not have meaningful digits. Instead of returning the result, the accuracy of which is not justified, Mathcad issues this message;

    Interrupted (interrupted) -you interrupted Mathcad by pressing the key when performing computations. To recalculate the marked expression, click on the expression and press;

    Missed Operation Sign (Missing operator) -in the expression or equation, one of the operations of the operation is missing;

    Missing Operand operand) -in the expression, one of the operands were missed. For example, this message can be seen when entering the sign plus without entering the components and the subsequent presses of the equality sign. Mathcad shows the input field (small rectangle) at the site of the missed operand;

    Dimension in an innumerable degree - Expression with units of measurements is erected into a complex-valued or imaginary degree. If the expression has dimension, it can be erected only into a venational degree, otherwise MathCAD cannot define units in which the result is expressed;

    No solution found (DID not. find. solution) -Mathcad did not find the solution of the system of equations. In order for the block of solving the equations to issue an approaching result as a solution, use the function Minerr. Instead of function Find.For details, see Chapter "Solution of Equations";

    Too big expression (equation too. lARGE) -to calculate in Mathcad, too much expression has been introduced. Divide the expression on two or more subsections;

    Too big lower index (Subscript too. lARGE) -an attempt to use the lower index exceeding the limits allowed by Mathcad;

    Too large to display (Too Large to Display) - an attempt to output a vector or size matrix is \u200b\u200bgreater than Mathcad is allowed;

    Too few arguments (Tooo few arguments) -

    Too few restrictions (too few constraints) -this message indicates Find. or Given. With the number of restrictions less than variable numbers. Add insignificant limitations or reduce the number of variables relative to which the solution is searched. For details, see Chapter "Solution of Equations";

    Too few elements (Tooo few elements) -this message indicates Fourier transform, a cubic spline or a linear interpolation function used for a vector with a too small amount of components. Fourier transformation and reverse to it require at least four elements of the vector;

    Too many arguments (Tooo many. arguments) -the specified expression contains a function with a too small number of arguments. For embedded functions, the number of arguments is fixed; See chapter "Built-in Functions". For user functions, the number of parameters depends on the definition made in the working document;

    Too many indices (Tooo many. subscripts) -two or lower indexes are used for vector or three or more indexes for the matrix;

    Too many restrictions (too many. constraints) - inthe equation solutions block use more than fifty limitations;

    Too many points (Tooo many. pOINTS) -attempting to display points more than Mathcad can handle for one graph;

    Too many files - Open too many files using such file access functions as WritePrn, ReadPrn, or other functions of this type. At the same time, no more than 30 files can be opened. Select Team Attach to the file From the menu File, Enter the name of one of the file variables used and click "Disconnect";

    Only character operator -an attempt to obtain a numerical result in an expression that should be calculated only symbolized. Some operators must only be calculated symbolized as described in Chapter 17 "Symvented Calculations";

    File not found (File not. found) -the system did not find the data file specified as a function parameter Read. or Readprn Either for importing into the graphic area.

    2. Mathcad language elements

    The main elements of Mathcad mathematical expressions include operators, constants, variables, arrays and functions.

    2.1 Operators

    Operators - MathCAD items, with which you can create mathematical expressions. These, for example, include symbols of arithmetic operations, marks of calculating amounts, works, derivative, integral, etc.

    The operator determines:

    a) the action that must be performed in the presence of certain values \u200b\u200bof the operands;

    b) How many, where and which operands should be entered into the operator.

    Operand - The number or expression on which the operator operates. For example, in expression 5! +3 Numbers 5! and 3 operands operator "+" (plus), and the number 5 - Operand factorial (!).

    Any operator in MathCAD can be entered in two ways:

    · By pressing the key (keyboard shortcut) on the keyboard;

    · Using a mathematical panel.

    To assign or output the contents of a memory cell associated with a variable, the following operators are used:

    - assignment sign (entered by pressing the key : on the keyboard (colon in the English keyboard layout) or by pressing the corresponding button on the panel Calculator );

    This assignment is called lAN . Prior to this assignment, the variable is not defined and cannot be used.

    - Global assignment operator. This assignment can be made anywhere in the document. For example, if the variable is assigned to the value at the very end of the document, it will have the same value at the beginning of the document. - Operator of approximate equality (x1). Used in solving systems of equations. Entered by pressing a key ; on the keyboard (point with a comma in the English keyboard layout) or by pressing the corresponding button on Boolean panel.

    The operator (simply equal), allotted to output the constant or variable value.

    Simplest calculations

    The calculation process is carried out using:

    Calculator panels, calculator panels and evaluation panels.

    Attention. If you need to share all the expression in the numerator, it must be initially highlighted by pressing the spacebar on the keyboard or by placing in brackets.

    2.2 Constants

    Constants - Renovated objects that store some values \u200b\u200bthat cannot be changed.

    For example, P \u003d 3.14.

    Dimensional constants - These are generally accepted units of measurement. For example, meters, seconds, etc.

    To write the dimensional constant, you need to enter a sign * (multiply), select the menu item Insert subparagraph Unit . In measurements, the most famous categories: Length - length (m, km, cm); Mass - weight (gr, kg, t); Time - time (min, sec, hour).


    2.3 variables

    Variables are named objects that have a certain value that can change in the course of the program execution. Variables can be numeric, string, symbol, etc. Values \u200b\u200bvariables are set using the assignment sign (: \u003d).

    Attention . Mathcad Capital and lowercase letters perceives as different identifiers.

    System variables

    IN MathCAD. There is a small group of special objects that cannot be attributed to the class of constants or the class of variables whose values \u200b\u200bare defined immediately after the program is started. They are more correct to consider system variables. This, for example, TOL is the error of numerical calculations, Origin - the lower boundary value of the index index of vectors, matrices, etc. The values \u200b\u200bof these variables can be set other if necessary.

    Ranked variables

    These variables have a number of fixed values, or integer or changing with a certain step from the initial value to the final.

    To create a ranked variable, an expression is used:

    Name \u003d n begin, (n begin + step) .. n end,

    where Name is the name of the variable;

    N begin - initial value;

    STEP - specified variable change step;

    N END - the final value.

    The ranked variables are widely used in the construction of graphs. For example, to build a graph of some function f. ( x.) First of all, you need to create a number of variable values x. - For this, it must be a ranked variable.

    Attention. If in the variable change range does not specify a step, the program will automatically accept it equal to 1.

    Example . Variable x. varies in the range from -16 to +16 in increments 0.1

    To burn a ranked variable, you need to enter:

    Variable name ( x.);

    Sign assignment (: \u003d)

    The first value of the range (-16);

    Comma;

    The second value of the range, which is the sum of the first value and step (-16 + 0.1);

    Ellipsis ( .. ) - changing the variable in the specified limits (a dot is entered by pressing a point with a comma in English keyboard layout);

    The last value of the range (16).

    As a result, you will succeed: x. := –16,–16+0.1..16.

    Output tables

    Any expression with ranked variables after the equal sign initiates the output table.

    In the output table, you can also insert numeric values \u200b\u200band adjust them.

    Variable with index

    Variable with index - This is a variable that is assigned a set of non-other numbers, each of which has its own number (index).

    Entering the index is carried out by pressing the left square bracket on the keyboard or using the button x N. On the panel Calculator .

    As an index, you can use both the constant and the expression. To initialize the variable with the index, you must enter the elements of the array, separating them with commas.

    Example. Enter index variables.

    - entering numeric values \u200b\u200bto the table is made through commas; - output the value of the first element of the vector s; - output of the value of the zero element vector S.

    Did you like the article? Share it