Biographies Characteristics Analysis

MathCAD manual. MathCAD manual - training manual

Mathcad is a software tool, an environment for performing various mathematical and technical calculations on a computer, equipped with an easy-to-learn and easy-to-use graphical interface that provides the user with tools for working with formulas, numbers, graphs and texts. More than a hundred operators and logical functions are available in the Mathcad environment, designed for numerical and symbolic solving of mathematical problems of varying complexity.

To automate mathematical, engineering and scientific calculations, a variety of computing tools are used - from programmable microcalculators to supercomputers. And, nevertheless, such calculations for many remain a difficult matter. Moreover, the use of computers for calculations has introduced new difficulties: before starting calculations, the user must master the basics of algorithmization, learn one or more programming languages, as well as numerical methods of calculation. The situation has changed significantly after the release of specialized software systems for the automation of mathematical and engineering calculations.

Such complexes include software packages Mathcad, MatLab, Mathematica, Maple, MuPAD, Derive, etc. Mathcad occupies a special position in this series.

Mathcad is an integrated system for solving mathematical, engineering and scientific problems. It contains a text and formula editor, a calculator, scientific and business graphics tools, as well as a huge database of reference information, both mathematical and engineering, designed as a reference book built into Mathcad, a set of electronic books and ordinary "paper" books, including and in Russian

The text editor is used to enter and edit texts. The texts are comments and the mathematical expressions included in them are not executed. The text can consist of words, mathematical symbols, expressions and formulas.

The formula processor provides a natural "multi-story" set of formulas in familiar mathematical notation (division, multiplication, square root, integral, sum, etc.). The latest version of Mathcad fully supports Cyrillic letters in comments, formulas and graphs.

The calculator provides calculations using complex mathematical formulas, has a large set of built-in mathematical functions, allows you to calculate series, sums, products, integrals, derivatives, work with complex numbers, solve linear and nonlinear equations, as well as differential equations and systems, minimize and maximize functions , perform vector and matrix operations, statistical analysis, etc. You can easily change the bit depth and base of numbers (binary, octal, decimal and hexadecimal), as well as the error of iterative methods. Automatic control of dimensions and recalculation in different systems of measurement (SI, GHS, Anglo-American, as well as custom).

Mathcad has built-in symbolic mathematics tools that allow you to solve problems through computer analytical transformations.

The GPU is used to create graphs and charts. It combines ease of communication with the user with the power of business and scientific graphics. Graphics is focused on solving typical mathematical problems. It is possible to quickly change the type and size of graphs, overlay text labels on them and move them to any place in the document.

Mathcad is a universal system, i.e. can be used in any field of science and technology - wherever mathematical methods are applied. Writing commands in the Mathcad system in a language very close to the standard language of mathematical calculations simplifies the formulation and solution of problems.

Mathcad is integrated with all other computer scoring systems.

Mathcad makes it easy to solve problems such as:

entering various mathematical expressions on a computer (for further calculations or creating documents, presentations, Web pages or electronic and ordinary "paper" books);

carrying out mathematical calculations (both analytical and numerical methods);

preparation of graphs (both two-dimensional and three-dimensional) with the results of calculations;

input of initial data and output of results to text files or files with databases in other formats;

preparation of work reports in the form of printed documents;

preparation of Web pages and publication of results on the Internet;

obtaining various reference information

and many other tasks.

Since version 14, Mathcad has been integrated with Pro/ENGINEER (as well as with SolidWorks). Mathcad and Pro/ENGINEER integration is based on two-way communication between these applications. Their users can easily link any Mathcad file to a Pro/ENGINEER part and assembly using the Pro/ENGINEER feature analysis feature.

Mathcad creates a convenient computing environment for a wide variety of mathematical calculations and documentation of the results of work within the approved standards. Mathcad allows you to create corporate and industry certified calculation tools in various fields of science and technology, providing a single methodology for all organizations that are part of a corporation or industry

The latest version of Mathcad supports 9 languages, allows for more powerful and clear calculations.

NEEDHAM (Massachusetts). On February 12, 2007, PTC (Nasdaq listed: PMTC), a CAD/CAM/CAE/PLM systems development company, announced the release of Mathcad 14.0, the latest version of the popular engineering calculation automation system. Since acquiring Mathsoft in April 2006, PTC has focused its efforts to further expand the geographic reach of Mathcad technology and significantly increase its user base. Mathcad 14.0 significantly expands the user's capabilities in solving ever-growing computational problems, improves the coherence of calculation documents throughout the entire product development process.

In today's global division of the product development process, scientific and technical calculations are becoming extremely important. With the release of Mathcad 14.0, PTC provides full Unicode support and will soon offer the product in nine languages. New among them will be languages ​​such as Italian, Spanish, Korean and both Chinese - traditional and simplified. Expanded language support in Mathcad 14.0 will allow geographically dispersed teams to perform and document calculations in their local language and as a result increase productivity by increasing its speed and accuracy, as well as reducing errors that occur when translating from one language to another.

Mathcad 14.0 also allows you to perform more complex calculations while maintaining their clarity with the new features of the WorkSheet (a document opened in the Mathcad environment), additional online numerical evaluation tools, and an extended character set. This will help users in deriving formulas, displaying the computational process and documenting the calculations. Ultimately, dedicated add-ons will allow users to work on a wider range of engineering tasks.

Mathcad and Pro/ENGINEER integration is based on two-way communication between these applications. Their users can easily link any Mathcad file to a Pro/ENGINEER part and assembly using the Pro/ENGINEER feature analysis feature. Basic values ​​calculated in the Mathcad system can be translated into parameters and dimensions of a CAD model to control a geometric object. Parameters from the Pro/ENGINEER model can also be entered into Mathcad for subsequent engineering calculations. When changing parameters, the mutual integration of the two systems allows you to dynamically update the calculations and drawing of the object. Moreover, Mathcad-driven Pro/ENGINEER models can now be validated using Pro/ENGINEER simulation modules such as Pro/ENGINEER Mechanica®, Structural And Thermal Simulation, Fatique Advisor Option, and Mechanism Dynamics Option.

What's new in Mathcad 14.0?

New tandem of interface operators ("Two in One")

Format of numbers on charts

Find/Replace command changes

Compare command

New in solving ODE

New means of symbolic mathematics

Unicode code table support

User Interface

The user interface means a set of Math CAD graphical shell tools that provide easy system control, both from the keyboard and with the mouse. Control is understood as just a set of necessary symbols, formulas, text comments, etc., and the possibility of complete preparation of documents (Work Sheets) and electronic books in the MathCAD environment with their subsequent launch in real time. The user interface of the system is designed so that a user with basic skills in working with Windows applications can immediately start working with MathCAD.

Edit window.

Main menu of the system.

The second line of the system window is the main menu. The purpose of its commands is given below:

File (File) - work with files, the Internet and e-mail;

PAGE_BREAK--

The drop-down menu contains commands that are standard for Windows applications.

Edit (Editing) - editing documents;

The drop-down menu also contains commands that are standard for Windows applications. Most of them are available only if one or more areas (text, formula, graph, etc.) are selected in the document.

View (Overview) - change the means of review;

Toolbars (Panels) - allows you to display or hide the toolbars Standard (Standard), Formatting (Formatting), Math (Mathematics).

Status bar - Enable or disable the display of the system status bar.

Ruler(ruler) - enable/disable the ruler.

Regions (Borders) - Makes visible the borders of regions (text, graphics, formulas).

Zoom (zoom).

Refresh - Refreshes the contents of the screen.

Animate (Animation) - The command allows you to create an animation.

Playback (Player) - Play back animation stored in a file with the AVI extension.

Preferences (Settings) - One of the tabs of the pop-up window (General) allows you to set some parameters of the program that do not affect the calculations, the other tab (Internet) is used to enter information when working together with MathCAD-documents via the Internet.

Insert (Insert) - The commands on this menu allow you to place graphics, functions, hyperlinks, components and embed objects into the MathCAD document.

Format - change the format of objects

Equation - Formatting formulas and creating your own styles for representing data

Result(Result) - Allows you to set the format for presenting the results of calculations. (See section 1.4 of this lecture)

Text(Text) - Text fragment formatting (font, size, style)

Paragraf (Paragraph) - Change the format of the current paragraph (indents, alignment).

Tabs (Tabulation) - Setting the positions of the tabulation markers.

Style (Style) - Formatting text paragraphs.

Properties (Properties) - Tab Display (Display) allows you to set the background color for the most important text and graphic areas; the picture inserted into the document (Insert -> Picture) allows you to enclose it in a frame, return it to its original size. Vkvadka Calculation (Calculation) allows you to enable and disable the calculation for the selected formula; in the latter case, a small black rectangle appears in the upper right corner of the formula area and the formula becomes a comment.

Graf (Graph) - Allows you to change the parameters for displaying graphs

Separate regions - Allows you to expand overlapping regions.

Align regions - Aligns the selected regions horizontally or vertically.

Headers/Footers (Headers and footers) - creation and editing of headers and footers.

Repaganite Now (Renumbering pages) - Produces a breakdown of the current document into pages.

Math (Mathematics) - management of the calculation process; There are two calculation modes in MathCAD: automatic and manual. In automatic mode, the results of calculations are completely updated when there is any change in the formula.

Automatic Calculation - Allows you to switch calculation modes.

Calculate - In manual calculation mode, allows you to recalculate the visible part of the screen.

Optimization (Optimization) - Using this command, you can force MathCAD to perform symbolic calculations before the numerical evaluation of the expression and, when finding a more compact form of the expression, use it. If the expression was optimized, then a small red asterisk appears to the right of it. Double clicking on it opens a window containing the optimized result.

Options - allows you to set calculation options

Symbolik (Symbols) - selection of symbolic processor operations;

The positions of this menu are discussed in detail in Lecture 6, devoted to symbolic calculations in the MathCAD system.

Window (Window) - management of system windows;

Help (?) – work with the reference database about the system;

Mathcad Help (Help for MathCAD) - contains three tabs: Contents - Help is organized by topic; Index - subject index; Search - finds the desired concept when entering it into the form.

Resource Center - Information center containing an overview of MathCAD computing capabilities (Overview and Tutorials), quick help in the form of examples from various areas of mathematics (Quicksheets and Reference tables).

Tip of the Day - Pop-up windows with useful tips (appear when the system boots).

Open Book - allows you to open the MathCAD system reference.

About Mathcad (About the program Mathcad) - information about the version of the program, copyright and user.

Each item of the main menu can be made active. To do this, just point to it with the cursor - the mouse arrow and press its left button. You can also press the F10 key and use the right and left navigation keys. The selection is then fixed by pressing the Enter key. If any position of the main menu is made active, it displays a drop-down submenu with a list of available and unavailable (but possible in the future) operations. Moving through the list of submenus and selecting the desired operation is done in the same way as described for the main menu.

Standard toolbar.

The third line of the system window is occupied by the Toolbox. It contains several groups of control buttons with icons, each of which duplicates one of the most important operations of the main menu. As soon as you stop the mouse cursor on any of these icons, text will appear in the yellow box explaining the functions of the icons. Consider the action of the buttons for quick system control.

File operation buttons.

Documents of the MathCAD system are files, i.e. named storage units on magnetic disks. Files can be created, downloaded (opened), recorded and printed on a printer. Possible operations with files are presented in the toolbar by the first group of three buttons:

New Worksheet (Create) - creating a new document with clearing the editing window;

Open Worksheet (Open) - loading a previously created document from a dialog box;

Save Worksheet - record the current document with its name.

Printing and control of documents.

Print Worksheet (Print) - printout of the document on the printer;

Print Preview (View) - a preview of the document;

Check Spelling - check the spelling of the document.

Buttons for editing operations.

During the preparation of documents, they have to be edited, i.e. modify and supplement.

Continuation
--PAGE_BREAK--

Cut (Cut) - transferring the selected part of the document to the clipboard with clearing this part of the document;

Copy (Copy) - copying the selected part of the document to the clipboard while saving the selected part of the document;

Paste (Insert) - transferring the contents of the clipboard to the editing window at the location indicated by the mouse cursor;

Undo - cancel the previous editing operation;

The last three operations are related to the use of the clipboard. It is intended for temporary storage of data and their transfer from one part of the document to another, or for organizing data exchange between different applications.

Block placement buttons.

Documents consist of various blocks: textual, formal, graphic, etc. Blocks are viewed by the system, interpreted and executed. Viewing is from right to left and from bottom to top.

/>- Align Across (Align horizontally) - blocks are aligned horizontally.

/>- Align Down - blocks are aligned vertically, from top to bottom.

The pictograms of these buttons depict the blocks and the indicated options for their placement.

Expression operation buttons

Formula blocks are often calculated expressions or expressions that are part of user-defined new functions. Icons are used to work with expressions.

The following groups of buttons are specific to the MathCAD system.

/>Insert Function - insert a function from the list that appears in the dialog box;

/>Insert Unit (Insert units) - insert units of measure;

Access to new features of MathCAD.

Starting from version MathCAD 7.0, new buttons have appeared that give access to new system features:

/>Component Wizard - opens the Wizard window, giving easy access to all system components;

/>Ran Math Connex (Running the Math Connex system) - runs the system to incentivize block devices.

Resource control buttons.

/>Resource Center - gives access to the resource center;

/>Help (Help) - gives access to the resources of the system's help database.

Formatting panel.

The fourth line at the top of the screen contains typical font controls:

Style - Style selection switch;

Font - Switch for choosing a character set;

Point Size - Switch for selecting character sizes;

Bold - Set bold characters;

Italik - Set italic characters;

Underline - Set underlined characters;

Left Align - Setting the left alignment;

Center Align - Set the alignment to the center;

Right Align - Setting the right alignment.

Until the set of document elements is started, some of the described buttons and other user interface objects are in a passive state. In particular, there are no labels in the format bar switch boxes. Icons and switches become active as soon as there is a need to use them.

At the bottom of the screen, in addition to the horizontal scroll bar, there is another line - the status bar. It displays service information, brief comments, page number, etc. This information is useful for quickly assessing the state of the system while working with it.

Typesetting mathematical toolbars.

To enter mathematical symbols in MathCAD, convenient movable typesetting panels with signs are used. They serve to output blanks - templates of mathematical signs (numbers, signs of arithmetic operations, matrices, signs of integrals, derivatives, etc.). To display the Math panel, execute the View -> Toolbar -> Math command. Typesetting panels appear in the document editing window when the corresponding icons are activated - the first line of system control icons. Using a common typesetting panel, you can display either all the panels at once or only those that are needed for work. To set the required template with their help, it is enough to place the cursor in the desired location of the editing window (red cross on the color display) and then activate the icon of the desired template by placing the mouse cursor on it and pressing its left button.

Many of the functions and operations that are inserted into a document using math typesetting pads can be placed into a document using keyboard shortcuts. At the same time, work in the MathCAD system becomes more productive. We recommend that you memorize keyboard shortcuts for at least some of the most commonly used commands.

More details on working with additional panels enabled by the buttons of the Math panel will be described in the relevant sections.

1. MathCAD working window

· Panel Mathematics(Fig. 1.4).

Rice. 1.4. Math Panel

Clicking on the math toolbar button opens an additional toolbar:

2. Elements of language MathCAD

The basic elements of MathCAD mathematical expressions include operators, constants, variables, arrays, and functions.

2.1 Operators

Operators -- elements of MathCAD with which you can create mathematical expressions. These, for example, include symbols for arithmetic operations, signs for calculating sums, products, derivatives, integrals, etc.

The operator defines:

a) the action to be performed in the presence of certain values ​​of the operands;

b) how many, where and what operands should be entered into the operator.

Operand -- the number or expression that the operator acts on. For example, in the expression 5!+3, the numbers 5! and 3 are the operands of the "+" (plus) operator, and the number 5 is the operand of the factorial (!).

Any operator in MathCAD can be entered in two ways:

by pressing a key (key combination) on the keyboard;

using the math panel.

The following statements are used to assign or display the contents of the memory location associated with a variable:

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 local. 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 a variable is assigned a value in this way at the very end of the document, then it will have the same value at the beginning of the document.

Approximate equality operator (x1). Used in solving systems of equations. Entered by pressing a key ; on the keyboard (semicolon in the English keyboard layout) or by pressing the corresponding button on Boolean panel.

An operator (simple equals) reserved for outputting the value of a constant or variable.

The simplest calculations

The calculation process is carried out using:

Calculator Panels, Calculus Panels and Estimation Panels.

Attention. If it is necessary to divide the entire expression in the numerator, then it must first be selected by pressing the spacebar on the keyboard or by placing it in brackets.

2.2 Constants

Constants -- named objects that hold some value that cannot be changed.

For example, = 3.14.

Dimensional constants are common units of measurement. For example, meters, seconds, etc.

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

2.3 Variables

Variables are named objects that have some value that can change as the program runs. Variables can be numeric, string, character, etc. Variables are assigned values ​​using the assign sign (:=).

Attention. MathCAD treats uppercase and lowercase letters as different identifiers.

System variables

AT MathCAD contains a small group of special objects that cannot be attributed either to the class of constants or to the class of variables, the values ​​of which are determined immediately after the program is started. It is better to count them system variables. This, for example, TOL - the error of numerical calculations, ORIGIN - the lower limit of the value of the index index of vectors, matrices, etc. If necessary, you can set other values ​​for these variables.

Ranked Variables

These variables have a series of fixed values, either integer or varying in a certain step from the initial value to the final one.

An expression is used to create a ranged variable:

Name=N begin ,(N begin +Step).N end ,

where Name is the name of the variable;

N begin -- initial value;

Step -- the specified step for changing the variable;

N end -- end value.

Ranked variables are widely used in plotting. For example, to plot a graph of some function f(x) first of all, you need to create a series of variable values x-- it must be a ranged variable for this to work.

Attention. If you do not specify a step in the variable range, the program will automatically take it equal to 1.

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

To write a ranged variable, you would type:

- variable name ( x);

- assignment sign (:=)

- the first value of the range (-16);

- a comma;

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

- ellipsis ( . ) -- changing the variable within the given limits (ellipsis is entered by pressing a semicolon in the English keyboard layout);

— the last value of the range (16).

As a result, you will get: x := -16,-16+0.1.16.

Output tables

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

You can insert numerical values ​​into the output tables and correct them.

Variable with index

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

The index is entered by pressing the left square bracket on the keyboard or using the button x n on the panel Calculator.

You can use either a constant or an expression as an index. To initialize a variable with an index, you must enter the elements of the array, separating them with commas.

Example. Entering index variables.

Numeric values ​​are entered into the table separated by commas;

Output of the value of the first element of the vector S;

Outputting the value of the zero element of the vector S.

2.4 Arrays

array -- a uniquely named collection of a finite number of numeric or character elements, ordered in some way and having specific addresses.

In the package MathCAD arrays of the two most common types are used:

one-dimensional (vectors);

two-dimensional (matrices).

You can output a matrix or vector template in one of the following ways:

select menu item Insert - Matrix;

press the key combination ctrl + M;

press the button on panel and vectors and matrices.

As a result, a dialog box will appear in which the required number of rows and columns is set:

Rows-- number of lines

columns-- number of columns If a matrix (vector) needs to be given a name, then the name of the matrix (vector) is entered first, then the assignment operator, and then the matrix template.

for example:

Matrix -- a two-dimensional array named M n , m , consisting of n rows and m columns.

You can perform various mathematical operations on matrices.

2.5 Functions

Function -- an expression according to which some calculations are performed with arguments and its numerical value is determined. Function examples: sin(x), tan(x) and etc.

Functions in the MathCAD package can be either built-in or user-defined. Ways to insert an inline function:

Select menu item InsertFunction.

Press key combination ctrl + E.

Click the button on the toolbar.

Type the name of the function on the keyboard.

User functions are typically used when the same expression is evaluated multiple times. To set a user function:

Enter the name of the function with the obligatory indication of the argument in brackets, for example, f (x);

Enter the assignment operator (:=);

Enter a calculated expression.

Example. f (z) := sin(2 z 2)

3. Number Formatting

In MathCAD, you can change the output format of numbers. Usually calculations are made with an accuracy of 20 digits, but not all significant figures are displayed. To change the number format, double-click on the desired numerical result. The number formatting window will appear, open on the tab number Format (Number Format) with the following formats:

o General (Main) -- is the default. Numbers are displayed in order (for example, 1.2210 5). The number of signs of the mantissa is determined in the field Exponential Threshold(Exponential notation threshold). When the threshold is exceeded, the number is displayed in order. The number of digits after the decimal point changes in the field number of decimal places.

o Decimal (Decimal) -- The decimal representation of floating point numbers (for example, 12.2316).

o Scientific (Scientific) -- Numbers are displayed in order only.

o Engineering (Engineering) -- numbers are displayed only in multiples of three (for example, 1.2210 6).

Attention. If, after setting the desired format in the number formatting window, select the button OK, the format will be set only for the selected number. And if you select the Set as Default button, the format will be applied to all numbers in this document.

Numbers are automatically rounded down to zero if they are less than the set threshold. The threshold is set for the entire document, not for a specific result. In order to change the rounding threshold to zero, select the menu item Formatting - Result and in tab tolerance , in field Zero threshold enter the required threshold value.

4. Working with text

Text snippets are pieces of text that the user would like to see in their document. These can be explanations, links, comments, etc. They are inserted using the menu item InsertText region.

You can format the text: change the font, its size, style, alignment, etc. To do this, you need to select it and select the appropriate options on the font panel or in the menu FormattingText.

5. Working with graphics

When solving many problems where a function is being studied, it often becomes necessary to plot its graph, which will clearly reflect the behavior of the function on a certain interval.

In the MathCAD system, it is possible to build various types of graphs: in Cartesian and polar coordinate systems, three-dimensional graphs, surfaces of bodies of revolution, polyhedra, spatial curves, vector field graphs. We will look at how to build some of them.

5.1 Plotting 2D Plots

To build a two-dimensional graph of a function, you need to:

set a function

Place the cursor in the place where the graph should be built, on the mathematical panel select the Graph button (graph) and in the panel that opens, the X-Y Plot button (two-dimensional graph);

In the appeared template of a two-dimensional graph, which is an empty rectangle with data labels, enter the name of the variable in the central data label along the abscissa axis (X axis), and enter the name of the function in place of the central data label along the ordinate axis (Y axis) (Fig. 2.1 );

Rice. 2.1. 2D Plot Template

click outside the graph template -- the graph of the function will be plotted.

The argument range consists of 3 values: initial, second and final.

Let it be necessary to plot a function graph on the interval [-2,2] with a step of 0.2. Variable values t are specified as a range as follows:

t:= 2, - 1.8 . 2 ,

where: -2 -- the initial value of the range;

1.8 (-2 + 0.2) -- second range value (initial value plus step);

2 is the end value of the range.

Attention. An ellipsis is entered by pressing a semicolon in the English keyboard layout.

Example. Plotting a Function y = x 2 on the interval [-5.5] with a step of 0.5 (Fig. 2.2).

Rice. 2.2. Plotting a Function y = x 2

When plotting graphs, consider the following:

° If the range of the argument values ​​is not specified, then by default the graph is built in the range [-10,10].

° If it is necessary to place several graphs in one template, then the names of the functions are indicated separated by commas.

° If two functions have different arguments, for example f1(x) and f2(y), then the names of the functions are indicated on the ordinate (Y) axis, separated by commas, and on the abscissa (X) axis, the names of both variables are also separated by commas.

° The extreme data marks on the plot template serve to indicate the limit values ​​of the abscissas and ordinates, i.e. they set the scale of the plot. If you leave these labels blank, the scale will be set automatically. The automatic scale does not always reflect the graph in the desired form, so the limit values ​​of the abscissa and ordinates have to be edited by changing them manually.

Note. If after plotting the graph does not take the desired form, you can:

Reduce step.

· change the plotting interval.

Reduce the limit values ​​of abscissas and ordinates on the chart.

Example. Construction of a circle with a center at a point (2,3) and a radius R = 6.

The equation of a circle centered at a point with coordinates ( x 0 ,y 0) and radius R is written as:

Express from this equation y:

Thus, to construct a circle, it is necessary to set two functions: the upper and lower semicircles. The argument range is calculated as follows:

- initial value of the range = x 0 — R;

- final value of the range = x 0 + R;

- it is better to take the step equal to 0.1 (Fig. 2.3.).

Rice. 2.3. Construction of a circle

Parametric graph of a function

Sometimes it is more convenient instead of a line equation relating rectangular coordinates x and y, consider the so-called parametric line equations, which give expressions for the current x and y coordinates as functions of some variable t(parameter): x(t) and y(t). When constructing a parametric graph, the names of functions of one argument are indicated on the ordinate and abscissa axes.

Example. Construction of a circle centered at a point with coordinates (2,3) and radius R= 6. For the construction, the parametric equation of the circle is used

x = x 0 + R cos( t) y = y 0 + R sin( t) (Fig. 2.4.).

Rice. 2.4. Construction of a circle

Chart Formatting

To format a graph, double-click on the graph area. The Graph Formatting dialog box will open. The tabs in the chart formatting window are listed below:

§ X- Y axes-- formatting the coordinate axes. By checking the appropriate boxes, you can:

· Log Scale-- represent numerical values ​​on the axes in a logarithmic scale (by default, numerical values ​​are plotted in a linear scale)

· Grid lines-- draw a grid of lines;

· numbered-- Arrange the numbers along the coordinate axes;

· Auto Scale-- automatic selection of limit numerical values ​​on the axes (if this box is unchecked, the maximum calculated values ​​will be limit);

· show marker-- marking the graph in the form of horizontal or vertical dotted lines corresponding to the specified value on the axis, and the values ​​themselves are displayed at the end of the lines (2 input places appear on each axis, in which you can enter numerical values, do not enter anything, enter one number or letter designations of constants);

· Auto Grid-- automatic selection of the number of grid lines (if this box is unchecked, you must specify the number of lines in the Number of Grids field);

· crossed-- the abscissa axis passes through zero of the ordinate;

· Boxed-- the x-axis runs along the bottom edge of the graph.

§ Trace-- line formatting of function graphs. For each graph separately, you can change:

symbol (Symbol) on the chart for nodal points (circle, cross, rectangle, rhombus);

line type (Solid - solid, Dot - dotted line, Dash - strokes, Dadot - dash-dotted line);

line color (Color);

Type (Ture) of the chart (Lines - line, Points - points, Var or Solidbar - bars, Step - step chart, etc.);

line thickness (Weight).

§ Label -- title in the graph area. In field Title (Title) you can write the text of the title, select its position - at the top or bottom of the graph ( Above -- top, Below -- down below). You can enter, if necessary, the names of the argument and function ( Axis Labels ).

§ Defaults -- using this tab, you can return to the default chart view (Change to default), or use the changes you made on the chart by default for all charts in this document (Use for Defaults).

5.2 Building polar plots

To build a polar graph of a function, you need to:

· set the range of argument values;

set a function

· place the cursor in the place where the graph should be built, on the mathematical panel select the Graph button (graph) and in the panel that opens, the Polar Plot button (polar graph);

· in the input fields of the template that appears, you must enter the angular argument of the function (below) and the name of the function (left).

Example. Construction of Bernoulli's lemniscate: (Fig. 2.6.)

Rice. 2.6. An example of building a polar plot

5.3 Plotting Surfaces (3D or 3D Plots)

When constructing three-dimensional graphs, the panel is used graph(Graph) math panel. You can build a three-dimensional graph using the wizard, called from the main menu; you can build a graph by creating a matrix of values ​​​​of a function of two variables; you can use the accelerated construction method; you can call the special functions CreateMech and CreateSpase, designed to create an array of function values ​​and plot. We will consider an accelerated method for constructing a three-dimensional graph.

