IT training extension of mathematica system functionality aladjev 2015 06 05

390 37 0
IT training extension of mathematica system functionality aladjev 2015 06 05

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Victor Aladjev, Vjacheslav Vaganov Extension of Mathematica system functionality Tallinn – 2015 Extension of Mathematica system functionality: Victor Aladjev, Vjacheslav Vaganov.– Tallinn: TRG Press, 563 p., 2015 Systems of computer mathematics find more and more broad application in a number of natural, economical and social fields These systems are rather important tools for scientists, teachers, researchers and engineers, very well combining symbolical methods with advanced computing methods One of leaders among means of this class undoubtedly is theMathematica system The book focuses on one important aspect–modular programming supported byMathematica The given aspect is of particular importance not only for appendices but also above all it is quite important in the creation of the user means that expand the most frequently used standard means of the system and/or eliminate its shortcomings, or complement the new facilities Software tools presented in the book contain a number of rather useful and effective methods ofprocedural andfunctional programming inMathematica system that extend the system software and allow sometimes much more efficiently and easily to program the objects for various purposes first of all wearing system character The above software tools rather essentially dilate theMathematica functionality and can be useful enough for programming of many applications above all of system character Furthermore, the book is provided with freeware packageAVZ_Package containing more than680 procedures, functions, global variables and other program objects The present book is oriented on a wide enough range of users of systems of the computer mathematics, teachers and students of universities at courses of computer science, mathematics and other naturalscience disciplines In the course of preparation of the present book the license releases8ữ 10 of theMathematica system provided byWolfram Research Inc have been used â Victor Aladjev, Vjacheslav Vaganov All rights reserved Printed by CreateSpace, An Amazon.com Company Contents Preface 5 Chapter 1 Additional means in interactive mode of theMathematica 13 Chapter 2 Additional tools of processing of expressions in the Mathematica software 26 Chapter 3 Additional means of processing of symbols and string structures in theMathematica system 58 Chapter 4 Additional means of processing of sequences and lists in the Mathematica software 81 Chapter 5 The additional means expanding the standardMathematica functions, or its software as a whole 101 5.1 The control branching structures and cyclic structures in the Mathematica system 123 5.2 The cyclic control structures of theMathematica system 127 Chapter 6 Problems of procedural programming in theMathematica software 130 6.1 Definition of procedures in theMathematica software 130 6.2 Definition of the user functions and pure functions in software of theMathematica system 146 6.3 Means of testing of procedures and functions in theMathematica software 154 6.4 Headings of procedures and functions in theMathematica system 182 6.5 Formal arguments of procedures and functions; the means of processing them in theMathematica software 207 6.6 Local variables of modules and blocks; the means of manipulation by them in theMathematica software 235 6.7 Global variables of modules and blocks; the means of manipulation by them in theMathematica software 259 6.8 Attributes, options and values by default for the arguments of the user blocks, functions and modules; additional means of processing of them in theMathematica system 275 6.9 Some additional facilities for operating with blocks, functions and modules in theMathematica software 292 Chapter 7 Means of input–output of theMathematica 354 7.1 Means of theMathematica for work with internal files 354 7.2 Means of theMathematica system for work with external files 369 7.3 Means of theMathematica system for processing of attributes of directories and datafiles 385 7.4 Additional means of processing of datafiles and directories 396 7.5 Certain special means of processing of datafiles and directories 420 Chapter 8 The manipulations organization with the user packages in theMathematica software 431 8.1 Concept of the context, and its use in the software of the Mathematica system 432 8.1.1 Interconnection of contexts and packages in the software of theMathematica system 437 8.2 Definition of the user packages, and their usage in the Mathematica software 440 8.3 Additional means of operating with packages in theMathematica 473 8.4 The organization of the user software in theMathematica system 534 8.5 A package for theMathematica system 550 References 553 Monographs, textbooks and books on computer science, theory of general statistics, cellular automata theory and computer mathematics systems, prepared and published by members of the Baltic Branch during1995 – 2015 558 About the Authors 563 Mathematica 2, 5 ÷ 10 – trademarks of Wolfram Research Inc Preface Systems of computer mathematics (SCM) find more and more wide application in a number of natural, economical and social sciences such as:informatics, chemistry, mathematics, physics, technologies, education, economics, sociology, etc Such systems asMathematica, Maple, REDUCE, MuPAD, Derive, Magma, Axiom, Maxima, GAP, MathPiper and others are more and more demanded for learning of the mathematically oriented disciplines, in various scientific researches and technologies These systems are the main tools for teachers, scientists, researchers, and engineers Researches on the basis of technology SCM, as a rule, well combine algebraic methods with advanced computing methods In this sense ofSCM – interdisciplinary area between informatics and mathematics in which researches are concentrated on development of algorithms for algebraical(symbolical) and numerical calculations and data processing, and on creation of programming languages along with program environment for realization of this kind of algorithms and tasks of different purpose which are based on them Solution of applied user problems in one or the other field of appendices is supported bypackages of applied programs (PAPor simply packages) of special, highly specialized or general purpose Classification and characteristic of such class of software can be found in our previous books [3–5] Naturally, the qualified user well owning one of effective programming languages(for example, Basic, C, Fortran, PL/1, Pascal, Lisp, Prolog, etc.) in a number of cases for the solution of own tasks can independently write and debug a separate program or a complex of programs allowing to realize algorithm of its tasks on a personal computer In some cases such approach can be more effective, than use for these purposes of ready software since the software developer at the same time well owns specifics of the solved task and conditions of its operation However, such approach demands as a rule of serious costs and at present abundance of various type and purpose of means for a personal computer becomes considerably inexpedient At the same time, developed PAP are supplied with own builtin programming language of one or other level of complexity allowing to program the whole tasks or their separate fragments which may be in the environment of a package are inefficiently, inexpedient, and in some cases and is impossible to realize by the standard means of a package This book is devoted to the class of software called by systems of computer mathematics which, first of all, are intended for the solution of problems of mathematical character, and, first of all, to leaders in this class to systems Mathematica andMaple Moreover, only the indirect attention concerning comparison of systems on certain separate moments is paid to the second system whereas quite developed their comparative analysis can be found in our books [28-30] At that, much attention was paid both on experience with described means, and features of their usage, and also recommendations for the user following from them As far as possible, the most effectivetechnique of application of these means for the solution of those or other applied user tasks have been offered Moreover, in book [33] we presented an excursus in history of computer algebra systems that represents a certain interest for the user of this class of software Rather detailed characteristic of this series of books can be found, in particular, in [30-33] and in the present book isn’t considered Our operating experience withsystems of computer algebra, first of all,Mathematica andMaple allowed not only to carry out a comparative analysis of these means, to reveal deficiencies inherent to them, and also to create a number of the means expanding their functionality and eliminating their some defects All these questions including questions ofterminological character with various extent of detailing have been considered in a series of our books and papers [1-48] The Mathematica system along with the above–mentionedMaple system is one of the most known and popularSCM, it contains a rather large number of functions for providing as symbolical transformations, and for numerical calculations TheMathematica system for today is multipurpose means that includes a large number of opportunities for the solution of quite wide range of problems Naturally, for these means can`t be given a rather full analysis within the framework of the given book Furthermore, the target of the book consists in other– in the book the attention is focused only on one aspect of system– opportunities of her program environment for solution of special problems of mass and system character This aspect has the special importance not only for solution of applied tasks but above all it is quite important at creation of the software expanding often used system means and/or eliminating their defects, or supplementing the system with new means In this context possibilities of built–in language of the system on creation of such kind of procedures or functions are of special interest So, programming in the system is a multifaceted subject and in it we focus attention only on questions of realization of procedures/functions that represent main program objects both for the most often used means of the user, and for the means expanding and improving standard system means in the system software, i.e realized by means of the built–in language of the system(Mathlanguage) In this context it is also possible to estimate in quite full measure theMathematica system software, without regarding to some subjective moments, first of all, the user preferences and habits Naturally, these moments play a rather essential part for the user which has a certain experience of work with program languages of procedural type whereas for a beginner they stand not so sharply because of lack of such experience So, considering orientation of the given book, for conscious acquaintance with its contents the knowledge ofMathlanguage at the level above the initial is supposed, for example, within the works [29-33,51,52,55,57,60,62,64,66,71] Since the10th versionMath–language is called as Wolfram Language what, in our opinion, is result of certain painful ambitions similar to those that are associated with book”A New Kind of Science” along with a fair share of self– advertisement of allegedly new means The given book affects a rather extensive material onMathematica software in the context of its opportunities inprocedural andfunctional programming Meanwhile, main purpose of this book laid aside the questions which are of interest, first of all, to readers who are in own activity at the first stages of an mastering of theMathematica system For beginners it is recommended to address oneself to the corresponding editions whose list is rather extensive, above all, the English-language TheMathematica system is considered and in Russian–language literature, however English–language editions, in our opinion, are represented to us more preferable In general, it is possible to familiarize oneself with literature on the websitewww.wolfram.com/books, quite useful sources can be found in the represented references, including a rather useful references in theInternet Thus, the given book represents a certain set of the selected system problems whose purpose not only to expand or make more effective theMathematica system, but also to give certain help to those users of theMathematica who would like to move from the user’s level to a level of the programmer or to those who when usingMathematica already faced some its restrictions and want to improve its program environment At that, the skilledMathematica programmers probably will also be able to find for themselves in our book a rather useful information and of applied character, and to reflection Therefore illumination only of some questions essence without their rather detailed discussion, certain nuances and consideration of adjacent questions that are often interesting and important per se often takes place Moreover, the system means presented in the book can be used as rather useful means at developing own applications in the environment ofMathematica In our opinion, an analysis of the source codes of the means presented in this book which use both effective, and nonstandard methods of programming along with quite certain practical interest will allow to master the environment of Mathematica system more deeply For convenience of their use in the given quality the reader has possibility of free download ofAVZ_Package package forMathematica system of versions8÷10 which contains these means [48] The means considered throughout the present book answer fully the main goal of the offered book which can be characterized by the following2 main directions, namely: (1) representation of a number of useful enough means of system character that expand and supplement standard means of theMathematica system; (2) illustration on their example of receptions and methods, enough useful inprocedural andfunctional programming, along with a number of essential enough features of this paradigm of programming in the conditions of the program environment of theMathematica system Here is quite appropriate to note a quite natural mechanism of formation of own software means of the user working in some program environment In course of programming of one or other means, or the whole project a certain situation is quite real when is rather expedient to program some additional tools that are absent among standard means, either they are more effective, or they are more convenient than standard means In many important cases the applicability of these means can have mass enough character, allowing to form program toolkit of quite wide range of applicability Exactly in many respects thanks to thedescribed mechanism we have created quite famous libraryUserLib forMaple along with packageAVZ_Package forMathematica which contain more than850 and680 means respectively [47,48] All above-mentioned means are supplied withFreeWare license and have open program code Such approach to programming of many projects both inMathematica, and inMaple also substantially promoted emergence of a number of system means from above–mentioned library and package, when development of software for simplification of its realization revealed expediency of definition of the new accompanying tools of system character that are rather frequently used both in applied and in system programming So, openness of theAVZ_Package package code allows both to modify the means containing in it, and to program on their basis own means, or to use their components in various appendices In our opinion, tasks and means of their realization inMathematica which are presented in the above package can be rather useful at deeper mastering of system and in a number of cases will allow to simplify rather significantly programming of appendices in it, first of all, the system problems At that, the methodological considerations represented in our previous books [29-33] fully remain in force and relative to the present book Means ofAVZ_Package package have different complexity of organization and used algorithms; in certain cases, they use effective and nonstandard receptions of programming inMathematica The given means can be used as individually(for the decision of various problems or for creation on their basis of new means), and in structure ofAVZ_Package package extending standard tools of theMathematica, eliminating a number of its defects and mistakes, raising its compatibility relatively to its releases and raising effectiveness of programming of problems inMathematica A tool represented in the book is supplied with description and explanations, contains the source code and the more typical examples of its application As required, a description has supplied by necessary considerations, concerning peculiarities of program execution in theMathematica environment The given book considers certain principal questions ofprocedure–functional programming inMathematica, not only for the decision of various applied problems, but, first of all, for creation of the software expanding frequently used facilities of the system and/or eliminating their defects or expanding the system with new facilities The software presented in this book contains a series of useful and effective receptions of programming inMathematica system, and extends its software which enables more simply and effectively to programme in the systemMathematica the problems of various purpose The represented monograph, is mostly for people who want the more deep understanding in the Mathematica programming, and particularly those Mathematica users who would like to make a transition from the user to a programmer, or perhaps those who already have certain limited experience inMathematica programming but want to improve their possibilities in the system Whereas the expertMathematica programmers will also probably find an useful enough information for yourself At that, it should be noted that the source codes of means given in this book contain calls of non–standard tools that didn’t find reflection in the present book in a number of cases, but are presented in our package[48] Therefore, their detailed analysis requires acquaintance with these tools, at least, at the level of usages on them Meanwhile, the main algorithm of many means of the presented book is rather well looked through and without acquaintance with similar means while real use of these means perhaps only after loading of this package into the current session Along with the illustrative purposes the means represented in this monograph quite can be used and as enough useful means extending the programMathematica environment that rather significantly facilitate programming of a wide range of the problems first of all having the system character Our experience of conducting of the master classes of various level in systems andMathematica, andMaple confirms expediency of application in common with standard means of both systems and some user tools created in the course of programming of appendices Tools represented in the book increase the range and efficiency of usage of Mathematica on Windows platform owing to the innovations in three basic directions, namely:(1)elimination of a series of basic defects and shortcomings, (2)extending of capabilities of a series of standard tools, and(3)replenishment of the system by new means which increase capabilities of its program environment, including the means which improve the level of compatibility of releases7 – 10 At last, with organization of the user software and programming of large-scale systems inMathematica software along with our standpoint on a question: Mathematica orMaple? the interested reader can familiarize in [29–33] At last, a number of means represented in the above books is intended for a extension of standard means of the systemsMathematica andMaple along with elimination of their shortcomings and mistakes These means not only more accurately accent distinctions of both systems, but also their problems of common character And in this relation they allow to look from different points of view on these or other both advantages, and shortcomings of both systems In the present book we present a number of means of similar type concerning theMathematica system At that, it should be noted that a mass optimization of procedures have not been performed, procedures in many cases have been written, as they say on’sheet‘; on the other hand, numerous procedures have been optimized using both the standard means and newly created tools of system character In this context here there is a magnificent experimental field for increasing of professionalism of the user at operating with theMathematica software Inclusion of source codes of the procedures and functions presented in this book with their short characteristic directly in the book text allows to work with them without computer, considering a habit of considerable number of the users of the senior generation to operate with program listings before exit to the computer what in a series of cases promoted better programming in due time at programming in batch mode In our opinion, skill to operate with program listings is a rather important component of the programmer culture, allowing better to feel the used program environment In a certain measure it is similar to possession of the musician by the sheet music Moreover, many listings of the represented means have a rather small size, allowing to analyze them outside of theMathematica environment in the assumption that the reader is sufficiently familiar with its software Now, at mass existence of personal computers of various type the mentioned visual analysis of the program listings was replaced with the mode of interactive programming, however it’s not the same, and in the first case the process of programming seems to us more better and efficient Meanwhile, even tools with small source code often are useful enough at programming of various applications, in particular, of system character Whereas others demand for the understanding of serious enough elaboration, including acquaintance with our packageAVZ_Package [48] As shows our experience, the programming in the above mode slightly more slowly, than directly on the computer, however it allows to concentrate our better on an object of programming and it is better to think over a problem and a way of its decision, rather, than method of its decision in the so-called interactive mode Even in the presence of thepersonal computer (PC) we got used thebasic skeleton of a program to write on paper and only then to pass to debugging onto the personal computer in the interactive mode So, in our opinion, such approach allows to write programs more thoughtfully; at that, following the old habit to write optimal enough codes for their subsequent performance on quite limited computing resources of the computers20–30 years ago However, in many respects this is matter of habit, however you shouldn’t forget that the old isn’t always worse than new one and, getting new opportunities, we, often, lose the old skills important for work Here and in this case, having received very convenient means of communication, we, sometimes, lose sight of efficiency of a program code, creating it without especial difficulties in the interactive mode with the only purpose to receive the demanded result, often, ignoring quality Of course, there is no only best way of creation of еру programs Different technologies and paradigms are required for the programming of different problems and their levels of complexity So, in the elementary cases is quite enough of the knowing of elements of structural writing of programs While for creation of complex program projects is required not only to be fluent in a programming language in rather full volume, but also to have notion of the principles of elaboration and debugging of programs, opportunities of both standard and other libraries of one or the other software, etc As a rule, than the problem is more complex, the more time is required for mastering of the tools necessary for its decision In this context the software (procedures/functions/global variables) which is presented in the present book contain a number of rather useful and effective methods of programming in theMathematica environment and extends its program environment, they give opportunity more simply and effective to program different problems These means in the process of application of theAVZ_Package package are updated, taking into account both the new means, and the optimization of already existing means In many problems of different purpose the package AVZ_Package showed itself as a rather effective toolkit The package on the freeware conditions is attached to the present book [48] Chapter 1 Additional means in interactive mode of the Mathematicasystem Further we will distinguish two main operating modes with Mathematica – interactive andprogram Under the first mode step-by-step performance with aMathematica document, i.e from an inputIn[n] up to outputOut[n] will be understood while under theprogram mode the operating within ablock or amodule is understood In the present chapter some additional means rather useful at work withMathematica in interactive mode are considered In the course of operating ininteractive mode in many cases there is a need of use of earlier calculated expressions in the previousIn-paragraphs For this purpose the%koperator {%, %%, %% … %%(ktimes)} serves which defines return of the last, penultimate andkth previous result of calculations in the current session In addition, it should be noted that%–operators in systems Mathematica andMaple are conceptually various Though, having various real areas of applicability inMathematica andMaple, at the same time%– operators possess both the shortcomings, and essential advantages [2833] TheMathematica supports2 rather useful predetermined global variables: $Line–defines number of the lastInparagraph of the current session; $HistoryLength–defines number of the previous paragraphsInandOutkept in the current session Moreover, these variables allow redefinitions by simple assignment of new values For$HistoryLength variable value by default is theinfinity(∞); but using smaller installations for the variable, it is possible significantly to save the size ofRAM required forMathematica system In turn, global variable $Line1 unlike the standard global variable$Line determines total number ofOutparagraphs of the current session, including results of calculation of the user packages loaded into the session from files of formats {”cdf“, “nb”} In[500] := $Line1 := Block[{a = ””, c = “Out[“, k = 1}, For[k, k < Infinity, k++, a = ... Victor Aladjev, Vjacheslav Vaganov Extension of Mathematica system functionality Tallinn – 2015 Extension of Mathematica system functionality: Victor Aladjev, Vjacheslav Vaganov.–... Means of input–output of theMathematica 354 7.1 Means of theMathematica for work with internal files 354 7.2 Means of theMathematica system for work with external files 369 7.3 Means of theMathematica system for processing of attributes of directories and... Interconnection of contexts and packages in the software of theMathematica system 437 8.2 Definition of the user packages, and their usage in the Mathematica software 440 8.3 Additional means of operating with packages in theMathematica 473

Ngày đăng: 05/11/2019, 14:59

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan