Mathematical programming in Mathcad and Mathematica

. An article generalizes the long-term work of authors with packages of applied mathematical programs. It discusses and demonstrates the features and methods of solution of mathematical tasks in mathematical package Mathcad and Mathematica: from the simplest ones, included in the set of typical problems of mathematical disciplines for training specialists for shipbuilding, to complex computational tasks and applied problems of professional orientation, which require the construction of a mathematical model and analysis of the results obtained. The examples show the solution of mathematical problems in symbolic form, mathematical studies in the Mathcad and Mathematica environment, and mathematical programming with these packages.


Introduction
In the modern society, the competitiveness of university graduates in the labour market is determined not only by the level of their basic training, but also by the ability to use computer technology in their professional activity.Therefore, the skills to use computer technology should be formed from the first year of study.The most effective way to achieve that is to build a system of mathematical training based on the integration of mathematics and computer science [1].Such an integration is becoming increasingly important with the development of society informatization.At present, a new concept and discipline is being born at the junction of mathematics and new information technologiescomputer mathematics, without which tools the so widespread today remote learning would be impossible [2].
Modern secondary school and university students freely orient themselves in the search for information while working with software resources.Therefore, the requirements to use office packages Microsoft Office Word, Excel, and others in students' independent works form, on the one hand, the skills to use the tools of computer mathematics and, on the other hand, simplify routine computing operations, thus making them more attractive for students [3].
The appearance of mathematical application packages Maple, MATLAB, Mathcad, and Wolfram Mathematica in the 90s of the last century provides the possibility to include them as a computer support in the university course of higher mathematics.The use of these packages creates not only a comfortable computing, but also a flexible educational environment of the studied subject.This contributes to the building of the whole process of studying mathematical and informational disciplines on the basis of modern educational technology understood not only as the use of elements of computer mathematics, but also as the creation of an electronic environment that uses all forms of learning together with tools and techniques of other subject areas [4].
The presence of the three groups of tools in modern mathematical application packages, that is, symbol mathematics, computational mathematics, and graphics allows to easily perform analytical transformations of mathematical expressions, make complex calculations, and present graphically the results obtained [5].The use of these packages will permit to the student to check transformations made manually, for example, calculations of integrals or derivatives as well as to avoid mistakes in cumbersome calculations.An effective use of mathematical packages will allow students to focus more on the construction of mathematical models, selection of solution methods, and on the analysis of results obtained.
The support of the educational process using mathematical software packages allows you to organize and optimize the independent work of students, which takes many hours in the curriculum [6].Successful study of mathematics, as well as the completion of homework and course projects, is possible when students are provided with electronic educational materials developed by teachers of the Department of Mathematics and available via the Internet.At the same time, information about using Maple, MATLAB, Mathcad or Wolfram Mathematica will be especially useful for this work.
A database of methodical materials may be developed on the basis of one of the systems of remote learning, such as the Math-Bridge platform [7], Sakai platform [8].A training website hosted on the portal of an educational institution is best suited for these purposes (fig.1).
The present article presents the methodological materials that ensure various approaches to the organization of the teaching process with the use of mathematical application packages Mathcad and Mathematica.Three main approaches are proposed: a practicum under the supervision of an instructor, selected practical sessions in the computer class, and term projects with the use of mathematical packages.The study of mathematical sciences with the use of modern information technology will improve the quality of mathematical training, which is a key factor in the success of engineering education.

Methods
In the Saint-Petersburg State Marine Technical University, the use of application program packages in such disciplines as Mathematics, Probability Theory and Mathematical Statistics, Mathematical Physics, Computational mathematics is carried out within the framework of the Practicum on Calculation Methods organized by the Department of Mathematics in the form of independent class work under the supervision.To provide a methodological support for the practicum, there have been elaborated e-learning tools and sets of tasks for independent works.Independent class work is directly related to academic topics (modules) of the current semester.The methodological learning aids (in the form of electronic modules) for independent work include descriptions of the mathematical methods under study, necessary electronic tools, sets of exercises, demo tasks, and individual tasks.
When writing these methodological materials the authors aimed at bringing them into conformity with the curriculum in the modular form, so that different types of classes (lectures, practical works, and the laboratory practicum) match each other at a week-by-week study of disciplines.Essentially, the developed methodological aids are handouts, the hard copy of which is used in the computer class by the instructor.At such organization of the teaching course, different instructors may teach different types of classes.
All the methodological tools are accessible on the website developed by the Department of Mathematics and hosted at the university portal at www.smtu.ru(fig.1).Methodological aids for laboratory work are placed in Current educational materials' folder.Students have access only to electronic modules, which they have to study in the current semester.They are required to present solutions of all tasks for independent work in an analytical/numerical form, as well as graphical representations of solutions.Reports on each completed laboratory work are saved in the electronic form.They include files with calculations done in the required program package and an analysis note made in a text editor.In teaching mathematical disciplines, the use of the Mathcad package is the most common due to the simplicity of its tools, due to the availability of a large amount of literature on the capabilities of this software package [9], as well as due to its widespread use in teaching special disciplines [10,11].
1.1.1Methodical materials for laboratory sessions in the Mathcad environment.The choice of the Mathcad package for the first-year students is because it may be used by anyone who knows basic school mathematics and informatics.In the Mathcad environment, a record of mathematical expressions is carried out directly on the screen according to conventional rules, and a text can be entered directly from the keyboard or by using special panels.The graphical editor of the package has an easy-to-use user interface, and its programming tools have a simple structure.One of the big advantages of the package is that during the session it generates display messages on errors and their character.
At the same time, Mathcad is a powerful, versatile environment that has great mathematical capabilities.The package is designed for both solving problems analytically and carrying out engineering calculations.A set of package built-in functions allows solving a wide range of numerical analysis problems.
The cycle of laboratory works in the Mathcad package is currently designed for 72 hours and includes 24 works that illustrate its possibilities to carry out numerical calculations and analytical transformations.The second part of the classroom works deals with the numerical methods of Computational Mathematics problems related to the current lecture materiel.These works include approximate solutions of algebraic and transcendental equations, approximate calculations of integrals, approximate solutions of differential equations and their systems, interpolation, and other tasks.Many works of this part may be performed with the use of built-in functions of the package.Figure 3 shows an example of polynomial roots finding using the built-in function polyroots (X).
When performing laboratory works related to numerical methods, one can use not only the built-in functions of the package, but also programming elements.Visualization of programming tools in the Mathcad environment by means of special panels and the block structure of programs simplify this work and make it accessible even for students who are not familiar with programming technique.The use of Mathcad (like the use of other application packages) for problems of numerical analysis allows one to use several numerical methods for solving the same task and to make a comparative analysis of the results obtained.When working in the package environment, one can specify many interpolation nodes or iterations.Moreover, the use of program packages in numerical analysis eliminates the necessity of preliminary calculations of the number of iterations needed for specified precision, because one may perform calculations with different number of iterations or interpolation nodes and then compare the results obtained.Then the created program-function is used to find the roots of the equation by the dichotomy method (Fig. 5).These results are compared with the results obtained by solving this equation using the root function built into the package.Thus, the following Mathcad features were required to solve the problem: plotting, embedded functions and programming user functions in the package environment.
1.1.2Using mathematical packages in practical classes.
To optimize the process of mathematical training of specialists, it is advisable to use application software packages in the computer and mathematical statistics with the topics "calculating probabilities using Bernoulli and Poisson formulas", "discrete random variable", "discrete random vector" and others.Additional training materials have been developed for practical classes in the computer classroom.They include a set of thoroughly analyzed examples and tasks for self-solution in Mathcad and Mathematica environments.All materials are available to students via the Internet.Fig. 6.Calculating numerical characteristics of a discrete random vector.
It would be advisable to include topics related to complex, time-consuming calculations in practical classes in a computer classroom, for example, topics such as "Discrete random vector".Figure 6 shows an example of solving a problem on this topic, where the tools of the Mathcad package are used to obtain the limiting laws of the distribution of components of a two-dimensional random vector and calculate their numerical characteristics using userdefined functions: mathematical expectation and variance.
The skills of operating application program packages will be very useful for independent homework on making routine calculations tasks developed at the Department of Mathematics.In their home works, students should present solutions of their tasks performed "manually" using the methods discussed in the lecture course.Mathematical program packages permit students to verify the obtained solutions, plot, if necessary, 2D or 3D graphs to identify the areas of integration, and much more.
1.1.3Teaching materials for student term projects using application program packages.
It would be advisable to recommend students to use application software packages in their course projects.This would save them from having to perform complex calculations on a calculator.In this case, the instructions for course projects should include not only the tasks and requirements for their implementation, but also the necessary information on how to use various mathematical packages for this task, a list of functions built into the package that could be useful for solving the problem, and examples of numerical solutions.The Department of Mathematics has developed methodological materials for students' course projects, provided for in the curriculum.These projects include topics such as Probability Theory, Mathematical Statistics, and Discrete Mathematics.Figure 7 shows a fragment of a textbook for the course project "Initial processing of experimental data.Verification of the statistical hypothesis about the type of general distribution".In this part of the work, the elements of the interval series are obtained for a given random sample, a histogram is constructed using the built-in package function.Then, using the built-in functions, statistical estimates of the distribution parameters are calculated.Based on the shape of the histogram, a hypothesis is put forward about the normal distribution of the general population.The densities of the hypothetical distribution are calculated using the built-in dnorm function.A theoretical curve and a histogram constructed according to the same template can be compared and the plausibility of the hypothesis put forward can be verified [12].Then the proposed hypothesis is accepted or rejected based on the statistical criterion of Pearson or Kolmogorov.( ) ( ) ( ) ( ) Visualization of the obtained analytical solution.

Fig. 10. Graph gallery
Visualization of the solution can be obtained using the tools of the Mathematica system.To do this, the sole function is described, given by formula (8), in which the series is limited to the 10 terms.The graph of this function is published using the built-in Plot function, at time points 0; 0,4; 1,2; 1,4; and 2 in the form of a set of corresponding string profiles (fig.9) or in the form of a "gallery of graphs" (fig.10).
5. Discussion of the results obtained.From the constructed graphs of the solution at various points in time, the physical process described in the problem becomes clear.It is very useful to show different ways of solving the same problem.For example, the problem presented above can be solved directly with the tools of the Mathematica package, using the built-in DSolvevalue or NDSolveValue functions (Fig. 11).At, the teacher should familiarize students with the tools of the package and explain to them all its features.For example, the fact that the built-in function does not always cope with the solution of the problem, and sometimes it is impossible to do without an analytical solution.
They need to build a training course using computer mathematics technologies also appears where analytical problem solving is associated with large, cumbersome calculations or is simply impossible.Such tasks in modern practical activity appear when studying the work of economic systems based on random processes [16].To predict costs or profits in an economic system, it is necessary to obtain a probability distribution for all its states, obtaining an exact solution to the system of Kolmogorov equations, which is possible for large-order systems only in the Mathematica package. 2   through using the built-in functions of the package is shown in Fig. 12.The Mathematica package reduces the matrix of the system to a quasi-diagonal form and gives an exact solution to the problem via MatrixExp.
For a high-order system, the problem will not become more difficult.No matter how complicated and cumbersome its solution looks, it is possible to calculate the numerical characteristics of a random process through it and predict the profit or costs of the economic system for any period of time, as described in [16].

Conclusion
The use of mathematical application program packages in the educational process brings the teaching of mathematical subjects to a qualitatively higher level.Thus, studying the Mathematics gives not only a systematic knowledge of its main branches, but also provides a fund of knowledge and skills necessary for the use of these application program products in further education.
Also, the educational process with the use of application program packages helps to raise the quality of the department's methodological work.Without spending much time, instructors can make variants of tasks for individual home works and term projects with known correct answers.Besides, 0well-elaborated methodological aids on making laboratory works and term projects available to students online allow to perform the tutor support of the educational process.
Students in various works on special disciplines and in their independent engineering activity may further use the cycle of independent laboratory works with the use of mathematical packages.The knowledge and skills obtained will allow them to select an optimal numerical method to solve the task's set, evaluate the accuracy of the obtained numerical solution, and use the capabilities of modern computer technology and application program packages for numerical solution of many mathematical and engineering tasks.

Fig. 4 .
Fig. 4. Separation of the roots of the equation.Below is an example of finding the roots of a transcendental equation ( ) 2 / 5 2 1 0 x e x − − = .First, a graphical separation of the roots is performed, that is, intervals are found, each of which has only one root of the equation (Fig. 4).

Fig. 5 .
Fig. 5. Solution of the equation using the dichotomy method.

Fig. 8 .
Fig. 8. Initial string profile Method selection and analytical solution.

Fig. 11 .
Fig. 11.Solving the task using the built-in package function.

Fig. 12 .
Fig. 12. Solving the system using the Mathematica package.Getting the exact solution of the system    + = + = y x y y x x 3 4