Quick Graphing

To quickly build a three-dimensional graph of a function, you need to:

set a function

place the cursor in the place where the graph should be built, select the button on the mathematical panel graph(Chart) and in the opened panel the button ( surface graph);

· in the only place of the template, enter the name of the function (without specifying variables);

· click outside the chart template -- the function graph will be built.

Example. Plotting a Function z(x,y) = x 2 + y 2 - 30 (Fig. 2.7).

Rice. 2.7. An Example of a Quick Surface Plot

The built chart can be controlled:

° rotation of the graph is performed after hovering the mouse pointer over it with the left mouse button pressed;

° scaling of the chart is performed after hovering the mouse pointer over it by simultaneously pressing the left mouse button and the Ctrl key (if you move the mouse, the chart zooms in or out);

° chart animation is performed in the same way, but with the Shift key pressed additionally. It is only necessary to start rotating the graph with the mouse, then the animation will be performed automatically. To stop the rotation, click the left mouse button inside the graph area.

It is possible to build several surfaces at once in one drawing. To do this, you need to set both functions and specify the names of the functions on the chart template separated by commas.

When plotting quickly, the default values ​​for both arguments are between -5 and +5 and the number of contour lines is 20. To change these values, you must:

· double click on the chart;

· select the Quick Plot Data tab in the opened window;

· enter new values ​​in the window area Range1 -- for the first argument and Range2 -- for the second argument (start -- initial value, end -- final value);

· in the # of Grids field, change the number of grid lines covering the surface;

· Click the OK button.

Example. Plotting a Function z(x,y) = -sin ( x 2 + y 2) (Fig. 2.9).

When constructing this graph, it is better to choose the limits of change in the values ​​of both arguments from -2 to +2.

Rice. 2.9. An example of plotting a function graph z(x,y) = -sin ( x 2 + y 2)

forematting 3D graphs

To format the graph, double-click on the plot area - a formatting window with several tabs will appear: Appearance, General, axes, lighting, Title, Backplanes, Special, Advanced, Quick Plot Data.

Purpose of the tab Quick Plot Data was discussed above (23, "https://site").

Tab Appearance allows you to change the appearance of the graph. Field Fill Options allows you to change the fill parameters, field line Option-- line parameters, point Options-- point parameters.

In the tab General ( general) in the group view you can choose the angles of rotation of the depicted surface around all three axes; in a group display as You can change the chart type.

In the tab lighting(lighting) you can control the lighting by checking the box enable lighting(turn on lights) and switch On(turn on). One of 6 possible lighting schemes is selected from the list lighting scheme(lighting scheme).

6. Ways to solve equations in MathCAD

In this section, we will learn how the simplest equations of the form F ( x) = 0. To solve an equation analytically means to find all its roots, that is, such numbers, when substituting them into the original equation, we obtain the correct equality. To solve the equation graphically means to find the points of intersection of the graph of the function with the x-axis.

6. 1 Solving equations with the function root(f(x), x)

For solutions of an equation with one unknown of the form F ( x) = 0 there is a special function

root(f(x), x) ,

where f(x) is an expression equal to zero;

X-- argument.

This function returns, with a given precision, the value of a variable for which the expression f(x) is equal to 0.

Attentione. If the right side of the equation is 0, then it is necessary to bring it to normal form (transfer everything to the left side).

Before using the function root must be given to the argument X initial approximation. If there are several roots, then to find each root, you must specify your initial approximation.

Attention. Before solving, it is desirable to plot a function graph to check if there are roots (does the graph intersect the Ox axis), and if so, how many. The initial approximation can be chosen according to the graph closer to the intersection point.

Example. Solving an equation using a function root shown in Figure 3.1. Before proceeding to the solution in the MathCAD system, in the equation we will transfer everything to the left side. The equation will take the form: .

Rice. 3.1. Solving an Equation Using the Root Function

6. 2 Solving equations with the Polyroots (v) function

To simultaneously find all the roots of a polynomial, use the function polyroots(v), where v is the vector of coefficients of the polynomial, starting from the free term . Zero coefficients cannot be omitted. Unlike the function root function Polyroots does not require an initial approximation.

Example. Solving an equation using a function polyroots shown in Figure 3.2.

Rice. 3.2. Solving an Equation Using the Polyroots Function

6.3 Solving equations with the Find (x) function

The Find function works in conjunction with the Given keyword. Design GivenFind

If the equation is given f(x) = 0, then it can be solved as follows using the block Given - Find:

— set the initial approximation

— enter a service word

- write the equation using the sign bold equals

- write a find function with an unknown variable as a parameter

As a result, after the equal sign, the found root will be displayed.

If there are several roots, then they can be found by changing the initial approximation x0 to one close to the desired root.

Example. The solution of the equation using the find function is shown in Figure 3.3.

Rice. 3.3. Solving an equation with the find function

Sometimes it becomes necessary to mark some points on the graph (for example, the points of intersection of a function with the Ox axis). For this you need:

Specify the x value of a given point (along the Ox axis) and the value of the function at this point (along the Oy axis);

double click on the graph and in the formatting window in the tab traces for the corresponding line, select the graph type - points, line thickness - 2 or 3.

Example. The graph shows the point of intersection of the function with the x-axis. Coordinate X this point was found in the previous example: X= 2.742 (root of the equation ) (Fig. 3.4).

Rice. 3.4. Graph of a function with a marked intersection point In the graph formatting window, in the tab traces for trace2 changed: chart type - points, line thickness - 3, color - black.

7. Solving systems of equations

7.1 Solving systems of linear equations

The system of linear equations can be solved m matrix method (either through the inverse matrix or using the function lsolve(A, B)) and using two functions Find and features Minerr.

Matrix method

Example. The system of equations is given:

The solution of this system of equations by the matrix method is shown in Figure 4.1.

Rice. 4.1. Solving a system of linear equations by a matrix method

Function use lsolve(A, B)

Lsolve(A, B) is a built-in function that returns a vector X for a system of linear equations given a matrix of coefficients, A, and a vector of free terms, B .

Example. The system of equations is given:

The way to solve this system using the function lsolve (A, B) is shown in Figure 4.2.

Rice. 4.2. Solving a system of linear equations using the lsolve function

Solving a system of linear equations via functionsand Find

With this method, equations are entered without the use of matrices, i.e., in "natural form". First, it is necessary to indicate the initial approximations of the unknown variables. It can be any number within the scope of the definition. Often they are mistaken for a column of free members.

In order to solve a system of linear equations using a computing unit Given - Find, necessary:

2) enter a service word Given;

bold equals();

4) write a function Find,

Example. The system of equations is given:

The solution of this system using a computing unit Given - Find shown in Figure 4.3.

Rice. 4.3. Solving a system of linear equations using the Find function

Approximate psolution of a system of linear equations

Solving a system of linear equations using a function Minerr similar to the solution using the function Find(using the same algorithm), function only Find gives the exact solution, and Minerr-- approximate. If, as a result of the search, no further refinement of the current approximation to the solution can be obtained, Minerr returns this approximation. Function Find in this case returns an error message.

You can choose another initial approximation.

· You can increase or decrease the calculation accuracy. To do this, select from the menu Math > Options(Math - Options), tab built- In Variables(Built-in variables). In the tab that opens, you need to reduce the allowable calculation error (Convergence Tolerance (TOL)). Default TOL = 0.001.

ATattention. With the matrix solution method, it is necessary to rearrange the coefficients according to the increase in unknowns X 1, X 2, X 3, X 4.

7.2 Solving systems of nonlinear equations

Systems of nonlinear equations in MathCAD are solved using a computing unit Given - Find.

Design Given - Find uses a computational technique based on finding a root near an initial approximation point specified by the user.

To solve a system of equations using the block Given - Find necessary:

1) set initial approximations for all variables;

2) enter a service word Given;

3) write down the system of equations using the sign bold equals();

4) write a function Find, by listing unknown variables as function parameters.

As a result of calculations, the solution vector of the system will be displayed.

If the system has several solutions, the algorithm should be repeated with other initial guesses.

Note. If a system of two equations with two unknowns is being solved, before solving it, it is desirable to plot function graphs in order to check whether the system has roots (whether the graphs of given functions intersect), and if so, how many. The initial approximation can be chosen according to the graph closer to the intersection point.

Example. Given a system of equations

Before solving the system, we construct graphs of functions: parabolas (the first equation) and a straight line (the second equation). The construction of a graph of a straight line and a parabola in one coordinate system is shown in Figure 4.5:

Rice. 4.5. Plotting two functions in the same coordinate system A line and a parabola intersect at two points, which means that the system has two solutions. According to the graph, we choose the initial approximations of the unknowns x and y for every solution. Finding the roots of the system of equations is shown in Figure 4.6.

Rice. 4.6. Finding the roots of a system of nonlinear equations X ) and along the Oy axis (values at ) separated by commas. In the chart formatting window, in the tab traces for trace3 and trace4 change: chart type - points, line thickness - 3, color - black (Fig. 4.7).

Rice. 4.7. Function plots with marked intersection points

8 . Key Features Usage Examples MathCAD to solve some mathematical problems

This section provides examples of solving problems that require solving an equation or a system of equations.

8. 1 Finding local extrema of functions

The necessary condition for an extremum (maximum and/or minimum) of a continuous function is formulated as follows: extrema can take place only at those points where the derivative is either equal to zero or does not exist (in particular, it becomes infinity). To find the extrema of a continuous function, first find the points that satisfy the necessary condition, that is, find all the real roots of the equation.

If a function graph is built, then you can immediately see - the maximum or minimum is reached at a given point X. If there is no graph, then each of the found roots is examined in one of the ways.

1st with allowance . With equalize e signs of the derivative . The sign of the derivative is determined in the vicinity of the point (at points that are separated from the extremum of the function on different sides at small distances). If the sign of the derivative changes from "+" to "-", then at this point the function has a maximum. If the sign changes from "-" to "+", then at this point the function has a minimum. If the sign of the derivative does not change, then there are no extremums.

2nd s allowance . AT calculations e second derivative . In this case, the second derivative is calculated at the extremum point. If it is less than zero, then at this point the function has a maximum, if it is greater than zero, then a minimum.

Example. Finding extrema (minimums/maximums) of a function.

First, let's build a graph of the function (Fig. 6.1).

Rice. 6.1. Plotting a Function

Let us determine from the graph the initial approximations of the values X corresponding to local extrema of the function f(x). Let's find these extrema by solving the equation. For the solution, we use the Given - Find block (Fig. 6.2.).

Rice. 6.2. Finding local extrema

Let us define the type of extremums pervway, examining the change in the sign of the derivative in the vicinity of the found values ​​(Fig. 6.3).

Rice. 6.3. Determining the type of extremum

It can be seen from the table of values ​​of the derivative and from the graph that the sign of the derivative in the vicinity of the point x 1 changes from plus to minus, so the function reaches its maximum at this point. And in the vicinity of the point x 2, the sign of the derivative has changed from minus to plus, so at this point the function reaches a minimum.

Let us define the type of extremums secondway, calculating the sign of the second derivative (Fig. 6.4).

Rice. 6.4. Determining the type of extremum using the second derivative

It can be seen that at the point x 1 the second derivative is less than zero, so the point X 1 corresponds to the maximum of the function. And at the point x 2 the second derivative is greater than zero, so the point X 2 corresponds to the minimum of the function.

8.2 Determining the areas of figures bounded by continuous lines

Area of ​​a curvilinear trapezoid bounded by a graph of a function f(x) , a segment on the Ox axis and two verticals X = a and X = b, a < b, is determined by the formula: .

Example. Finding the area of ​​a figure bounded by lines f(x) = 1 — x 2 and y = 0.

Rice. 6.5. Finding the area of ​​a figure bounded by lines f(x) = 1 — x 2 and y = 0

The area of ​​the figure enclosed between the graphs of functions f1(x) and f2(x) and direct X = a and X = b, is calculated by the formula:

Attention. To avoid errors when calculating the area, the difference of functions must be taken modulo. Thus, the area will always be positive.

Example. Finding the area of ​​a figure bounded by lines and. The solution is shown in figure 6.6.

1. We build a graph of functions.

2. We find the intersection points of functions using the root function. We will determine the initial approximations from the graph.

3. Found values x are substituted into the formula as the limits of integration.

8. 3 Construction of curves by given points

Construction of a straight line passing through two given points

To compose the equation of a straight line passing through two points A ( x 0,y 0) and B ( x 1,y 1), the following algorithm is proposed:

where a and b are the coefficients of the line that we need to find.

2. This system is linear. It has two unknown variables: a and b

Example. Construction of a straight line passing through points A (-2, -4) and B (5.7).

We substitute the direct coordinates of these points into the equation and get the system:

The solution of this system in MathCAD is shown in Figure 6.7.

Rice. 6.7 System solution

As a result of solving the system, we obtain: a = 1.57, b= -0.857. So the equation of a straight line will look like: y = 1.57x- 0.857. Let's construct this straight line (Fig. 6.8).

Rice. 6.8. Building a straight line

Construction of a parabola, passing through three given points

To construct a parabola passing through three points A ( x 0,y 0), B ( x 1,y 1) and C ( x 2,y 2), the algorithm is as follows:

1. The parabola is given by the equation

y = ax 2 + bX + with, where

a, b and with are the coefficients of the parabola that we need to find.

We substitute the given coordinates of the points into this equation and get the system:

2. This system is linear. It has three unknown variables: a, b and with. The system can be solved in a matrix way.

3. We substitute the obtained coefficients into the equation and build a parabola.

Example. Construction of a parabola passing through points A (-1,-4), B (1,-2) and C (3,16).

We substitute the given coordinates of the points into the parabola equation and get the system:

The solution of this system of equations in MathCAD is shown in Figure 6.9.

Rice. 6.9. Solving a system of equations

As a result, the coefficients are obtained: a = 2, b = 1, c= -5. We get the parabola equation: 2 x 2 +x -5 = y. Let's build this parabola (Fig. 6.10).

