Computer Algebra Systems: Brilliance, Poverty, or Why Many Problems Are Not Solved Head-on. ACS software and mathematical software
6.1 ACS software The ACS software is understood as a set of various mathematical methods, models, algorithms and software packages that ensure the operation of the ACS in accordance with its intended purpose. The term ACS software is understood as the mathematical, linguistic and software of ACS. A feature of the mathematical software of the automated control system is: - an increase in the relative cost of the software in comparison with the complex of technical means (CTS) of the automated control system; -reasonable typing (unification) of application software; -wide use of PPP, standard casings, etc.
Mathematical support of automated control systems Mathematical support (MS) can be divided into three parts: MS of the computer (or internal); special software (or external); data teleprocessing software Internal ML includes operating systems (MS DOS), programming systems and tests (programs for checking the correct operation of computer devices),
Mathematical support of ACS Operating system (OS) - a set of programs that control the process of solving problems. Optimal loading of all computer nodes and external devices is the main task of the OS. The OS includes a number of programs, of which the main ones are: dispatcher, supervisor, utility programs. Dispatcher - a program that provides a certain mode of operation of the computer. Supervisor - a program that provides work given to the machine by a human operator within the framework of the mode established for it. Service - include programs for input of initial data; programs for editing and issuing results; OS communication programs with a human operator, etc. OS are distinguished according to their intended purpose into: general for solving a wide range of tasks and problematic ones. Depending on the organization of solving problems on a computer, the following operating modes of the OS are distinguished: individual, batch, multiprogramming, time sharing.
In the individual mode, the computer is constantly or for the duration of the solution of the problem is completely at the disposal of one consumer. Batch processing assumes that the user does not have direct access to the computer. The tasks prepared by him in the form of programs and initial data are loaded by the operator into a computer and solved in batches. Multiprogramming implies the ability to simultaneously solve several tasks for different programs, taking into account the priority. At the same time, one task is solved at each moment of time. If, when solving a problem, it becomes necessary to solve another one with a higher priority, then the solution of the problem is interrupted, the second problem is solved, after it is solved, the first one continues to be solved from the place where it stopped, etc. The time-sharing mode involves the simultaneous solution of several tasks.
Mathematical support of ACS. The main goals of the OS are: increasing the performance of computing systems (CS) by processing a continuous input stream of tasks and sharing the resources of the CS by tasks simultaneously executing in the CS (multiprogramming effect); aircraft planning according to priorities individual tasks, accounting and control of the use of resources; providing programmers with tools for developing and debugging programs; providing the operator with aircraft controls.
Mathematical support of automated control system The programming system is designed to automate the process of programming tasks, it contains translators of algorithmic languages of various levels and types and service programs. The system of utility programs (tests) is designed to control the correct functioning of the aircraft, detect malfunctions and analyze the types and causes of failures. Special (external) MO includes PPP, programs for specific tasks of automated control systems, and a system dispatch program. PPP - functionally complete software complexes, focused on solving a certain class of problems.
Mathematical support of automated control systems Programs of specific tasks of automated control systems can be conditionally divided into 3 classes: programs common to all industries (industry, transport, trade, etc.); programs common to aviation industry enterprises; programs specific for each enterprise (ARZ, aviation production association, etc.). Tasks of the 1st class include tasks: (calculation of wages, accounting of personnel, accounting material assets etc.). To the second - tasks dispatch control(calculation of equipment operation modes, calculation of AT output, etc.). To the third - the specific tasks of repairing AT (release of spare parts during repairs, preparing AT for departures, etc.). A large number of programs that differ in purpose and significance require their organization on a system-wide scale, and this is done with the help of a system dispatcher program.
ML is built on the basis of typification of algorithms by classes of problems and unification of methods for solving related problems. This approach makes it possible to reduce the cost of ML, as well as to create unified models for solving various classes of problems. The first class of tasks includes tasks of primary accounting (mass) (the frequency of settlements with subscribers is millions per year, payroll settlements are hundreds of thousands per year, etc.). Examples of primary accounting tasks: daily, ten-day, monthly and annual accounting of receipts and consumption of fuels and lubricants by airlines, detachments, etc.; daily and weekly, monthly aircraft flight; accounting and analysis of aircraft equipment failures; accounting for the movement and stocks of material resources, etc.
Primary accounting allows you to accumulate a large amount of information along the way, the subsequent generalization of which will allow you to obtain full-fledged statistical data necessary for decision-making. These tasks form a class of accounting and statistical tasks, which are also related to the tasks of normative planning. Mathematical characteristic These tasks are a large number of logical operations with a small amount of simple mathematical operations. Among the tasks of this class can be noted: compilation of all forms of statistical and accounting reports; calculation of the cost of production; calculations of needs for fuel and lubricants, etc. An extensive group among those listed are accounting tasks, characterized by a large number of addition, subtraction, logical operations (sorting, grouping, comparison) and the formation of tables of a given form. Mathematical support of ACS
Mathematical modeling is widely used in three fundamentally different classes of problems: in complex non-extremal calculations, forecasting and optimization. In ACS, a person retains decision-making functions based on data issued by ACS, direct observation of a controlled process (object) (control), development and establishment of decisive rules (criteria, standards, limit levels of controlled values), improvement of management and its form, analysis of results computer operation and preparation of measures to improve the operation of the system.
6.3 Programming languages for describing tasks in APCS languages high level(i.e., non-machine languages), which have become a kind of connecting bridge between a person and a computer's machine language. High-level languages work through translation programs that enter "source code" (a hybrid of English words and mathematical expressions that a machine reads) and ultimately causes the computer to execute the appropriate commands that are given in machine language. There are two main kinds of translators: interpreters, which scan and verify source code in one step, and compilers, which scan source code to produce machine language program text that is then executed separately. Interpreters One often-cited advantage of an interpreter implementation is that that it allows "immediate mode". Immediate mode allows you to ask the computer a task like PRINT *3/2.1 and returns the answer to you as soon as you press ENTER (this allows you to use a $3,000 computer as a $10 calculator). In addition, interpreters have special attributes that make debugging easier. You can, for example, interrupt the processing of an interpreter program, display the contents of certain variables, skim the program, and then continue execution. Compilers A compiler is a text-to-machine-language translator that reads source text. It evaluates it according to the syntactic construction of the language and translates it into machine language. In other words, the compiler doesn't execute programs, it builds them. Interpreters cannot be separated from the programs they run, compilers do their job and leave the scene. When working with a compiling language such as Turbo Basic, you will come to think of your programs in terms of two major phases of their life: the compile time and the run time.
2. CLASSIFICATION OF PROGRAMMING LANGUAGES 2.1. Machine - oriented languages Machine - oriented languages are languages whose sets of operators and visual means of which significantly depend on the features of the computer (internal language, memory structure, etc.). Machine-oriented languages allow you to use all the features and features of machine-dependent languages: - high quality of created programs (compactness and speed of execution); - the possibility of using specific hardware resources; - predictability of object code and memory orders; - to compile effective programs, it is necessary to know the system of commands and the features of the functioning of this computer; - the complexity of the process of compiling programs (especially in machine languages and CJS), poorly protected from the appearance of errors; - low programming speed; - the impossibility of direct use of programs compiled in these languages on computers of other types.
Machine-oriented languages by degree automatic programming are subdivided into classes: Machine language The computer has its own specific Machine Language (hereinafter ML), it is prescribed to perform specified operations on the operands they define, therefore ML is a command language. However, some families of computers (for example, ES computers, IBM / 370 /, etc.) have a single ML for computers of different capacities. The command of any of them provides information about the location of the operands and the type of operation being performed. However, the operation codes and addresses in machine instructions, which are a sequence of binary (in the internal code) or octal (often used when writing programs) digits, are replaced in the YaSK with symbols (identifiers), the form of writing of which helps the programmer to more easily memorize the semantic content of the operation. This provides a significant reduction in the number of errors when compiling programs. Autocodes There are also languages that include all the features of the CJS, through the extended introduction of macros - they are called Autocodes. The developed autocodes are called Assemblers. Service programs, etc., as a rule, are compiled in languages such as Assembler Macro The language, which is a means for replacing a sequence of characters describing the performance of the required computer actions with a more concise form, is called a Macro (replacement tool). Basically, a Macro is meant to shorten the entry of a source program. The software component that makes macros work is called the macro processor.
2.2. Machine-independent languages Machine-independent languages are a means of describing algorithms for solving problems and information to be processed. They are easy to use for a wide range of users and do not require them to know the features of the organization of the functioning of computers and VS. Such languages are called high-level programming languages. Programs written in such languages are sequences of statements structured according to the rules of the language (tasks, segments, blocks, etc.). The language operators describe the actions that the system must perform after the translation of the program into ML. The programmer got the opportunity not to describe in detail the computational process at the level of machine instructions, but to focus on the main features of the algorithm. It was necessary to create such programming languages that, using notation and terminology in this area, would allow describing the required solution algorithms for the tasks set, they became problem-oriented languages. These languages, solution oriented languages certain problems, should provide the programmer with the means to briefly and clearly formulate the problem and obtain results in the required form. There are a lot of problematic languages, for example: Fortran, Algol - languages created to solve mathematical problems; Simula, Slang - for modeling; Lisp, Snobol - for working with list structures.
Universal Languages Universal languages have been created for a wide range of applications: commercial, scientific, modeling, and so on. The first universal language was developed by IBM, which became Pl/1 in the sequence of languages. The second most powerful universal language is called Algol-68. It allows you to work with characters, digits, fixed and floating point numbers. PL/1 has an advanced system of operators for managing formats, for working with fields of variable length, with data organized in complex structures, and for efficient use of communication channels. The language takes into account the interrupt capabilities included in many machines and has corresponding operators. The possibility of parallel execution of sections of programs is provided. Programs in Pl/1 are compiled using automatic procedures. The language uses many properties of Fortran, Algol, Cobol. However, it allows not only dynamic, but also controlled and statistical allocation of memory. Dialog languages The emergence of new technical capabilities has set the task for system programmers - to create software tools that provide operational interaction between a person and a computer, they are called dialog languages. These works were carried out in two directions. Special control languages were created to provide operational impact on the passage of tasks that were compiled in any previously undeveloped (non-dialog) languages. Languages were also developed that, in addition to the goals of control, would provide a description of algorithms for solving problems.
The need to ensure prompt interaction with the user required that a copy of the original program be stored in the computer's memory even after receiving the object program in machine codes. When making changes to the program using the dialog language, the programming system, using special tables, establishes the relationship between the structures of the source and object programs. This allows the required editorial changes to be made to the object program. One example of a conversational language is Basic. Basic uses notation similar to ordinary mathematical expressions. Many operators are simplified versions of Fortran language operators. Therefore, this language allows solving a fairly wide range of problems. Non-procedural languages constitute a group of languages that describe the organization of data processed according to fixed algorithms (table languages and report generators) and languages for communication with operating systems. By allowing you to clearly describe both the task and the actions required to solve it, decision tables make it possible to visually determine which conditions must be met before proceeding to any action. One decision table describing a certain situation contains all possible block diagrams of implementations of decision algorithms. Tabular methods are easily mastered by specialists of any profession. Programs written in a tabular language conveniently describe complex situations that arise in system analysis.
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.
Course work
COMPARATIVE ANALYSIS OF COMPUTER MATHEMATICS SYSTEMS
INTRODUCTION
CHAPTER 1
1.1 Variables and constants
1.2 Vectors and matrices
1.3 Operators
1.4 Built-in functions
1.5 Programming
1.6 Solving Equations
1.7 Symbolic calculations
1.8 Graphs
1.9 Polar plots
1.10 Surface plots
CHAPTER 2
2.1 Operating environment of the MATLAB system
2.2 Arrays, matrices and operations with them
2.3 Mathematical functions and operations
2.4 Linear algebra
2.5 Data analysis and processing
2.6 Graphic commands and functions
2.7 Programming in the MATLAB environment
CHAPTER 3
3.1 Mathematica as a calculator
3.2 Palettes and buttons
3.3 Computing power of the Mathematica system
3.4 Mathematica features
3.5 Building calculations
3.6 Visualization in Mathematica
3.7 Basic approach to describing objects
3.8 Mathematica as a programming language
CHAPTER 4. Comparative analysis. Conclusion
CHAPTER 5. Practical part
List of sources used
Attachment 1
Appendix 2
Appendix 3
Appendix 4
Appendix 5
Appendix 6
Appendix 7
Appendix 8
Appendix 9
APPENDIX 10
Introduction
Nowadays, due to the development information technologies So-called computer mathematics systems have appeared, or they are also called mathematical packages that facilitate the implementation of various mathematical tasks, help to check the solution of the problem using a computer program. The time for completing tasks of varying complexity is greatly reduced. For hundreds of thousands of professionals in various industries, engaged in engineering and scientific research, computer mathematics systems have provided an excellent environment for organizing calculations. Therefore, familiarity with the basics of organizing mathematical packages can be useful both for specialists starting to master this system and for university students in various specialties. They have an extremely wide range of tools that translate complex mathematical algorithms into programs, the so-called elementary functions and a huge number of non-elementary functions. , algebraic and logical operations. Most of the exercises from the course higher mathematics can be solved with just one command. You can calculate integrals, solve differential equations, ordinary equations and systems linear equations. Provided a wide range of work with matrices, vectors. It is possible to build two-dimensional and three-dimensional graphs. There are several mathematical packages such as Mathcad, MATLAB, Mathematica, Maple, Statistica and others. But on an example, consider three of them: Mathcad, MATLAB and Mathematica; each separately - its features and interface, and then we will conduct a comparative analysis between them.
Chapter 1.Mathcad
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. The menu in Mathcad is nothing unusual: like many other programs, there are various toolbars, a formatting bar. In addition, there is the "Math" panel, which includes such panels as "Calculator", "Graphics", "Matrices", "Calculations", "Calculation", "Logic", "Programming", "Greek" and "Symbol" . These panels contain various non-keyboard characters and functions.
1.1 Variables and constants
Valid Mathcad variable and function names, predefined variables like this, and number representations are described here. Mathcad handles complex numbers just as easily as real numbers. Mathcad variables can take complex values, and most of the built-in functions are defined for complex arguments.
Names
Mathcad distinguishes between Greek and Roman letters.
If you use a Greek character instead of the corresponding Roman character in a variable or function name, Mathcad will treat it as a different name.
Letter indices
If you place a dot in a variable name, Mathcad displays everything that follows it as a subscript. You can use these literal subscripts to create variables with names like vel init and u air .
Predefined Variables
Mathcad contains eight variables, the values of which are determined immediately after starting the program. These variables are called predefined or built-in variables. Predefined variables or have a common meaning, like p and e, or used as internal variables that control how Mathcad works, like ORIGIN and TOL.
You can control the TOL, ORIGIN, PRNPRECISION, and PRNCOLWIDTH values without having to explicitly define them in the worksheet.
The complete list of predefined Mathcad variables and their default values is given below. See "Table 1" ("Appendix 1").
Numbers
This section describes the different types of numbers used by Mathcad and how to write them into formulas.
Numbers Used
Mathcad interprets anything that starts with a digit as a number. The figure may be accompanied by:
other numbers,
decimal point
digits after the decimal point,
one of the letters h or o for hexadecimal and octal numbers, i or j for complex numbers.
Mathcad uses a dot to separate the fractional part of a decimal, while a comma is used to separate numbers from each other, such as discrete argument values or numbers in an input table.
imaginary numbers
To enter an imaginary number, you need to enter the symbol of the imaginary unit after its modulus i or j, for example, 1 i or 2.5 j. Can not use i or j by themselves to denote the imaginary unit.
1.2 Vectors and matrices
Arrays in Mathcad are described here. While ordinary variables (scalars) store a single value, arrays store many values. As is common in linear algebra, arrays that have only one column will often be called vectors, all others matrices.
Array Calculations
Variables can represent arrays just like scalars. Defining a variable as an array is much like defining a scalar.
For example, if we define a vector v, You can now use the name v instead of the vector itself in any expression.
Subscripts and superscripts
You can access individual array elements using subscripts. You can also refer to an individual array column using a superscript. To print a subscript, use the buttons on the toolbar.
The vector and matrix elements are usually numbered starting from row zero and column zero.
Vector and matrix operators
Some of the Mathcad operators have special meanings when applied to vectors and matrices. For example, the multiplication symbol simply means multiplication when applied to two numbers, but it also means dot product when applied to vectors, and matrix multiplication when applied to matrices. The list of vector and matrix operators is given below. See "Table 2" ("Appendix 2").
Vector and matrix functions
Mathcad contains functions for common linear algebra operations with arrays. These functions are intended for use with vectors and matrices. Unless it is explicitly stated that a function is defined for a vector or matrix argument, you should not use arrays as an argument in it.
Array Dimensions and Range
Mathcad has several functions that return information regarding the size of an array and the range of its elements: rows(A)- number of rows in the array A,cols(A)- number of columns in the array A, length(v)- the number of elements in the vector v,max(A)- the largest element in the array A.
Special Matrix Types
You can use the following functions to generate from an array or scalar a matrix of a special type or shape. These are the features diag(returns a diagonal matrix) , reref(Step Matrix) identity(n) (identity matrix n x n) and other functions.
Matrix Special Features
You can also find the rank of a matrix: rank(A) and the norm: normal1(A).
Formation of new matrices from existing ones
Mathcad has functions for joining matrices together -- side by side, or one on top of the other. One of them: stack (A, B) - array formed by location A above B. Mathcad also has a function to extract a submatrix: submatrix (BUT, ir, jr, ic, jc) - A submatrix consisting of all elements contained in rows with ir on jc and columns with ic on jc.
1.3 Operators
Mathcad uses common operators like + and /, as well as operators defined for matrices, such as transposition and determinant operators, and special operators such as calculating integrals and derivatives.
List of operators
A partial list of Mathcad operators is given below. See "Table 3" ("Appendix 3"). Most operators can be entered into a working document using the operator palettes. To open the operator palette, click on the desired button on the button strip directly below the menu commands.
All operators listed in the table can be typed from the keyboard, can be found on the toolbar in the menu Maths. These are the panels Arithmetic, Mathanalysis, Boolean.
1.4 Built-in functions
Many of Mathcad's built-in functions are listed and described here.
The functions used to work with vectors and matrices are described in Section “Vectors and Matrices”.
Inserting built-in functions
To insert a function in Mathcad, you can click on the toolbar Paste ->Function.
Transcendent Functions
This section describes trigonometric, hyperbolic and exponential functions Mathcad along with their inverses.
Trigonometric functions and their inverses. Mathcad trigonometric functions and their inverses are defined for any complex argument. They also return complex values wherever needed.
Here is some of them: sin(z)- returns the sine of z, asin(z)- returns the angle in radians whose sine is z, sec(z)- returns 1/cos(z), secant z. Other trigonometric functions are defined similarly.
Hyperbolic functions
These functions can also take a complex argument and return complex values. Hyperbolic functions are closely related to trigonometric functions.
One of them - sinh(z)- returns the hyperbolic sine of z.
Logarithmic and exponential functions
Mathcad logarithmic and exponential functions can take a complex argument and return complex values: exp(z)- returns e to the power of z, log(z)- returns the natural logarithm of z,
log(z)- returns the logarithm of z to base 10.
Truncation and rounding functions
All of these functions extract some part of their argument.
Functions Re, Im and arg extract the corresponding part of the complex number (real, imaginary, and when z is in the form re i q). Functions ceil and floor return the nearest integer greater than and less than the argument, respectively. These functions can be used to create a function that returns the fractional part of a number.
Sort functions
Mathcad contains three functions for sorting arrays and one for reversing the order of their elements:
sort(v)- returns the elements of the vector v, sorted in ascending order.
1.5 Programming
Mathcad allows you to write programs. A program in Mathcad is an expression, which in turn consists of other expressions. Mathcad programs contain constructs much like programming language constructs: conditional control transfers, loop statements, variable scopes, subroutines, and recursion. Writing programs in Mathcad allows you to solve problems that are impossible or very difficult to solve in another way.
Creating programs
The Mathcad program is a special case of the Mathcad expression. Like any expression, a program returns a value if it is followed by an equals sign. Just as a variable or function can be defined with an expression, it can also be defined with a program.
The main difference between a program and an expression is how the calculations are specified. When using an expression, the algorithm for obtaining a response must be described by a single operator. As many statements as needed can be used in a program.
Conditional statements
Normally, Mathcad executes program statements in order from top to bottom. There may be cases in which a statement needs to be executed only if a certain condition is met. This can be achieved using the “ if”.
Cycles
One of the greatest advantages of programming is the ability to repeatedly execute a sequence of statements in a loop. Mathcad offers two types of loops that differ in the way they define the end condition of the loop.
If the required number of loop executions is known in advance, it is advisable to use a loop of the type for.
If the loop must terminate upon the fulfillment of a certain condition, and the moment of fulfillment of this condition is not known in advance, then it is advisable to use a loop of the type while.
Programs within programs
One of the features that determine the flexibility of programming methods is the ability to use some program structures within others. In Mathcad, this can be done in three ways:
· One of the statements of the program can be made, in turn, a program.
· You can define a program somewhere else and call it from other programs as if it were a subroutine.
You can define a function in a recursive way.
1.6 Solving Equations
Learn how to use Mathcad to solve equations and systems of equations. It is possible to solve both one equation with one unknown and systems of equations with several unknowns. The maximum number of equations and unknowns in the system is fifty.
Solving one equation
To solve one equation with one unknown, the function is used root(f(z), z) - returns the z value at which the expression or function f(z) goes to 0.
Function root designed to solve one equation with one unknown.
Systems of equations
Mathcad makes it possible to solve systems of equations as well. The result of the solution of the system will be the numerical value of the desired root. For symbolic solution of equations, it is necessary to use blocks of symbolic solution of equations. In the symbolic solution of equations, the desired root is expressed in terms of other variables and constants.
Find (z1, z2, z3, . . .) - returns the solution of the system of equations. The number of arguments must be equal to the number of unknowns.
Keyword Given, standing at the beginning of the definition of the equation, the equations themselves and the inequalities that follow it, and any expression containing the function find, called block for solving equations.
1.7 Symbolic calculations
This describes symbolic transformations in Mathcad. Symbolic conversions are described below. See "Table 4" ("Appendix 4").
1.8 Graphs
Plots in Mathcad are both versatile and easy to use. To create a graph, click where you want to insert the graph, select Cartesian Graph from the Graph menu, and fill in the empty fields. You can format graphs in every possible way by changing the appearance of the axes and the style of the curves and using various labels.
Insert a graph
To insert a graph into Mathcad, you can click on the toolbar " Graphic arts".
In general, graphs are built on the basis of available templates. Initially, you need to define the graph function.
The bottom, top, left and right borders of the chart are edited. If you double-click on the graph with the left mouse button, the graph setting will appear: coordinate axes, color, line output style. You can also set the range in increments. A range is required to define a function parametrically.
1.9 Polar plots
In some cases, when plotting graphs, it is more convenient to use polar rather than Cartesian coordinates. Mathcad allows you to build polar plots.
Here you can also edit the graph and place multiple graphs in one area.
1.10 Surface plots
Along with two-dimensional and three-dimensional graphs, you can include in Mathcad working documents. Unlike 2D plots, which use discrete arguments and functions, 3D plots require a matrix of values. This shows how a matrix can be represented as a surface in 3D space. It also covers the creation, use, and formatting of surfaces in 3D space.
Chapter 2 MATLAB
MATLAB is an interactive system whose main object is an array, for which you do not need to specify the dimension explicitly. This makes it possible to solve many computational problems associated with vector-matrix formulations, significantly reducing the time that would be required for programming in scalar languages like C or FORTRAN.
MATLAB is both an operating environment and a programming language. One of the greatest strengths of the system is that programs can be written in MATLAB for reuse. The user can write specialized functions and programs himself, which are issued in the form of M-files.
2.1 OpMATLAB iteration environment
The operating environment of the MATLAB system is a set of interfaces that support the connection of this system with the outside world. This is a dialogue with the user through the command line or a graphical interface, viewing the workspace and access paths, the editor and debugger of M-files, working with files and the DOS shell, exporting and importing data, interactive access to help information, dynamic interaction with external Microsoft systems Word, Excel Microsoft Word, Excel, etc. These interfaces are implemented through the command window, toolbar, workspace and access path viewers, M-file editor/debugger, special menus, etc.
command window
The MATLAB command window contains options that can be viewed in "Table 5" ("Appendix 5").
Dashboard
The toolbar of the command window of the MATLAB system allows you to provide easy access to operations on M-files.
These operations include:
Creation of a new M-file (New File);
Opening an existing M-file (Open File);
Fragment copying (Copy);
Fragment insertion (Paste);
Viewing the workspace (Workspace Browser);
current help (Help).
M-file editor/debugger
The MATLAB system includes the M-file Editor/Debugger, which can be called from the command line with the edit or edit command<имя М-файла>.
2.2 Arrays, matrices and operations with them
Arrays are the basic objects in the MATLAB system. Functions for forming arrays and matrices, operations on matrices, and special matrices are described below.
Formation of arrays of a special type
ZEROS - formation of an array of zeros
ONES - formation of an array of units
EYE - formation of an identity matrix
CROSS - vector product
Matrix operations
DIAG - formation or extraction of matrix diagonals
TRIU - formation of an upper triangular matrix (array)
· FLIPUD - rotation of the matrix relative to the horizontal axis and others.
Special matrices
· MAGIC - magic square
2.3 Mathematic functions and operations
MATLAB has an extensive library of mathematical functions. Each function has a specific name. The function maps the values of its arguments to the value of the result.
Function arguments are always specified in parentheses after the function name and, if there is more than one, separated by commas.
Mathematical operations
a+b - addition
a=b - assignment operator
a.*b - element-wise multiplication
a*b - matrix multiplication
a.^b - element-wise exponentiation
a^b - matrix exponentiation
a>b - more
a>=b - greater than or equal to
a~=b - unequal
a==b - equals
a&b - logical AND
a|b - logical OR
~a - logical NOT
a." - transposition
a" - complex conjugate transposition
b(a) - indexing
Basic Functions
ABS - absolute value
ANGLE - complex number argument
REAL, IMAG - real and imaginary parts of a complex number
· CEIL, FIX, FLOOR, ROUND - rounding functions
Transcendent Functions
SQRT - square root
EXP - exponential function
LOG - natural logarithm function
LOG10 - logarithm functions
Trigonometric functions
SIN, SINH - sine functions
COS, COSH - cosine functions
TAN, TANH - tangent functions
COT, COTH - cotangent functions
2.4 Linear algebra
A matrix as a mathematical object arises when solving specific computational problems, and primarily when solving systems of linear algebraic equations and eigenvalue problems. Applied problems that generate matrices determine for them a special set of admissible operations, among which the multiplication operation occupies a special place.
Consider the functions of the MATLAB system that support working with matrices.
Matrix characteristics
NORM - norms of vectors and matrices
RANK - matrix rank
DET - matrix determinant
RREF - triangular matrix
2.5 Data analysis and processing
This chapter describes the functions of the MATLAB system that are designed to analyze and process data specified as numeric arrays. Here, the functions of calculating the average, median, finite differences, gradient are considered. Numerical integration functions, solutions of the Cauchy problem for systems of ordinary differential equations.
Basic operations
· SUM, CUMSUM - summation of array elements
· PROD, CUMPROD - product of array elements
SORT - sort array elements in ascending order
MAX - determination of the maximum elements of the array
MIN - definition of the minimum array elements
Numerical integration
TRAPZ - trapezoidal integration
· QUAD, QUAD8 - calculation of integrals by quadrature method
Integration of ordinary differential equations
· ODE23, ODE45 - solution of the Cauchy problem for systems of ordinary differential equations
Calculation of minima and zeros of a function
FMIN, FORTIONS - minimization of a function of one variable
FMINS - function minimization of several variables
FZERO - finding zeros of a function of one variable
· FPLOT - plotting functions of one variable
2.6 Graphic commands and functions
Starting with version 4.0, the MATLAB system includes a powerful graphics subsystem that supports both visualization tools for two-dimensional and three-dimensional graphics on the terminal screen and presentation graphics tools.
Elementary graphical functions of the MATLAB system allow you to build the following types of graphs on the screen: linear, logarithmic, polar.
For each graph, you can set a title, apply the designation of the axes and scale grid.
2D Plots
PLOT - graph on a linear scale
LOGLOG - graph on a logarithmic scale
· SEMILOGX, SEMILOGY - graph in a semi-logarithmic scale
· POLAR - graph in polar coordinates
3D Graphs
The MATLAB system provides several commands and functions for constructing three-dimensional graphs.
The values of the elements of a numeric array are treated as the z-coordinates of points above the plane defined by the x and y coordinates. There are several ways to connect these points. The first of them is the connection of points in a section (the plot3 function), the second is the construction of mesh surfaces (the mesh and surf functions).
· PLOT3 - construction of lines and points in three-dimensional space
MESH, MESHC, MESHZ - three-dimensional mesh surface
SURF, SURFC - shaded mesh surface
· ZOOM - chart scale control
COLORMAP - color palette
Labels and explanations for charts
· TITLE - titles for two- and three-dimensional graphs
XLABEL, YLABEL, ZLABEL - designation of axes
· TEXT - adding text to the current chart
Special Graphics
The dedicated graphics section includes graphics commands and functions for bar graphs, histograms, vector and complex element displays, discrete data sequence output, and moving paths for both 2D and 3D graphics.
BAR - bar charts
HIST - building a histogram
STEM - discrete graphics
STAIRS - step chart
WATERFALL - three-dimensional surface
2.7 Programming in the MATLAB environment
Programming
Files that contain MATLAB language codes are called M-files. A text editor is used to create an M-file; the M-file call is preceded by the assignment of values to the input arguments; the result is the value of the output variable. Thus, the whole procedure includes two operations:
· Create an M-file using a text editor.
Call an M-file from the command line or from another M-file:
Types of M-files. There are two types of M-files: M-scenarios and M-functions with the characteristics indicated in "Table 6" ("Appendix 6").
M-file structure.
An M-file designed as a function consists of the following components:
function definition string
The first line of the comment
· Comment
function body
Creation of M-files. M-scenarios. M-functions
M-files are plain text files that are created with a text editor. For Operating Environment personal computer MATLAB supports a dedicated built-in editor/debugger, although any other ASCII text editor can be used.
M-scenarios
Scripts are the simplest type of M-file - they have no input or output arguments. They are used to automate repetitive calculations. Scripts operate on data from the workspace and can generate new data for further processing in the same file. The data that is used in a script is stored in the workspace after the script ends and can be used for further calculations.
M-functions
M-functions are M-files that allow input and output arguments. They operate on variables within their own workspace, separate from the workspace of the MATLAB system.
The structure of the M-function. The M-function consists of:
function definition strings;
the first line of the comment;
The actual commentary
body of the function
inline comments
Every function in the MATLAB system contains a function definition string like this one.
If the function has more than one output argument, the list of output arguments is enclosed in square brackets. Input arguments, if present, are enclosed in parentheses. Commas are used to separate arguments in the input and output lists.
The names of the input variables may, but need not, be the same as the names specified in the function definition line.
Comment. For M-files, you can create an online tooltip by entering text on one or more comment lines.
Function body. The body of the function contains the MATLAB language code that performs the calculations and assigns values to the output arguments. Statements in a function body can consist of function calls, program flow control constructs, interactive I/O, calculations, assignments, comments, and empty strings.
Chapter 3 Mathematica
Mathematica, created ten years ago, has an extremely wide range of tools that translate complex mathematical algorithms into programs. All the so-called elementary functions and a huge number of non-elementary ones; algebraic and logical operations. The Mathematica system is very widespread in the world, it has captured huge areas of application in scientific and engineering research, as well as in the education system.
3 .1 Mathematica as a calculator
You can use Mathematica just like a calculator: you enter data and Mathematica outputs the result.
Mathematica automatically handles numbers of any size.
You can work in standard mathematical notation using palettes or special keyboard shortcuts.
An important feature of the Mathematica system is its ability to operate with symbolic expressions as easily as with numbers.
Solving an equation in Mathematica. The roots of the equation are found using the function solve. The roots of the equation are functions that depend on a parameter.
The calculation of the integral is carried out similarly to the calculations in other
math packages.
You can use Mathematica to plot 2D and 3D function graphs.
The graph of this function is shown in "Figure 1" ("Appendix 7").
You can take advantage of the many computing capabilities of Mathematica by simply clicking one of the buttons in the standard palettes.
3.2 Palettes and Buttons
Palettes and buttons provide a simple and fully customizable point-and-click interface for Mathematica.
Mathematica comes with several standard palettes.
Part of the palette BasicCalculations shown in "Table 7" ("Appendix 8").
Palettes are an extension of the presented keyboard.
In the palette, the symbol means the position where you want to insert some expression: Log , 2 , Exp, etc.
Creating your own palette is very easy.
Using the Create Table/Matrix/Palette command in the Input menu, you can create your own palette.
You can create your palettes to enter any function or operator, such as Expand, Factor, Simplify.
3.3 CalculateThe power of Mathematica
Mathematica provides great computing power while remaining as easy to use as a calculator.
This command creates a 100x100 matrix of random numbers.
On most computers, Mathematica takes less than a second to calculate all the eigenvalues of this matrix and present their moduli in the form of a graph, which is shown in "Figure 2" ("Appendix 9").
Mathematica can operate on numbers of any size. On most computers, calculating the exact value of 1000! in Mathematica takes less than a second. Mathematica easily copes with algebraic transformations, such as factoring a polynomial into factors: the command factor() .
Mathematica uses sophisticated algorithms to simplify expressions: the command Simplify() .
In many types of calculations, the Mathematica system is the world record holder in terms of the speed of calculations and the amount of information processed.
3.4 Mathematica features
The Mathematica system combines a large stock of mathematical knowledge and uses its own algorithms.
Mathematica implements hundreds of special functions used in pure and applied mathematics.
The Mathematica system can calculate the values of special functions with any parameters and with any precision.
Mathematica can calculate many different types of integrals.
Mathematica can also calculate finite and infinite sums and products.
Mathematica can solve a wide range of ordinary and partial differential equations.
The built-in algorithms of the Mathematica system are able to cope with a wide range of mathematical problems.
3.5 Building calculations
The ability to work with formulas will allow you to easily combine all parts of the calculation together.
Calculating Matrix Eigenvalues: Command Eigenvalues[{{},{}}].
Mathematica can calculate eigenvalues even if there are symbolic parameters in the matrix.
Built-in system functions Mathematica is designed so that the result of one function can be easily used as input to another function.
3.6 Visavisualization in Mathematica
Mathematica makes it easy to create great images.
This command draws a 3D parametric plot with most options automatically selected.
The graph itself is presented in "Figure 3" ("Appendix 10").
Mathematica contains graphical primitives with which you can build 2D and 3D graphs of any complexity.
List of primitives representing a point.
3.7 Basic approach to describing Mathematica objects
Mathematica is based on the idea that everything can be represented as a symbolic expression.
All symbolic expressions are written in a single form: head.
Item List:
Algebraic expression:
The equation:
Boolean expression:
Team:
Schedule:
3.8 Mathematicsatica as a programming language
Mathematica has a very flexible and intuitive programming language built into it.
The Mathematica language supports all the major modern programming methods, and also provides some new features.
procedural programming
Many operations are automatically propagated to lists.
This command concatenates nested lists.
Functional programming
The command is a "pure function". An argument is substituted for the character.
Chapter 4. Comparative analysis. Conclusion
We will carry out a comparative analysis of computer mathematics systems in the form of a table.
Comparison criterion |
||||
Interface |
Like "wysiwyg". The set of expressions comes from the position of the cursor. You have to enter relatively few keyboard expressions, as there are various tool palettes in the command window. |
Three windows: a command window, all variables and their types, and a hint window. There is a prompt string, denoted by ">>". Unlike Mathcad, all functions have to be entered from the keyboard. |
The prompt line, unlike MATLAB, is divided into two regions: input and output, which together make up the region of the entire expression. The input area can be edited. There is also a palette with Greek letters, various symbols and a math analysis panel. |
|
Working with arrays and matrices |
A sufficient set of functions is provided for performing various operations with matrices and vectors. Some operations can be taken from the corresponding palette, others can be entered from the keyboard or pasted from the menu Insert->Functions. |
Similarly to Mathematica, matrices and vectors are formed using a list of elements. Functions are entered from the keyboard. |
A multidimensional dataset is created using a list entered from the keyboard. Also, functions for working with matrices and vectors are introduced from the keyboard. |
|
Solving Equations |
Distinguishes between solving equations and systems of equations. Commands can be typed from the keyboard, can be inserted from the menu. |
Solves equations and systems of equations by a function with different parameters. |
Contains several functions for solving equations and systems of equations. Functions can find roots of equations with a parameter. There is also a function for special solutions. |
|
Mathematical Operators |
The table contains a number of operators, both simple ones like addition, and calculating the sum, product, integrals and derivatives, etc., which can be entered from the keyboard or inserted from the appropriate palette. |
Here, unlike Mathcad, all operators are entered from the keyboard as separate symbols and functions. A relatively detailed list of operators is given. |
Just like in MATLAB, operators have to be entered from the keyboard, but some can also be found on the tool palette. |
|
Built-in Functions |
They are built on the principle of all functions: the name of the function and the parameters in brackets. It is possible to single out the functions of simplifying the expression, opening brackets, trigonometric and a number of others. |
Here, only functions that are entered from the keyboard are mainly used. |
A lot of functions for various purposes with a different number of parameters are given. Help the user in solving various problems. |
|
Programming |
Templates are provided for creating programs and subroutines. The output value is last value calculated by the program. Also inside the program, you can use the functions described earlier. Programs are written in the same file as all calculations. |
Here programs are created as separate M-files. If you write a program for a function, then this function can be used as a standard one. You can also insert comments into the program. |
You can create various functions and operate on them. Allows you to create programs within one input block. The result will be the last calculated value. Unlike Mathcad, where programs are written "in a column", here they are written in a line. |
|
Graphic features |
Graphs are built on the basis of available templates. Main types: graph in the Cartesian plane, in the polar coordinate system, three-dimensional in the form of a smooth surface, in the form of contour curves, etc. First, the function of the graph, the range, is set, then the graph itself is built, which can be edited. |
The graph function is created from the command line. Graphs are created on forms in a certain coordinate system. You can specify chart properties in the plotting command. |
The function that draws the graph ends with "PLOT" in the 2D case, and "PLOT 3D" in the 3D case. To build a graph, you must first define a function. You can also edit the chart. |
Conclusion
As can be seen from the comparative analysis, all mathematical packages are similar to each other. They have similar principles for constructing calculations, graphs of functions. Mathcad, MATLAB, and Mathematica both have lists of built-in functions and operators. But there are also differences, for example, in the interface, programming methods. At this level of development of education, I think that it is impossible to do without computer mathematics systems. Otherwise, why did they appear then?
Chapter 5. Practical part
It was required to create a website with the same title of the term paper, namely "Comparative analysis of computer mathematics systems".
The site was created to bring information about the purpose of computer mathematics systems to everyone.
The site contains the following html pages: 1 - Main page; 2 - Mathcad; 3 - MATLAB; 4 - Mathematica; 5 - Comparative analysis. Conclusion.
Pages Mathcad, MATLAB, Mathematica, in turn, also contain several pages.
The folder structure for storing the structure of the site is as follows: a folder "sweta" has been created, which contains all the pages and all the contents of the site. This folder contains the main page ind.htm and all pages of the site.
Also in this folder is the ind.files folder, which contains the mystyle.css style sheet, graphic files connected to the site pages, and several folders, which in turn also contain graphic files connected to the site pages.
File ind . htm, as mentioned earlier, is the main page.
On this page in the upper left corner there is a label that is directly related to the name of the site and illustrates it to some extent. The label is a necessary link of the main page of the site.
Next to the label is the actual name of the site. In the center of the page is a table consisting of two columns: the first contains a menu, also designed as a table; in the right - part of the narrative, that is, the introduction.
At the bottom of the main page there is a ticker with the website creator's email address.
From the main page, using hyperlinks, you can get to four pages - these are the files ind1.htm - general about Mathcad, ind2.htm - general about MATLAB, ind3.htm - general about Mathematica and ind4.htm - comparative analysis of mathematical packages and output.
On these pages, there is a menu at the top, followed by general information about a specific package and hyperlinks to individual pages of the site intended for Mathcad, MATLAB and Mathematica, respectively. You can return back to the main menu using the hyperlinks located at the top of these pages. Most of the pages include pictures illustrating the theory posted on the site.
All html files, numbered from one, belong to the Mathcad system, numbered from two - to MATLAB, from three - to the Mathematica system.
The general background of the site is light lilac, which makes it easier to read the text and is prudent if the user begins to print the web page.
Font - 13.5 size, therefore, reads well.
All pages of the site are created using a style sheet called mystyle.css. It includes headings of levels 1-4, menu items of levels 1-4, hyperlinks, tables and table cells, body text.
The style sheet is connected as an external file, a link to it is embedded in the document using the tag .
The following tags were used to create the site.
- is a container that contains all the content of a web page.
- title of the document.- designed to create one table cell.
- designed to display on a web page images in GIF, JPEG or PNG graphic format. Specifies a text paragraph. Sets a newline at the location where this tag occurs. - container for changing font characteristics: size, color, typeface.
|