Rice. 6.10. Construction of a parabola

Construction of a circle passing through three given points

To construct a circle passing through three points A ( x 1,y 1), B ( x 2,y 2) and C ( x 3,y 3), you can use the following algorithm:

1. The circle is given by the equation

where x0, y0 are the coordinates of the center of the circle;

R is the radius of the circle.

2. Substitute the given coordinates of the points into the equation of the circle and get the system:

This system is non-linear. It has three unknown variables: x 0, y 0 and R. The system is solved using the computing unit Given - Find.

Example. Construction of a circle passing through three points A (-2.0), B (6.0) and C (2.4).

We substitute the given coordinates of the points into the equation of the circle and get the system:

The solution of the system in MathCAD is shown in Figure 6.11.

Rice. 6.11. System solution

As a result of solving the system, the following was obtained: x 0 = 2, y 0 = 0, R = 4. Substitute the obtained coordinates of the center of the circle and the radius into the equation of the circle. We get:. Express from here y and construct a circle (Fig. 6.12).

MINISTRY OF EDUCATION AND SCIENCE OF THE RUSSIAN FEDERATION

State educational institution of higher professional education

"KAZAN STATE ENERGY UNIVERSITY"

L.R. BELYAEVA, R.S. ZARIPOVA, R.A. ISHMURATOV

BASICS OF WORKING IN MATHCAD

Methodical instructions for practical exercises

Kazan 2012

UDC 621.37 LBC 32.811.3

Reviewers:

Doctor of Physical and Mathematical Sciences, Professor of Kazan State Power Engineering University E.A. Popov;

Candidate of Technical Sciences, Associate Professor of Kazan National Research Technological University M.Yu. Vasiliev

Belyaeva L.R.

Fundamentals of work in MathCAD. Methodical instructions for practical exercises

/ L.R. Belyaeva, R.S. Zaripova, R.A. Ishmuratov - Kazan: Kazan. state energy un-t, 2012.

The first part of the manual provides basic information about

Mathcad 13 and how to work with its text, formula and graphics

editors. The input of various types of data, the basics of numerical and

symbolic calculations, plotting mathematical functions, tricks

integration and differentiation using MathCAD.

The second part provides an example of the practical use of software

MathCAD package when solving a design task at the rate "Transformation

measuring signals". The necessary theoretical information for

solution of the calculation task, an example of calculation and individual tasks for

students.

The methodological manual also contains control questions on

studied material and independent tasks to consolidate the basics of work in

The workshop is intended for students of the specialty "Information and

measuring equipment and technologies" direction 200100 - Instrumentation, and

as well as students of other specialties and areas of KSUE, studying

disciplines "Informatics" and "Information technologies".

© Kazan State Power Engineering University, 2012

Introduction

MathCAD is a computer mathematics system that allows you to perform a variety of scientific and engineering calculations, ranging from elementary arithmetic to complex implementations of numerical methods. MathCAD users are students, scientists, engineers, technicians.

MathCAD, unlike most other modern mathematical applications, is built according to the principle

WYSIWYG ("What You See Is What You Get"). Therefore, it is very easy to use, in particular, because there is no need to first write a program that implements certain mathematical calculations, and then run it for execution. Instead, simply enter mathematical expressions using the built-in formula editor, and immediately get the result.

MathCAD 13 includes several components integrated with each other, the combination of which creates a convenient computing environment for a variety of mathematical calculations and, at the same time, documenting the results of work:

powerful text editor that allows you to enter, edit

and format both text and mathematical expressions;

a computing processor capable of performing calculations according to the entered formulas using built-in numerical methods;

a symbolic processor, which is an artificial intelligence system;

a huge repository of reference information, both mathematical and engineering, designed as a library of interactive e-books.

To work effectively with the MathCAD editor, it is enough to have basic user skills. According to real life problems, engineers have to solve one or more of the following tasks:

entering various mathematical expressions on a computer (for further calculations or creating documents, presentations, Web pages or e-books);

carrying out mathematical calculations;

preparation of graphs with the results of calculations;

input of initial data and output of results to text files or files with databases in other formats;

preparation of work reports in the form of printed documents;

− preparation of Web pages and publication of results on the Internet;

obtaining various reference information from the field of mathematics.

MathCAD 13 successfully copes with all these tasks:

mathematical expressions and text are entered using the MathCAD formula editor, which, in terms of capabilities and ease of use, is not inferior, for example, to the formula editor built into

mathematical calculations are made immediately, in accordance with the entered formulas;

graphs of various types of user choice with rich formatting options are inserted directly into documents;

it is possible to input and output data to files of various formats;

documents can be printed directly in MathCAD in the form that the user sees on the computer screen, or saved

in RTF format for subsequent editing in text editors;

it is possible to fully save MathCAD documents in the format RTF documents, as well as Web pages in HTML and XML formats;

there is an option to combine user-developed documents into electronic books;

symbolic calculations allow you to perform analytical transformations, as well as instantly obtain a variety of reference mathematical information.

The real jewel of MathCAD, available already in the first versions, was the support for discrete variables, which allowed simultaneously calculating functions for a number of argument values, which made it possible to build tables and graphs without using programming operators. Surface plotting tools have been brought almost to perfection, allowing you to create works of art from graphs. Complex engineering and technological calculations in the MathCAD environment are much simpler, clearer and several times faster than in other programs.

Part 1. THEORETICAL INFORMATION

Chapter 1. MATHCAD INTERFACE

The interface of MathCAD is similar to that of other Windows applications. After launch, the MathCAD working window appears on the screen with the main menu and three toolbars: Standard (Standard), Formatting (Formatting) and Math (Mathematical).

The menu bar is located at the very top of the MathCAD window. It contains nine headings, clicking on each of them brings up

to the appearance of the corresponding menu with a list of commands:

- File (File) - commands related to the creation, opening, saving, sending by e-mail and printing on the printer of files with documents;

− Edit (Editing) – commands related to text editing (copying, pasting, deleting fragments, etc.);

- View (View) - commands that control the appearance of the document in the MathCAD editor window, as well as commands that create animation files;

− Insert (Insert) - commands for inserting various objects into documents;

− Format (Format) - commands for formatting text, formulas, graphs;

− Tools (Service) – commands for managing the computational process and additional features;

− Symbolics (Symbols) – commands of symbolic calculations;

− Window (Window) – commands for managing the arrangement of windows with various documents on the screen;

− Help – commands for accessing context-sensitive help information, program version information, and accessing resources and e-books.

To select a command, you need to click on the menu containing it and again on the corresponding menu item. Some commands are not in the menus themselves, but in submenus, as shown in Fig. 1.1. To execute such a command, for example, the command to call the Symbolic toolbar on the screen, you need to hover the mouse pointer over the Toolbars item of the View drop-down menu and select Symbolic from the submenu that appears.

Rice. 1.1. Menu operation

In addition to the top menu, pop-up menus perform similar functions (Fig. 1.2). They appear when you right-click somewhere in the document. At the same time, the composition of these menus depends on the place of their call, therefore they are also called context menus. MathCAD itself “guesses”, depending on the context, what operations may be required at the current moment, and places the corresponding commands on the menu. Therefore, using the context menu is easier than the top one.

Rice. 1.2. Context menu

1.2. Toolbars

Toolbars are used for quick (one-click) execution of the most commonly used commands. All actions that can be performed using the toolbars are also available through

Top Menu. On fig. 1.3 shows the MathCAD window with five main toolbars located directly below the menu bar. The buttons in the panels are grouped according to the similar action of the commands:

- Standard (Standard) - serves to perform most operations, such as actions with files, editorial editing, inserting objects, accessing help systems;

− Formatting (Formatting) - serves for formatting (changing the type and size of the font, alignment, etc.) text and formulas;

− Math (Mathematics) - is used to insert mathematical symbols

and operators in documents;

- Resources (Resources) - serves to call the resources of MathCAD;

− Controls (Controls) - serves to insert standard user interface controls into documents;

− Debug - is used to manage debugging of MathCAD programs.

Rice. 1.3. Basic toolbars

Groups of buttons on toolbars are delimited in meaning by vertical lines - separators. When you hover the mouse pointer over any of the buttons, a tooltip appears next to the button (Fig. 1.4). Along with a tooltip, a more detailed explanation of the upcoming operation can be found in the status bar.

Rice. 1.4. Using the Math and Calculator toolbars

The panel Math (Mathematics) is intended for a call on the screen of nine more panels (fig. 1.5) by means of which there is an insertion of mathematical operations into documents. To show any of them, you need to click the corresponding button on the Math panel (Fig. 1.4).

Rice. 1.5. Math toolbars

We list the purpose of mathematical panels:

- Calculator (Calculator) - used to insert basic mathematical operations, got its name because of the similarity of the set of buttons with the buttons of a typical calculator;

− Graph (Graph) - for inserting graphs;

− Matrix (Matrix) - for inserting matrices and matrix operators;

− Evaluation - for inserting evaluation control statements;

− Calculus (Mathematical Analysis) – for insertion of operators of integration, differentiation, summation, etc.;

− Boolean (Boolean operators) - to insert logical (boolean) operators;

− Programming (Programming) - for programming by means of MathCAD;

− Greek (Greek characters) - to insert Greek characters;

− Symbolic - to insert symbolic operators. It is important to note that when you hover over many of the

buttons of mathematical panels, a tooltip appears, containing also a combination of "hot keys", pressing which will lead to an equivalent action.

1.3. Status bar

AT at the bottom of the MathCAD window, below the horizontal scroll bar, is the status bar. It displays basic information about the editing mode (Fig. 1.6), delimited by separators (from left to right):

− context-sensitive hint about the upcoming action;

− calculation mode: automatic (AUTO) or manually set (Calc F9);

− current mode of the CAP keyboard layout; − current keyboard layout mode NUM; − number of the page on which the cursor is located.

Rice. 1.6. Status bar

Chapter 2. BASICS OF WORKING IN MATHCAD

2.1. Document navigation

It is convenient to view the document up-down and right-left using the vertical and horizontal scroll bars, moving their sliders (in this case, smooth movement along the document is ensured) or by clicking on one of the two sides of the slider (in this case, moving through the document will be jumpy). You can also use the page turning keys to move the cursor around the document. And In all these cases, the position of the cursor does not change, but the content of the document is viewed. In addition, if the document is large, it is convenient to view its contents using the menu

Edit | Go to Page (Edit | Go to page). When you select this item, a dialog will open that allows you to go to the page with the specified number.

In order to move up and down and right and left through the document, moving the cursor, you should press the corresponding cursor keys. Getting into the area of ​​regions with formulas and text, the cursor turns into two input lines - vertical and horizontal blue. As the cursor moves further within the region, the input lines move one character in the corresponding direction. When you leave the region, the cursor again becomes the input cursor in the form of a red cross. You can also move the cursor by clicking on the appropriate location. If you click on an empty space, then an input cursor will appear in it, and if within the region, then input lines.

2.2. Entering and editing formulas

The MathCAD formula editor allows you to quickly and efficiently enter and modify mathematical expressions.

Let's list once again the elements of the interface of the MathCAD editor:

mouse pointer - plays the usual role for Windows applications, following the movements of the mouse;

cursor must be in one of three types:

the input cursor is a red cross that marks an empty place in the document where you can enter text or a formula;

input lines - horizontal and vertical blue lines that highlight a certain part in the text or formula;

text input line - a vertical line, analogous to input lines for text areas;

placeholders - appear inside incomplete formulas in places that should be filled with a symbol or operator:

the character placeholder is a black rectangle;

the operator placeholder is a black rectangular box. You can enter a mathematical expression in any empty space

MathCAD document. To do this, you need to place the input cursor in the desired place in the document by clicking on it with the mouse, and enter the formula by pressing the keys. This creates a mathematical area in the document, which is designed to store formulas interpreted by the MathCAD processor. Let's demonstrate the sequence of actions using the example of entering the expression x 5 + x (Fig. 2.1):

1. Click the mouse to mark the entry point.

1. MathCAD working window

· Panel Mathematics(Fig. 1.4).

Rice. 1.4. Math Panel

Clicking on the math toolbar button opens an additional toolbar:

2. Elements of language MathCAD

The basic elements of MathCAD mathematical expressions include operators, constants, variables, arrays, and functions.

2.1 Operators

Operators -- elements of MathCAD with which you can create mathematical expressions. These, for example, include symbols for arithmetic operations, signs for calculating sums, products, derivatives, integrals, etc.

The operator defines:

a) the action to be performed in the presence of certain values ​​of the operands;

b) how many, where and what operands should be entered into the operator.

Operand -- the number or expression that the operator acts on. For example, in the expression 5!+3, the numbers 5! and 3 are the operands of the "+" (plus) operator, and the number 5 is the operand of the factorial (!).

Any operator in MathCAD can be entered in two ways:

by pressing a key (key combination) on the keyboard;

using the math panel.

The following statements are used to assign or display the contents of the memory location associated with a variable:

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 local. 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 a variable is assigned a value in this way at the very end of the document, then it will have the same value at the beginning of the document.

Approximate equality operator (x1). Used in solving systems of equations. Entered by pressing a key ; on the keyboard (semicolon in the English keyboard layout) or by pressing the corresponding button on Boolean panel.

An operator (simple equals) reserved for outputting the value of a constant or variable.

The simplest calculations

The calculation process is carried out using:

Calculator Panels, Calculus Panels and Estimation Panels.

Attention. If it is necessary to divide the entire expression in the numerator, then it must first be selected by pressing the spacebar on the keyboard or by placing it in brackets.

2.2 Constants

Constants -- named objects that hold some value that cannot be changed.

For example, = 3.14.

Dimensional constants are common units of measurement. For example, meters, seconds, etc.

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

2.3 Variables

Variables are named objects that have some value that can change as the program runs. Variables can be numeric, string, character, etc. Variables are assigned values ​​using the assign sign (:=).

Attention. MathCAD treats uppercase and lowercase letters as different identifiers.

System variables

AT MathCAD contains a small group of special objects that cannot be attributed either to the class of constants or to the class of variables, the values ​​of which are determined immediately after the program is started. It is better to count them system variables. This, for example, TOL - the error of numerical calculations, ORIGIN - the lower limit of the value of the index index of vectors, matrices, etc. If necessary, you can set other values ​​for these variables.

Ranked Variables

These variables have a series of fixed values, either integer or varying in a certain step from the initial value to the final one.

An expression is used to create a ranged variable:

Name=N begin ,(N begin +Step)..N end ,

where Name is the name of the variable;

N begin -- initial value;

Step -- the specified step for changing the variable;

N end -- end value.

Ranked variables are widely used in plotting. For example, to plot a graph of some function f(x) first of all, you need to create a series of variable values x-- it must be a ranged variable for this to work.

Attention. If you do not specify a step in the variable range, the program will automatically take it equal to 1.

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

To write a ranged variable, you would type:

Variable name ( x);

Assignment sign (:=)

The first value of the range (-16);

comma;

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

ellipsis ( .. ) -- changing the variable within the given limits (ellipsis is entered by pressing a semicolon in the English keyboard layout);

Last range value (16).

As a result, you will get: x := -16,-16+0.1..16.

Output tables

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

You can insert numerical values ​​into the output tables and correct them.

Variable with index

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

The index is entered by pressing the left square bracket on the keyboard or using the button x n on the panel Calculator.

You can use either a constant or an expression as an index. To initialize a variable with an index, you must enter the elements of the array, separating them with commas.

Example. Entering index variables.

Numeric values ​​are entered into the table separated by commas;

Output of the value of the first element of the vector S;

Outputting the value of the zero element of the vector S.

2.4 Arrays

array -- a uniquely named collection of a finite number of numeric or character elements, ordered in some way and having specific addresses.

In the package MathCAD arrays of the two most common types are used:

one-dimensional (vectors);

two-dimensional (matrices).

You can output a matrix or vector template in one of the following ways:

select menu item Insert - Matrix;

press the key combination ctrl + M;

press the button on panel and vectors and matrices.

As a result, a dialog box will appear in which the required number of rows and columns is set:

Rows-- number of lines

columns-- number of columns

If a matrix (vector) needs to be given a name, then the name of the matrix (vector) is entered first, then the assignment operator, and then the matrix template.

for example:

Matrix -- a two-dimensional array named M n , m , consisting of n rows and m columns.

You can perform various mathematical operations on matrices.

2.5 Functions

Function -- an expression according to which some calculations are performed with arguments and its numerical value is determined. Function examples: sin(x), tan(x) and etc.

Functions in the MathCAD package can be either built-in or user-defined. Ways to insert an inline function:

Select menu item Insert - Function.

Press key combination ctrl + E.

Click the button on the toolbar.

Type the name of the function on the keyboard.

User functions are typically used when the same expression is evaluated multiple times. To set a user function:

· enter the name of the function with the obligatory indication of the argument in brackets, for example, f(x);

Enter the assignment operator (:=);

Enter a calculated expression.

Example. f (z) := sin(2 z 2)

3. Number Formatting

In MathCAD, you can change the output format of numbers. Usually calculations are made with an accuracy of 20 digits, but not all significant figures are displayed. To change the number format, double-click on the desired numerical result. The number formatting window will appear, open on the tab number Format (Number Format) with the following formats:

o General (Main) -- is the default. Numbers are displayed in order (for example, 1.2210 5). The number of signs of the mantissa is determined in the field Exponential Threshold(Exponential notation threshold). When the threshold is exceeded, the number is displayed in order. The number of digits after the decimal point changes in the field number of decimal places.

o Decimal (Decimal) -- The decimal representation of floating point numbers (for example, 12.2316).

o Scientific (Scientific) -- Numbers are displayed in order only.

o Engineering (Engineering) -- numbers are displayed only in multiples of three (for example, 1.2210 6).

Attention. If, after setting the desired format in the number formatting window, select the button OK, the format will be set only for the selected number. And if you select the Set as Default button, the format will be applied to all numbers in this document.

Numbers are automatically rounded down to zero if they are less than the set threshold. The threshold is set for the entire document, not for a specific result. In order to change the rounding threshold to zero, select the menu item Formatting - Result and in tab tolerance , in field Zero threshold enter the required threshold value.

4. Working with text

Text snippets are pieces of text that the user would like to see in their document. These can be explanations, links, comments, etc. They are inserted using the menu item Insert - Text region.

You can format the text: change the font, its size, style, alignment, etc. To do this, select it and select the appropriate options on the font panel or in the menu Formatting - Text.

5. Working with graphics

When solving many problems where a function is being studied, it often becomes necessary to plot its graph, which will clearly reflect the behavior of the function on a certain interval.

In the MathCAD system, it is possible to build various types of graphs: in Cartesian and polar coordinate systems, three-dimensional graphs, surfaces of bodies of revolution, polyhedra, spatial curves, vector field graphs. We will look at how to build some of them.

5.1 Plotting 2D Plots

To build a two-dimensional graph of a function, you need to:

set a function

Place the cursor in the place where the graph should be built, on the mathematical panel select the Graph button (graph) and in the panel that opens, the X-Y Plot button (two-dimensional graph);

In the appeared template of a two-dimensional graph, which is an empty rectangle with data labels, enter the name of the variable in the central data label along the abscissa axis (X axis), and enter the name of the function in place of the central data label along the ordinate axis (Y axis) (Fig. 2.1 );

Rice. 2.1. 2D Plot Template

click outside the graph template -- the graph of the function will be plotted.

The argument range consists of 3 values: initial, second and final.

Let it be necessary to plot a function graph on the interval [-2,2] with a step of 0.2. Variable values t are specified as a range as follows:

t:= -2, - 1.8 .. 2 ,

where: -2 -- the initial value of the range;

1.8 (-2 + 0.2) -- second range value (initial value plus step);

2 is the end value of the range.

Attention. An ellipsis is entered by pressing a semicolon in the English keyboard layout.

Example. Plotting a Function y = x 2 on the interval [-5.5] with a step of 0.5 (Fig. 2.2).

Rice. 2.2. Plotting a Function y = x 2

When plotting graphs, consider the following:

° If the range of the argument values ​​is not specified, then by default the graph is built in the range [-10,10].

° If it is necessary to place several graphs in one template, then the names of the functions are indicated separated by commas.

° If two functions have different arguments, for example, f1(x) and f2(y), then the names of the functions are indicated on the ordinate (Y) axis separated by commas, and the names of both variables are also separated on the abscissa (X) axis, also separated by commas.

° Data end labels on the chart template are used to indicate the limit values ​​of abscissas and ordinates, i.e. they set the scale of the graph. If you leave these labels blank, the scale will be set automatically. The automatic scale does not always reflect the graph in the desired form, so the limit values ​​of the abscissa and ordinates have to be edited by changing them manually.

Note. If after plotting the graph does not take the desired form, you can:

Reduce step.

· change the plotting interval.

Reduce the limit values ​​of abscissas and ordinates on the chart.

Example. Construction of a circle with a center at a point (2,3) and a radius R = 6.

The equation of a circle centered at a point with coordinates ( x 0 ,y 0) and radius R is written as:

Express from this equation y:

Thus, to construct a circle, it is necessary to set two functions: the upper and lower semicircles. The argument range is calculated as follows:

Range start value = x 0 - R;

Range end value = x 0 + R;

It is better to take the step equal to 0.1 (Fig. 2.3.).

Rice. 2.3. Construction of a circle

Parametric graph of a function

Sometimes it is more convenient instead of a line equation relating rectangular coordinates x and y, consider the so-called parametric line equations, which give expressions for the current x and y coordinates as functions of some variable t(parameter): x(t) and y(t). When constructing a parametric graph, the names of functions of one argument are indicated on the ordinate and abscissa axes.

Example. Construction of a circle centered at a point with coordinates (2,3) and radius R= 6. For the construction, the parametric equation of the circle is used

x = x 0 + R cos( t) y = y 0 + R sin( t) (Fig. 2.4.).

Fig.2.4. Construction of a circle

Chart Formatting

To format a graph, double-click on the graph area. The Graph Formatting dialog box will open. The tabs in the chart formatting window are listed below:

§ X- Y axes-- formatting the coordinate axes. By checking the appropriate boxes, you can:

· Log Scale-- represent numerical values ​​on the axes in a logarithmic scale (by default, numerical values ​​are plotted in a linear scale)

· Grid lines-- draw a grid of lines;

· numbered-- Arrange the numbers along the coordinate axes;

· Auto Scale-- automatic selection of limit numerical values ​​on the axes (if this box is unchecked, the maximum calculated values ​​will be limit);

· show marker-- marking the graph in the form of horizontal or vertical dotted lines corresponding to the specified value on the axis, and the values ​​themselves are displayed at the end of the lines (2 input places appear on each axis, in which you can enter numerical values, do not enter anything, enter one number or letter designations of constants);

· Auto Grid-- automatic selection of the number of grid lines (if this box is unchecked, you must specify the number of lines in the Number of Grids field);

· crossed-- the abscissa axis passes through zero of the ordinate;

· Boxed-- the x-axis runs along the bottom edge of the graph.

§ Trace-- line formatting of function graphs. For each graph separately, you can change:

symbol (Symbol) on the chart for nodal points (circle, cross, rectangle, rhombus);

line type (Solid - solid, Dot - dotted line, Dash - strokes, Dadot - dash-dotted line);

line color (Color);

Type (Ture) of the chart (Lines - line, Points - points, Var or Solidbar - bars, Step - step chart, etc.);

line thickness (Weight).

§ Label -- title in the graph area. In field Title (Title) you can write the text of the title, select its position - at the top or bottom of the graph ( Above -- top, Below -- down below). You can enter, if necessary, the names of the argument and function ( Axis Labels ).

§ Defaults -- using this tab, you can return to the default chart view (Change to default), or use the changes you made on the chart by default for all charts in this document (Use for Defaults).

5.2 Building polar plots

To build a polar graph of a function, you need to:

· set the range of argument values;

set a function

· place the cursor in the place where the graph should be built, on the mathematical panel select the Graph button (graph) and in the panel that opens, the Polar Plot button (polar graph);

· in the input fields of the template that appears, you must enter the angular argument of the function (below) and the name of the function (left).

Example. Construction of Bernoulli's lemniscate: (Fig. 2.6.)

Fig.2.6. An example of building a polar plot

5.3 Plotting Surfaces (3D or 3D Plots)

When constructing three-dimensional graphs, the panel is used graph(Graph) math panel. You can build a three-dimensional graph using the wizard, called from the main menu; you can build a graph by creating a matrix of values ​​​​of a function of two variables; you can use the accelerated construction method; you can call the special functions CreateMech and CreateSpase, designed to create an array of function values ​​and plot. We will consider an accelerated method for constructing a three-dimensional graph.

Quick Graphing

To quickly build a three-dimensional graph of a function, you need to:

set a function

place the cursor in the place where the graph should be built, select the button on the mathematical panel graph(Chart) and in the opened panel the button ( surface graph);

· in the only place of the template, enter the name of the function (without specifying variables);

· click outside the chart template -- the function graph will be built.

Example. Plotting a Function z(x,y) = x 2 + y 2 - 30 (Fig. 2.7).

Rice. 2.7. An Example of a Quick Surface Plot

The built chart can be controlled:

° rotation of the graph is performed after hovering the mouse pointer over it with the left mouse button pressed;

° scaling of the chart is performed after hovering the mouse pointer over it by simultaneously pressing the left mouse button and the Ctrl key (if you move the mouse, the chart zooms in or out);

° chart animation is performed in the same way, but with the Shift key pressed additionally. It is only necessary to start rotating the graph with the mouse, then the animation will be performed automatically. To stop the rotation, click the left mouse button inside the graph area.

It is possible to build several surfaces at once in one drawing. To do this, you need to set both functions and specify the names of the functions on the chart template separated by commas.

When plotting quickly, the default values ​​for both arguments are between -5 and +5 and the number of contour lines is 20. To change these values, you must:

· double click on the chart;

· select the Quick Plot Data tab in the opened window;

· enter new values ​​in the window area Range1 -- for the first argument and Range2 -- for the second argument (start -- initial value, end -- final value);

· in the # of Grids field, change the number of grid lines covering the surface;

· Click the OK button.

Example. Plotting a Function z(x,y) = -sin( x 2 + y 2) (Fig. 2.9).

When constructing this graph, it is better to choose the limits of change in the values ​​of both arguments from -2 to +2.

Rice. 2.9. An example of plotting a function graph z(x,y) = -sin( x 2 + y 2)

forematting 3D graphs

To format the graph, double-click on the plot area - a formatting window with several tabs will appear: Appearance, General, axes, lighting, Title, Backplanes, Special, Advanced, Quick Plot Data.

Purpose of the tab Quick Plot Data has been discussed above.

Tab Appearance allows you to change the appearance of the graph. Field Fill Options allows you to change the fill parameters, field line Option-- line parameters, point Options-- point parameters.

In the tab General ( general) in the group view you can choose the angles of rotation of the depicted surface around all three axes; in a group display as You can change the chart type.

In the tab lighting(lighting) you can control the lighting by checking the box enable lighting(turn on lights) and switch On(turn on). One of 6 possible lighting schemes is selected from the list lighting scheme(lighting scheme).

6. Ways to solve equations in MathCAD

In this section, we will learn how the simplest equations of the form F( x) = 0. To solve an equation analytically means to find all its roots, i.e. such numbers, when substituting them into the original equation, we obtain the correct equality. To solve the equation graphically means to find the points of intersection of the graph of the function with the x-axis.

6. 1 Solving equations using the function root(f(x),x)

For solutions of an equation with one unknown of the form F( x) = 0 there is a special function

root(f(x), x) ,

where f(x) is an expression equal to zero;

X-- argument.

This function returns, with a given precision, the value of a variable for which the expression f(x) is equal to 0.

Attentione. If the right side of the equation is 0, then it is necessary to bring it to normal form (transfer everything to the left side).

Before using the function root must be given to the argument X initial approximation. If there are several roots, then to find each root, you must specify your initial approximation.

Attention. Before solving, it is desirable to plot a function graph to check if there are roots (does the graph intersect the Ox axis), and if so, how many. The initial approximation can be chosen according to the graph closer to the intersection point.

Example. Solving an equation using a function root shown in Figure 3.1. Before proceeding to the solution in the MathCAD system, in the equation we will transfer everything to the left side. The equation will take the form: .

Rice. 3.1. Solving an Equation Using the Root Function

6. 2 Solving Equations with the Polyroots(v) Function

To simultaneously find all the roots of a polynomial, use the function polyroots(v), where v is the vector of coefficients of the polynomial, starting from the free term . Zero coefficients cannot be omitted. Unlike the function root function Polyroots does not require an initial approximation.

Example. Solving an equation using a function polyroots shown in Figure 3.2.

Rice. 3.2. Solving an Equation Using the Polyroots Function

6.3 Solving Equations with Find(x)

The Find function works in conjunction with the Given keyword. Design Given - Find uses a computational technique based on finding a root near an initial approximation point specified by the user.

If the equation is given f(x) = 0, then it can be solved as follows using the block Given - Find:

Set Initial Approximation

Enter a service word

Write the equation using the sign bold equals

Write a find function with an unknown variable as a parameter

As a result, after the equal sign, the found root will be displayed.

If there are several roots, then they can be found by changing the initial approximation x0 to one close to the desired root.

Example. The solution of the equation using the find function is shown in Figure 3.3.

Rice. 3.3. Solving an equation with the find function

Sometimes it becomes necessary to mark some points on the graph (for example, the points of intersection of a function with the Ox axis). For this you need:

Specify the x value of a given point (along the Ox axis) and the value of the function at this point (along the Oy axis);

double click on the graph and in the formatting window in the tab traces for the corresponding line, select the graph type - points, line thickness - 2 or 3.

Example. The graph shows the point of intersection of the function with the x-axis. Coordinate X this point was found in the previous example: X= 2.742 (root of the equation ) (Fig. 3.4).

Rice. 3.4. Graph of a function with a marked intersection point

In the chart formatting window, in the tab traces for trace2 changed: chart type - points, line thickness - 3, color - black.

7. Solving systems of equations

7.1 Solving systems of linear equations

The system of linear equations can be solved m matrix method (either through the inverse matrix or using the function lsolve(A,B)) and using two functions Find and features Minerr.

Matrix method

Example. The system of equations is given:

The solution of this system of equations by the matrix method is shown in Figure 4.1.

Rice. 4.1. Solving a system of linear equations by a matrix method

Function use lsolve(A, B)

Lsolve(A,B) is a built-in function that returns a vector X for a system of linear equations given a matrix of coefficients A and a vector of free terms B .

Example. The system of equations is given:

The way to solve this system using the lsolve(A,B) function is shown in Figure 4.2.

Rice. 4.2. Solving a system of linear equations using the lsolve function

Solving a system of linear equations via functionsand Find

With this method, equations are entered without the use of matrices, i.e. in "natural form". First, it is necessary to indicate the initial approximations of the unknown variables. It can be any number within the scope of the definition. Often they are mistaken for a column of free members.

In order to solve a system of linear equations using a computing unit Given - Find, necessary:

2) enter a service word Given;

bold equals();

4) write a function Find,

Example. The system of equations is given:

The solution of this system using a computing unit Given - Find shown in Figure 4.3.

Rice. 4.3. Solving a system of linear equations using the Find function

Approximate psolution of a system of linear equations

Solving a system of linear equations using a function Minerr similar to the solution using the function Find(using the same algorithm), function only Find gives the exact solution, and Minerr-- approximate. If, as a result of the search, no further refinement of the current approximation to the solution can be obtained, Minerr returns this approximation. Function Find in this case returns an error message.

You can choose another initial approximation.

· You can increase or decrease the calculation accuracy. To do this, select from the menu Math > Options(Math - Options), tab built- In Variables(Built-in variables). In the tab that opens, you need to reduce the allowable calculation error (Convergence Tolerance (TOL)). Default TOL = 0.001.

ATattention. With the matrix solution method, it is necessary to rearrange the coefficients according to the increase in unknowns X 1, X 2, X 3, X 4.

7.2 Solving systems of nonlinear equations

Systems of nonlinear equations in MathCAD are solved using a computing unit Given - Find.

Design Given - Find uses a computational technique based on finding a root near an initial approximation point specified by the user.

To solve a system of equations using the block Given - Find necessary:

1) set initial approximations for all variables;

2) enter a service word Given;

3) write down the system of equations using the sign bold equals();

4) write a function Find, by listing unknown variables as function parameters.

As a result of calculations, the solution vector of the system will be displayed.

If the system has several solutions, the algorithm should be repeated with other initial guesses.

Note. If a system of two equations with two unknowns is being solved, before solving it, it is desirable to plot function graphs in order to check whether the system has roots (whether the graphs of given functions intersect), and if so, how many. The initial approximation can be chosen according to the graph closer to the intersection point.

Example. Given a system of equations

Before solving the system, we construct graphs of functions: parabolas (the first equation) and a straight line (the second equation). The construction of a graph of a straight line and a parabola in one coordinate system is shown in Figure 4.5:

Rice. 4.5. Plotting two functions in the same coordinate system

The line and the parabola intersect at two points, which means that the system has two solutions. According to the graph, we choose the initial approximations of the unknowns x and y for every solution. Finding the roots of the system of equations is shown in Figure 4.6.

Rice. 4.6. Finding the roots of a system of nonlinear equations

In order to mark on the graph the points of intersection of the parabola and the straight line, we introduce the coordinates of the points found when solving the system along the Ox axis (values X ) and along the Oy axis (values at ) separated by commas. In the chart formatting window, in the tab traces for trace3 and trace4 change: chart type - points, line thickness - 3, color - black (Fig. 4.7).

Rice. 4.7. Function plots with marked intersection points

8 . Key Features Usage Examples MathCAD to solve some mathematical problems

This section provides examples of solving problems that require solving an equation or a system of equations.

8. 1 Finding local extrema of functions

The necessary condition for an extremum (maximum and/or minimum) of a continuous function is formulated as follows: extrema can take place only at those points where the derivative is either equal to zero or does not exist (in particular, it becomes infinity). To find the extrema of a continuous function, first find the points that satisfy the necessary condition, that is, find all the real roots of the equation.

If a function graph is built, then you can immediately see - the maximum or minimum is reached at a given point X. If there is no graph, then each of the found roots is examined in one of the ways.

1st with allowance . With equalize e signs of the derivative . The sign of the derivative is determined in the vicinity of the point (at points that are separated from the extremum of the function on different sides at small distances). If the sign of the derivative changes from "+" to "-", then at this point the function has a maximum. If the sign changes from "-" to "+", then at this point the function has a minimum. If the sign of the derivative does not change, then there are no extremums.

2nd s allowance . AT calculations e second derivative . In this case, the second derivative is calculated at the extremum point. If it is less than zero, then at this point the function has a maximum, if it is greater than zero, then a minimum.

Example. Finding extrema (minimums/maximums) of a function.

First, let's build a graph of the function (Fig. 6.1).

Rice. 6.1. Plotting a Function

Let us determine from the graph the initial approximations of the values X corresponding to local extrema of the function f(x). Let's find these extrema by solving the equation. To solve, we use the Given - Find block (Fig. 6.2.).

Rice. 6.2. Finding local extrema

Let us define the type of extremums pervway, examining the change in the sign of the derivative in the vicinity of the found values ​​(Fig. 6.3).

Rice. 6.3. Determining the type of extremum

It can be seen from the table of values ​​of the derivative and from the graph that the sign of the derivative in the vicinity of the point x 1 changes from plus to minus, so the function reaches its maximum at this point. And in the vicinity of the point x 2, the sign of the derivative has changed from minus to plus, so at this point the function reaches a minimum.

Let us define the type of extremums secondway, calculating the sign of the second derivative (Fig. 6.4).

Rice. 6.4. Determining the type of extremum using the second derivative

It can be seen that at the point x 1 the second derivative is less than zero, so the point X 1 corresponds to the maximum of the function. And at the point x 2 the second derivative is greater than zero, so the point X 2 corresponds to the minimum of the function.

8.2 Determining the areas of figures bounded by continuous lines

Area of ​​a curvilinear trapezoid bounded by a graph of a function f(x) , a segment on the Ox axis and two verticals X = a and X = b, a < b, is determined by the formula: .

Example. Finding the area of ​​a figure bounded by lines f(x) = 1 - x 2 and y = 0.

Rice. 6.5. Finding the area of ​​a figure bounded by lines f(x) = 1 - x 2 and y = 0

The area of ​​the figure enclosed between the graphs of functions f1(x) and f2(x) and direct X = a and X = b, is calculated by the formula:

Attention. To avoid errors when calculating the area, the difference of functions must be taken modulo. Thus, the area will always be positive.

Example. Finding the area of ​​a figure bounded by lines and. The solution is shown in figure 6.6.

1. We build a graph of functions.

2. We find the intersection points of functions using the root function. We will determine the initial approximations from the graph.

3. Found values x are substituted into the formula as the limits of integration.

8. 3 Construction of curves by given points

Construction of a straight line passing through two given points

To write the equation of a straight line passing through two points A( x 0,y 0) and B( x 1,y 1), the following algorithm is proposed:

where a and b are the coefficients of the line that we need to find.

2. This system is linear. It has two unknown variables: a and b

Example. Construction of a straight line passing through points A(-2,-4) and B(5,7).

We substitute the direct coordinates of these points into the equation and get the system:

The solution of this system in MathCAD is shown in Figure 6.7.

Rice. 6.7 System solution

As a result of solving the system, we obtain: a = 1.57, b= -0.857. So the equation of a straight line will look like: y = 1.57x- 0.857. Let's construct this straight line (Fig. 6.8).

Rice. 6.8. Building a straight line

Construction of a parabola, passing through three given points

To construct a parabola passing through three points A( x 0,y 0), B( x 1,y 1) and C( x 2,y 2), the algorithm is as follows:

1. The parabola is given by the equation

y = ax 2 + bX + with, where

a, b and with are the coefficients of the parabola that we need to find.

We substitute the given coordinates of the points into this equation and get the system:

2. This system is linear. It has three unknown variables: a, b and with. The system can be solved in a matrix way.

3. We substitute the obtained coefficients into the equation and build a parabola.

Example. Construction of a parabola passing through the points A(-1,-4), B(1,-2) and C(3,16).

We substitute the given coordinates of the points into the parabola equation and get the system:

The solution of this system of equations in MathCAD is shown in Figure 6.9.

Rice. 6.9. Solving a system of equations

As a result, the coefficients are obtained: a = 2, b = 1, c= -5. We get the parabola equation: 2 x 2 +x -5 = y. Let's build this parabola (Fig. 6.10).

Rice. 6.10. Construction of a parabola

Construction of a circle passing through three given points

To construct a circle passing through three points A( x 1,y 1), B( x 2,y 2) and C( x 3,y 3), you can use the following algorithm:

1. The circle is given by the equation

where x0,y0 are the coordinates of the center of the circle;

R is the radius of the circle.

2. Substitute the given coordinates into the equation of the circle...........

Send your good work in the knowledge base is simple. Use the form below

Students, graduate students, young scientists who use the knowledge base in their studies and work will be very grateful to you.

1. Working window MathCAD

· Panel Mathematics(Fig. 1.4).

Rice. 1.4. Math Panel

Clicking on the math toolbar button opens an additional toolbar:

2. Elements of language MathCAD

The basic elements of MathCAD mathematical expressions include operators, constants, variables, arrays, and functions.

2.1 Operators

Operators -- elements of MathCAD with which you can create mathematical expressions. These, for example, include symbols for arithmetic operations, signs for calculating sums, products, derivatives, integrals, etc.

The operator defines:

a) the action to be performed in the presence of certain values ​​of the operands;

b) how many, where and what operands should be entered into the operator.

Operand -- the number or expression that the operator acts on. For example, in the expression 5!+3, the numbers 5! and 3 are the operands of the "+" (plus) operator, and the number 5 is the operand of the factorial (!).

Any operator in MathCAD can be entered in two ways:

by pressing a key (key combination) on the keyboard;

using the math panel.

The following statements are used to assign or display the contents of the memory location associated with a variable:

-- 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 local. 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 a variable is assigned a value in this way at the very end of the document, then it will have the same value at the beginning of the document.

-- approximate equality operator (x1). Used in solving systems of equations. Entered by pressing a key ; on the keyboard (semicolon in the English keyboard layout) or by pressing the corresponding button on Boolean panel.

= -- operator (simple equals) reserved for outputting the value of a constant or variable.

The simplest calculations

The calculation process is carried out using:

Calculator Panels, Calculus Panels and Estimation Panels.

Attention. If it is necessary to divide the entire expression in the numerator, then it must first be selected by pressing the spacebar on the keyboard or by placing it in brackets.

2.2 Constants

Constants -- named objects that hold some value that cannot be changed.

For example, = 3.14.

Dimensional constants are common units of measurement. For example, meters, seconds, etc.

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

2.3 Variables

Variables are named objects that have some value that can change as the program runs. Variables can be numeric, string, character, etc. Variables are assigned values ​​using the assign sign (:=).

Attention. MathCAD treats uppercase and lowercase letters as different identifiers.

System variables

AT MathCAD contains a small group of special objects that cannot be attributed either to the class of constants or to the class of variables, the values ​​of which are determined immediately after the program is started. It is better to count them system variables. This, for example, TOL - the error of numerical calculations, ORIGIN - the lower limit of the value of the index index of vectors, matrices, etc. If necessary, you can set other values ​​for these variables.

Ranked Variables

These variables have a series of fixed values, either integer or varying in a certain step from the initial value to the final one.

An expression is used to create a ranged variable:

Name=N begin,(N begin+Step)..N end,

where Name is the name of the variable;

N begin -- initial value;

Step -- the specified step for changing the variable;

N end -- end value.

Ranked variables are widely used in plotting. For example, to plot a graph of some function f(x) first of all, you need to create a series of variable values x-- it must be a ranged variable for this to work.

Attention. If the step is not specified in the range of the variable, then gram will automatically take it equal to 1.

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

To write a ranged variable, you would type:

Variable name ( x);

Assignment sign (:=)

The first value of the range (-16);

comma;

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

ellipsis ( .. ) -- changing the variable within the given limits (ellipsis is entered by pressing a semicolon in the English keyboard layout);

Last range value (16).

As a result, you will get: x := -16,-16+0.1..16.

Output tables

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

You can insert numerical values ​​into the output tables and correct them.

Variable with index

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

The index is entered by pressing the left square bracket on the keyboard or using the button x n on the panel Calculator.

You can use either a constant or an expression as an index. To initialize a variable with an index, you must enter the elements of the array, separating them with commas.

Example. Entering index variables.

Numeric values ​​are entered into the table separated by commas;

Output of the value of the first element of the vector S;

Outputting the value of the zero element of the vector S.

2.4 Arrays

array -- a uniquely named collection of a finite number of numeric or character elements, ordered in some way and having specific addresses.

In the package MathCAD arrays of the two most common types are used:

one-dimensional (vectors);

two-dimensional (matrices).

You can output a matrix or vector template in one of the following ways:

select menu item Insert - Matrix;

press the key combination ctrl+ M;

press the button on panel and vectors and matrices.

As a result, a dialog box will appear in which the required number of rows and columns is set:

Rows-- number of lines

columns-- number of columns

If a matrix (vector) needs to be given a name, then the name of the matrix (vector) is entered first, then the assignment operator, and then the matrix template.

for example:

Matrix -- a two-dimensional array named M n , m , consisting of n rows and m columns.

You can perform various mathematical operations on matrices.

2.5 Functions

Function -- an expression according to which some calculations are performed with arguments and its numerical value is determined. Function examples: sin(x), tan(x) and etc.

Functions in the MathCAD package can be either built-in or user-defined. Ways to insert an inline function:

Select menu item Insert- Function.

Press key combination ctrl+ E.

Click the button on the toolbar.

Type the name of the function on the keyboard.

User functions are typically used when the same expression is evaluated multiple times. To set a user function:

· enter the name of the function with the obligatory indication of the argument in brackets, for example, f(x);

Enter the assignment operator (:=);

Enter a calculated expression.

Example. f (z) := sin(2 z 2)

3. Number Formatting

In MathCAD, you can change the output format of numbers. Usually calculations are made with an accuracy of 20 digits, but not all significant figures are displayed. To change the number format, double-click on the desired numerical result. The number formatting window will appear, open on the tab number Format (Number Format) with the following formats:

o General (Main) -- is the default. Numbers are displayed in order (for example, 1.2210 5). The number of signs of the mantissa is determined in the field Exponential Threshold(Exponential notation threshold). When the threshold is exceeded, the number is displayed in order. The number of digits after the decimal point changes in the field number of decimal places.

o Decimal (Decimal) -- The decimal representation of floating point numbers (for example, 12.2316).

o Scientific (Scientific) -- Numbers are displayed in order only.

o Engineering (Engineering) -- numbers are displayed only in multiples of three (for example, 1.2210 6).

Attention. If, after setting the desired format in the number formatting window, select the button OK, the format will be set only for the selected number. And if you select the Set as Default button, the format will be applied to all numbers in this document.

Numbers are automatically rounded down to zero if they are less than the set threshold. The threshold is set for the entire document, not for a specific result. In order to change the rounding threshold to zero, select the menu item Formatting - Result and in tab tolerance , in field Zero threshold enter the required threshold value.

4 . Work with text

Text snippets are pieces of text that the user would like to see in their document. These can be explanations, links, comments, etc. They are inserted using the menu item Insert - Text region.

You can format the text: change the font, its size, style, alignment, etc. To do this, select it and select the appropriate options on the font panel or in the menu Formatting - Text.

5. Working with graphics

When solving many problems where a function is being studied, it often becomes necessary to plot its graph, which will clearly reflect the behavior of the function on a certain interval.

In the MathCAD system, it is possible to build various types of graphs: in Cartesian and polar coordinate systems, three-dimensional graphs, surfaces of bodies of revolution, polyhedra, spatial curves, vector field graphs. We will look at how to build some of them.

5.1 Construction of two-dimensional graphs

To build a two-dimensional graph of a function, you need to:

set a function

Place the cursor in the place where the graph should be built, on the mathematical panel select the Graph button (graph) and in the panel that opens, the X-Y Plot button (two-dimensional graph);

In the appeared template of a two-dimensional graph, which is an empty rectangle with data labels, enter the name of the variable in the central data label along the abscissa axis (X axis), and enter the name of the function in place of the central data label along the ordinate axis (Y axis) (Fig. 2.1 );\

Rice. 2.1. 2D Plot Template

click outside the graph template -- the graph of the function will be plotted.

The argument range consists of 3 values: initial, second and final.

Let it be necessary to plot a function graph on the interval [-2,2] with a step of 0.2. Variable values t are specified as a range as follows:

t:= -2, - 1.8 .. 2 ,

where: -2 -- the initial value of the range;

-1.8 (-2 + 0.2) -- second range value (initial value plus increment);

2 -- end value of the range.

Attention. An ellipsis is entered by pressing a semicolon in the English keyboard layout.

Example. Plotting a Function y = x 2 on the interval [-5.5] with a step of 0.5 (Fig. 2.2).

Rice. 2.2. Plotting a Function y = x 2

When plotting graphs, consider the following:

° If the range of the argument values ​​is not specified, then by default the graph is built in the range [-10,10].

° If it is necessary to place several graphs in one template, then the names of the functions are indicated separated by commas.

° If two functions have different arguments, for example f1(x) and f2(y), then the names of the functions are indicated on the ordinate (Y) axis, separated by commas, and on the abscissa (X) axis, the names of both variables are also separated by commas.

° Data end labels on the chart template are used to indicate the limit values ​​of abscissas and ordinates, i.e. they set the scale of the graph. If you leave these labels blank, the scale will be set automatically. The automatic scale does not always reflect the graph in the desired form, so the limit values ​​of the abscissa and ordinates have to be edited by changing them manually.

Note. If after plotting the graph does not take the desired form, you can:

Reduce step.

· change the plotting interval.

Reduce the limit values ​​of abscissas and ordinates on the chart.

Example. Construction of a circle with a center at a point (2,3) and a radius R = 6.

The equation of a circle centered at a point with coordinates ( x 0 ,y 0) and radius R is written as:

Express from this equation y:

Thus, to construct a circle, it is necessary to set two functions: the upper and lower semicircles. The argument range is calculated as follows:

Range start value = x 0 - R;

Range end value = x 0 + R;

It is better to take the step equal to 0.1 (Fig. 2.3.).

Rice. 2.3. Construction of a circle

Parametric graph of a function

Sometimes it is more convenient instead of a line equation relating rectangular coordinates x and y, consider the so-called parametric line equations, which give expressions for the current x and y coordinates as functions of some variable t(parameter): x(t) and y(t). When constructing a parametric graph, the names of functions of one argument are indicated on the ordinate and abscissa axes.

Example. Construction of a circle centered at a point with coordinates (2,3) and radius R= 6. For the construction, the parametric equation of the circle is used

x = x 0 + R cos( t) y = y 0 + R sin( t) (Fig. 2.4.).

Fig.2.4. Construction of a circle

Chart Formatting

To format a graph, double-click on the graph area. The Graph Formatting dialog box will open. The tabs in the chart formatting window are listed below:

§ X- Yaxes--formatting coordinate axes. By checking the appropriate boxes, you can:

· LogScale--represent numerical values ​​on the axes on a logarithmic scale (by default, numerical values ​​are plotted on a linear scale)

· Gridlines--apply a grid of lines;

· numbered--arrange the numbers along the coordinate axes;

· AutoScale--automatic selection of limit numerical values ​​on the axes (if this box is unchecked, the maximum calculated values ​​will be limit);

· showmarker-- marking the graph in the form of horizontal or vertical dotted lines corresponding to the specified value on the axis, and the values ​​themselves are displayed at the end of the lines (2 input places appear on each axis, in which you can enter numerical values, do not enter anything, enter one number or letter designations of constants);

· AutoGrid-- automatic selection of the number of grid lines (if this box is unchecked, you must specify the number of lines in the Number of Grids field);

· crossed- the abscissa axis passes through zero of the ordinate;

· Boxed-- the x-axis runs along the bottom edge of the graph.

§ Trace-- line formatting of function graphs. For each graph separately, you can change:

symbol (Symbol) on the chart for nodal points (circle, cross, rectangle, rhombus);

line type (Solid - solid, Dot - dotted line, Dash - strokes, Dadot - dash-dotted line);

line color (Color);

Type (Ture) of the chart (Lines - line, Points - points, Var or Solidbar - bars, Step - step chart, etc.);

line thickness (Weight).

§ Label -- title in the graph area. In field Title (Title) you can write the text of the title, select its position - at the top or bottom of the graph ( Above -- top, Below -- down below). You can enter, if necessary, the names of the argument and function ( Axis Labels ).

§ Defaults -- using this tab, you can return to the default chart view (Change to default), or use the changes you made on the chart by default for all charts in this document (Use for Defaults).

5. 2 Building polar plots

To build a polar graph of a function, you need to:

· set the range of argument values;

set a function

· place the cursor in the place where the graph should be built, on the mathematical panel select the Graph button (graph) and in the panel that opens, the Polar Plot button (polar graph);

· in the input fields of the template that appears, you must enter the angular argument of the function (below) and the name of the function (left).

Example. Construction of Bernoulli's lemniscate: (Fig. 2.6.)

Fig.2.6. An example of building a polar plot

5. 3 Surface plotting (3D or 3 D - graphs)

When constructing three-dimensional graphs, the panel is used graph(Graph) math panel. You can build a three-dimensional graph using the wizard, called from the main menu; you can build a graph by creating a matrix of values ​​​​of a function of two variables; you can use the accelerated construction method; you can call the special functions CreateMech and CreateSpase, designed to create an array of function values ​​and plot. We will consider an accelerated method for constructing a three-dimensional graph.

Quick Graphing

To quickly build a three-dimensional graph of a function, you need to:

set a function

place the cursor in the place where the graph should be built, select the button on the mathematical panel graph(Chart) and in the opened panel the button ( surface graph);

· in the only place of the template, enter the name of the function (without specifying variables);

· click outside the chart template -- the function graph will be built.

Example. Plotting a Function z(x,y) = x 2 + y 2 - 30 (Fig. 2.7).

Rice. 2.7. An Example of a Quick Surface Plot

The built chart can be controlled:

° rotation of the graph is performed after hovering the mouse pointer over it with the left mouse button pressed;

° scaling of the chart is performed after hovering the mouse pointer over it by simultaneously pressing the left mouse button and the Ctrl key (if you move the mouse, the chart zooms in or out);

° chart animation is performed in the same way, but with the Shift key pressed additionally. It is only necessary to start rotating the graph with the mouse, then the animation will be performed automatically. To stop the rotation, click the left mouse button inside the graph area.

It is possible to build several surfaces at once in one drawing. To do this, you need to set both functions and specify the names of the functions on the chart template separated by commas.

When plotting quickly, the default values ​​for both arguments are between -5 and +5 and the number of contour lines is 20. To change these values, you must:

· double click on the chart;

· select the Quick Plot Data tab in the opened window;

· enter new values ​​in the window area Range1 -- for the first argument and Range2 -- for the second argument (start -- initial value, end -- final value);

· in the # of Grids field, change the number of grid lines covering the surface;

· Click the OK button.

Example. Plotting a Function z(x,y) = -sin( x 2 + y 2) (Fig. 2.9).

When constructing this graph, it is better to choose the limits of change in the values ​​of both arguments from -2 to +2.

Rice. 2.9. An example of plotting a function graph z(x,y) = -sin( x 2 + y 2)

forematting 3D graphs

To format the graph, double-click on the plot area - a formatting window with several tabs will appear: Appearance,General,axes,lighting,Title,Backplanes,Special, Advanced, QuickPlotData.

Purpose of the tab QuickPlotData has been discussed above.

Tab Appearance allows you to change the appearance of the graph. Field Fill Options allows you to change the fill parameters, field line Option-- line parameters, point Options-- point parameters.

In the tab General ( general) in the group view you can choose the angles of rotation of the depicted surface around all three axes; in a group displayas You can change the chart type.

In the tab lighting(lighting) you can control the lighting by checking the box enablelighting(turn on lights) and switch On(turn on). One of 6 possible lighting schemes is selected from the list lightingscheme(lighting scheme).

6. Ways to solve equations in MathCAD

In this section, we will learn how the simplest equations of the form F( x) = 0. To solve an equation analytically means to find all its roots, i.e. such numbers, when substituting them into the original equation, we obtain the correct equality. To solve the equation graphically means to find the points of intersection of the graph of the function with the x-axis.

6. 1 Solving equations using f functions and root ( f ( x ), x )

For solutions of an equation with one unknown of the form F( x) = 0 there is a special function

root(f(x), x) ,

where f(x) is an expression equal to zero;

X-- argument.

This function returns, with a given precision, the value of a variable for which the expression f(x) is equal to 0.

Attentione. If the right side of the equation is 0, then it is necessary to bring it to normal form (transfer everything to the left side).

Before using the function root must be given to the argument X initial approximation. If there are several roots, then to find each root, you must specify your initial approximation.

Attention. Before solving, it is desirable to plot a function graph to check if there are roots (does the graph intersect the Ox axis), and if so, how many. The initial approximation can be chosen according to the graph closer to the intersection point.

Example. Solving an equation using a function root shown in Figure 3.1. Before proceeding to the solution in the MathCAD system, in the equation we will transfer everything to the left side. The equation will take the form: .

Rice. 3.1. Solving an Equation Using the Root Function

6. 2 Solving equations using f functions and polyroots ( v )

To simultaneously find all the roots of a polynomial, use the function polyroots(v), where v is the vector of coefficients of the polynomial, starting from the free term . Zero coefficients cannot be omitted. Unlike the function root function Polyroots does not require an initial approximation.

Example. Solving an equation using a function polyroots shown in Figure 3.2.

Rice. 3.2. Solving an Equation Using the Polyroots Function

6. 3 Solving equations using ffunctionsandFind(x)

The Find function works in conjunction with the Given keyword. Design Given-Find

If the equation is given f(x) = 0, then it can be solved as follows using the block Given - Find:

Set Initial Approximation

Enter a service word

Write the equation using the sign bold equals

Write a find function with an unknown variable as a parameter

As a result, after the equal sign, the found root will be displayed.

If there are several roots, then they can be found by changing the initial approximation x0 to one close to the desired root.

Example. The solution of the equation using the find function is shown in Figure 3.3.

Rice. 3.3. Solving an equation with the find function

Sometimes it becomes necessary to mark some points on the graph (for example, the points of intersection of a function with the Ox axis). For this you need:

Specify the x value of a given point (along the Ox axis) and the value of the function at this point (along the Oy axis);

double click on the graph and in the formatting window in the tab traces for the corresponding line, select the graph type - points, line thickness - 2 or 3.

Example. The graph shows the point of intersection of the function with the x-axis. Coordinate X this point was found in the previous example: X= 2.742 (root of the equation ) (Fig. 3.4).

Rice. 3.4. Graph of a function with a marked intersection point

In the chart formatting window, in the tab traces for trace2 changed: chart type - points, line thickness - 3, color - black.

7. Solving systems of equations

7. 1 Solving systems of linear equations

The system of linear equations can be solved m matrix method (either through the inverse matrix or using the function lsolve(A,B)) and using two functions Find and features Minerr.

Matrix method

Example. The system of equations is given:

The solution of this system of equations by the matrix method is shown in Figure 4.1.

Rice. 4.1. Solving a system of linear equations by a matrix method

Function uselsolve(A, B)

Lsolve(A,B) is a built-in function that returns a vector X for a system of linear equations given a matrix of coefficients A and a vector of free terms B .

Example. The system of equations is given:

The way to solve this system using the lsolve(A,B) function is shown in Figure 4.2.

Rice. 4.2. Solving a system of linear equations using the lsolve function

Solving a system of linear equationsviafunctionsandFind

With this method, equations are entered without the use of matrices, i.e. in "natural form". First, it is necessary to indicate the initial approximations of the unknown variables. It can be any number within the scope of the definition. Often they are mistaken for a column of free members.

In order to solve a system of linear equations using a computing unit Given - Find, necessary:

2) enter a service word Given;

bold equals();

4) write a function Find,

Example. The system of equations is given:

The solution of this system using a computing unit Given - Find shown in Figure 4.3.

Rice. 4.3. Solving a system of linear equations using the Find function

Approximate psolution of a system of linear equations

Solving a system of linear equations using a function Minerr similar to the solution using the function Find(using the same algorithm), function only Find gives the exact solution, and Minerr-- approximate. If, as a result of the search, no further refinement of the current approximation to the solution can be obtained, Minerr returns this approximation. Function Find in this case returns an error message.

You can choose another initial approximation.

· You can increase or decrease the calculation accuracy. To do this, select from the menu Math > Options(Math - Options), tab built- InVariables(Built-in variables). In the tab that opens, you need to reduce the allowable calculation error (Convergence Tolerance (TOL)). Default TOL = 0.001.

ATattention. With the matrix solution method, it is necessary to rearrange the coefficients according to the increase in unknowns X 1, X 2, X 3, X 4.

7. 2 Solving systems of nonlinear equations

Systems of nonlinear equations in MathCAD are solved using a computing unit Given - Find.

Design Given - Find uses a computational technique based on finding a root near an initial approximation point specified by the user.

To solve a system of equations using the block Given - Find necessary:

1) set initial approximations for all variables;

2) enter a service word Given;

3) write down the system of equations using the sign bold equals();

4) write a function Find, by listing unknown variables as function parameters.

As a result of calculations, the solution vector of the system will be displayed.

If the system has several solutions, the algorithm should be repeated with other initial guesses.

Note. If a system of two equations with two unknowns is being solved, before solving it, it is desirable to plot function graphs in order to check whether the system has roots (whether the graphs of given functions intersect), and if so, how many. The initial approximation can be chosen according to the graph closer to the intersection point.

Example. Given a system of equations

Before solving the system, we construct graphs of functions: parabolas (the first equation) and a straight line (the second equation). The construction of a graph of a straight line and a parabola in one coordinate system is shown in Figure 4.5:

Rice. 4.5. Plotting two functions in the same coordinate system

The line and the parabola intersect at two points, which means that the system has two solutions. According to the graph, we choose the initial approximations of the unknowns x and y for every solution. Finding the roots of the system of equations is shown in Figure 4.6.

Rice. 4.6. Finding the roots of a system of nonlinear equations

In order to mark on the graph the points of intersection of the parabola and the straight line, we introduce the coordinates of the points found when solving the system along the Ox axis (values X ) and along the Oy axis (values at ) separated by commas. In the chart formatting window, in the tab traces for trace3 and trace4 change: chart type - points, line thickness - 3, color - black (Fig. 4.7).

Rice. 4.7. Function plots with marked intersection points

8 . Key Features Usage Examples MathCAD to solve some mathematical problems

This section provides examples of solving problems that require solving an equation or a system of equations.

8. 1 Finding local extrema of functions

The necessary condition for an extremum (maximum and/or minimum) of a continuous function is formulated as follows: extrema can take place only at those points where the derivative is either equal to zero or does not exist (in particular, it becomes infinity). To find the extrema of a continuous function, first find the points that satisfy the necessary condition, that is, find all the real roots of the equation.

If a function graph is built, then you can immediately see - the maximum or minimum is reached at a given point X. If there is no graph, then each of the found roots is examined in one of the ways.

1st with allowance . With equalize e signs of the derivative . The sign of the derivative of the neighborhood of the point is determined (at points that are separated from the extremum of the function on different sides at small distances). If the sign of the derivative changes from "+" to "-", then at this point the function has a maximum. If the sign changes from "-" to "+", then at this point the function has a minimum. If the sign of the derivative does not change, then there are no extremums.

2nd s allowance . AT calculations e second derivative . In this case, the second derivative is calculated at the extremum point. If it is less than zero, then at this point the function has a maximum, if it is greater than zero, then a minimum.

Example. Finding extrema (minimums/maximums) of a function.

First, let's build a graph of the function (Fig. 6.1).

Rice. 6.1. Plotting a Function

Let us determine from the graph the initial approximations of the values X corresponding to local extrema of the function f(x). Let's find these extrema by solving the equation. To solve, we use the Given - Find block (Fig. 6.2.).

Rice. 6.2. Finding local extrema

Let us define the type of extremums pervway, examining the change in the sign of the derivative in the vicinity of the found values ​​(Fig. 6.3).

Rice. 6.3. Determining the type of extremum

It can be seen from the table of values ​​of the derivative and from the graph that the sign of the derivative in the vicinity of the point x 1 changes from plus to minus, so the function reaches its maximum at this point. And in the vicinity of the point x 2, the sign of the derivative has changed from minus to plus, so at this point the function reaches a minimum.

Let us define the type of extremums secondway, calculating the sign of the second derivative (Fig. 6.4).

Rice. 6.4. Determining the type of extremum using the second derivative

It can be seen that at the point x 1 the second derivative is less than zero, so the point X 1 corresponds to the maximum of the function. And at the point x 2 the second derivative is greater than zero, so the point X 2 corresponds to the minimum of the function.

8.2 Determining the areas of figures bounded by continuous lines

Area of ​​a curvilinear trapezoid bounded by a graph of a function f(x) , a segment on the Ox axis and two verticals X = a and X = b, a < b, is determined by the formula: .

Example. Finding the area of ​​a figure bounded by lines f(x) = 1 - x 2 and y = 0.

Rice. 6.5. Finding the area of ​​a figure bounded by lines f(x) = 1 - x 2 and y = 0

The area of ​​the figure enclosed between the graphs of functions f1(x) and f2(x) and direct X = a and X = b, is calculated by the formula:

Attention. To avoid errors when calculating the area, the difference of functions must be taken modulo. Thus, the area will always be positive.

Example. Finding the area of ​​a figure bounded by lines and. The solution is shown in figure 6.6.

1. We build a graph of functions.

2. We find the intersection points of functions using the root function. We will determine the initial approximations from the graph.

3. Found values x are substituted into the formula as the limits of integration.

8. 3 Construction of curves by given points

Construction of a straight line passing through two given points

To write the equation of a straight line passing through two points A( x 0,y 0) and B( x 1,y 1), the following algorithm is proposed:

1. The straight line is given by the equation y = ax + b,

where a and b are the coefficients of the line that we need to find.

2. This system is linear. It has two unknown variables: a and b

Example. Construction of a straight line passing through points A(-2,-4) and B(5,7).

We substitute the direct coordinates of these points into the equation and get the system:

The solution of this system in MathCAD is shown in Figure 6.7.

Rice. 6.7 System solution

As a result of solving the system, we obtain: a = 1.57, b= -0.857. So the equation of a straight line will look like: y = 1.57x- 0.857. Let's construct this straight line (Fig. 6.8).

Rice. 6.8. Building a straight line

Construction of a parabola, passing through three given points

To construct a parabola passing through three points A( x 0,y 0), B( x 1,y 1) and C( x 2,y 2), the algorithm is as follows:

1. The parabola is given by the equation

y = ax 2 + bX + with, where

a, b and with are the coefficients of the parabola that we need to find.

We substitute the given coordinates of the points into this equation and get the system:

.

2. This system is linear. It has three unknown variables: a, b and with. The system can be solved in a matrix way.

3. We substitute the obtained coefficients into the equation and build a parabola.

Example. Construction of a parabola passing through the points A(-1,-4), B(1,-2) and C(3,16).

We substitute the given coordinates of the points into the parabola equation and get the system:

The solution of this system of equations in MathCAD is shown in Figure 6.9.

Rice. 6.9. Solving a system of equations

As a result, the coefficients are obtained: a = 2, b = 1, c= -5. We get the parabola equation: 2 x 2 +x -5 = y. Let's build this parabola (Fig. 6.10).

Rice. 6.10. Construction of a parabola

Construction of a circle passing through three given points

To construct a circle passing through three points A( x 1,y 1), B( x 2,y 2) and C( x 3,y 3), you can use the following algorithm:

1. The circle is given by the equation

,

where x0,y0 are the coordinates of the center of the circle;

R is the radius of the circle.

2. Substitute the given coordinates of the points into the equation of the circle and get the system:

.

This system is non-linear. It has three unknown variables: x 0, y 0 and R. The system is solved using the computing unit Given - Find.

Example. Construction of a circle passing through three points A(-2.0), B(6.0) and C(2.4).

We substitute the given coordinates of the points into the equation of the circle and get the system:

The solution of the system in MathCAD is shown in Figure 6.11.

Rice. 6.11. System solution

As a result of solving the system, the following was obtained: x 0 = 2, y 0 = 0, R = 4. Substitute the obtained coordinates of the center of the circle and the radius into the equation of the circle. We get: . Express from here y and construct a circle (Fig. 6.12).

Rice. 6.12. Construction of a circle

Similar Documents

    Using ranked variables in the Mathcad software package. Creation of matrices without using matrix templates, description of operators for working with vectors and matrices. Solving systems of linear and non-linear equations using Mathcad functions.

    control work, added 03/06/2011

    General view of the MathCad window, the toolbar menu of the program under study. MathCad document, its general characteristics and editing methods. Separation of areas and context menu, expressions. Definition of discrete argument, variables and constants.

    presentation, added 09/29/2013

    The concept of mathematical model and modeling. General information about the MathCad system. Structural analysis of the problem in MathCAD. Mode of continuous symbolic transformations. Optimization of numerical tabs through symbolic conversions. Calculation of the support reaction.

    term paper, added 03/06/2014

    Purpose and composition of the MathCAD system. The main objects of the input language and the implementation language. Characteristics of user interface elements, setting up the composition of toolbars. Problems of linear algebra and solution of differential equations in MathCAD.

    course of lectures, added 11/13/2010

    General information about the Mathcad system. Mathcad program window and toolbars. Calculation of algebraic functions. Interpolation of functions by cubic splines. Calculation of the square root. Analysis of numerical differentiation and integration.

    term paper, added 12/25/2014

    Studying the structure of the working document MathCad - a program designed to automate mathematical calculations. Working with variables, functions and matrices. Application of MathCad for plotting, solving equations and symbolic calculations.

    presentation, added 03/07/2013

    The concept of a mathematical model, properties and classification. Characteristics of the elements of the Mathcad system. Algorithmic analysis of the problem: description of the mathematical model, graphic scheme of the algorithm. Implementation of the basic model and description of MathCAD studies.

    abstract, added 03/20/2014

    Mathcad and its basic concepts. Capabilities and functions of the system in matrix calculus. The simplest operations with matrices. Solving systems of linear algebraic equations. Eigenvectors. Cholesky decomposition. Elementary theory of linear operators.

    term paper, added 11/25/2014

    The main elements of the MathCAD system, an overview of its capabilities. System interface, document construction concept. Data types, system input language. Classification of standard functions. Graphical capabilities of the MathCAD system. Solution of system equations.

    course of lectures, added 03/01/2015

    Introduction to Windows text editors. Setting up the Microsoft Word editor. Development of MS Excel document. Creation of Web-pages in the environment of MS Word. Building frames. Managing font options. Plotting in the mathematical package MathCad.