Главная » Все файлы » Просмотр файлов из архивов » PDF-файлы » Thompson - Computing for Scientists and Engineers

Thompson - Computing for Scientists and Engineers, страница 4

PDF-файл Thompson - Computing for Scientists and Engineers, страница 4 Численные методы (775): Книга - 6 семестрThompson - Computing for Scientists and Engineers: Численные методы - PDF, страница 4 (775) - СтудИзба2013-09-15СтудИзба

Описание файла

PDF-файл из архива "Thompson - Computing for Scientists and Engineers", который расположен в категории "". Всё это находится в предмете "численные методы" из 6 семестр, которые можно найти в файловом архиве . Не смотря на прямую связь этого архива с , его также можно найти и в других разделах. Архив можно найти в разделе "книги и методические указания", в предмете "численные методы и алгоритмы" в общих файлах.

Просмотр PDF-файла онлайн

Текст 4 страницы из PDF

Therefore,programs that you write in C for these machines will probably interface easily withsuch applications programs. This is a major reason why C is used extensively in engineering applications.A fourth reason for using C is that its developers have tried to make it portableacross different computers. Lack of portability has long been a problem with Fortran.

Interconnectivity between computers, plus the upward mobility of programsdeveloped on personal computers and workstations to larger machines and supercomputers, demand program portability. Since very few large computer systemshave extensive support for Pascal, C is the current language of choice for portability.One drawback of C lies with input and output. Some of the difficulty arisesfrom the extensive use of pointers in C, and some inconvenience arises from the limited flexibility of the input and output functions in the language. For these reasons, Ihave written the input and output parts of the sample programs as simply as practicable, without any attempt to produce elegant formats. Since you probably want tomodify the programs to send the output to a file for processing by a graphics program, as discussed in Section 1.3, for this reason also such elegance is not worthwhile in the sample programs.Complex numbers are not part of the C language, although they are used extensively in numerical applications, as discussed in Chapter 2.

Our calculations thatuse complex variables convert the complex numbers to pairs of real numbers, thenwork with these. Extensive practice with programming using complex numbers inthis way is given in Sections 2.1 and 2.6. In Numerical Recipes in C, Press et al.also discuss (Chapter 1 and Appendix E) handling complex numbers in C.Learning to program in CThis book does not claim to be a guide to learning the C programming language. Itwill, however, provide extensive on-the-job training for the programming of numerical applications in C.

If you wish to learn how to program in C, especially for thenumerically oriented applications emphasized herein, there are several suitable textbooks. Starting with books which do not assume that you have much familiaritywith progamming then moving upward, there are Eliason’s C, a Practical LearningGuide and Schildt’s Teach Yourself C, then the text by Darne11 and Margolis, C, a8INTRODUCTIONSoftware Engineering Approach.

Many of C’s more subtle and confusing aspectsare described by Koenig in C Traps and Pitfalls.If you are familiar with other programming languages and wish to use the C programs in this book, there are several texts that should be of considerable help to you.For general use there is the book by Gehani, which emphasizes the differences between C and other procedural programming languages. Gehani also discusses theadvanced aspects of C as implemented on UNIX systems.

A second cross-culturalbook that will help you with the language barrier is Kerrigan’s From Fortran to C,which has extensive discussions and examples of how to learn C and to reprogramfrom Fortran. The book by Müldner and Steele, C as a Second Language, and thatby Shammas, Introducing C to Pascal Programmers, are especially suitable for thosewho are familiar with Pascal but wish to learn to program effectively in C.Finally, for detailed references on the C language there are C: A Reference Manual by Harbison and Steele, and The Standard C Library by Plauger.

You shouldalso consult the programming manuals for C provided with the implementation of Cfor your computing environment, and the manuals that explain the connection between C and your computer’s operating system.The references on learning to program in the C language are listed together in thereference section at the end of this chapter.

The appendix provides examples oftranslating between C, Fortran, and Pascal that are drawn from the C programs inthe first chapters.Translating to Fortran or Pascal from CBy choosing to present the example programs and the project programs in C language, I know that I will have made a few friends but I may have alienated others.Especially for the latter, I have tried to decrease their animosity by avoiding use ofsome of the useful constructions in C that are sometimes not available or are awkward to implement in other numerically oriented procedural languages. This shouldmake the programs easier to translate on-the-fly into Fortran or Pascal. Among mymain concessions are the following.In arrays the [0] element is usually not used by the program, so that the used elements of the array range from [1] upward.

The only confusion this may cause whenprogramming is that the array size must be declared one larger than the maximum element that will ever be used. For example, if you want to be able to use elements1...100, then the maximum array size (which is always defined as MAX) should be101. This labeling starting with [1] usually also makes the correspondence betweenthe mathematics and the coding simpler, because most of the summation and iteration indices in formulas (k or j) begin with unity: any zeroth-index value in asummation or iteration has usually to be treated specially. I use the [0] element in anarray only if this tightens the connections between the mathematical analysis, the algorithm, and the code.In summations and indexing, the C construction of ++ to denote incrementingby one, and similarly - - for decrementing, is not used except in for loops.

Although general avoidance of ++ and - - is less efficient, it is less confusing whentranslating to Fortran or Pascal, which do not allow such useful constructions.1.2 COMPUTING, PROGRAMMING, CODING9The for loop in C is such a practical and convenient programming device that Iuse it without concession to Fortran programmers, who are often confined to themuch clumsier DO loop. However, I use the for loop in a consistent style to whichyou can readily adapt.I have avoided go to statements, so there are no statement labels in the programs. Consequently, you will have to go elsewhere if your favorite computingrecipes include spaghetti. (The come from statement, which might rescue many aprogrammer from distress, is also scrupulously avoided.) These omissions do notmake C programs difficult to write or to use.There are a few operators in C, especially the logical operators, that look quitedifferent and may be confusing to Fortran and Pascal programmers.

I explain theseoperators where they appear in programs, especially in the early chapters. They arelisted with their Fortran and Pascal counterparts at the end of the appendix on translating between C, Fortran, and Pascal.In C the exit function terminates execution when it is called. (Technically, itterminates the calling process. All open output streams are flushed, all open files areclosed, and all temporary files are removed.) There is a conventional distinction,which we follow, between exit (0) and exit (1) . The first is for successful termination and graceful exit, while the second is to signal an abnormal situation. Insome computing environments the process that refers to the terminating programmay be able to make use of this distinction.Within the text, the font and style used to refer to names of programs, functions, and variables is 10-point Monaco (since all programming involves an element of gambling).

All the programs and functions are listed in the index to computer programs, which is discussed below.The computing projects and the programsSeveral of the exercises and projects, as described in Section 1.1, require that youmodify programs that are in the text. By this means you will practice what is socommon in scientific and engineering computing, namely the assembling of testedand documented stand-alone function modules to make a more powerful programtailored for your use. One advantage of this method is that, provided you are carefulhow you make the modifications, you will usually be able to check the integrity ofthe program module by comparison with the stand-alone version.The sample programs, both in the text and in the projects, are written for clarityand efficiency of writing effort.

In particular, when there are choices between algorithms, as in the numerical solution of differential equations, the different algorithmsare usually coded in-line so that it is easy for you to compare them. Therefore, ifyou wish to transform one of the chosen sections of in-line code into a function youwill need to be careful, especially in the type declarations of variables used.I have not attempted to make the sample programs efficient in terms of executionspeed or use of memory. If you want to use a particular computing technique forproduction work, after you have understood an algorithm by exploring with the pro-10INTRODUCTIONgrams provided, you should use a program package specially developed for the purpose and for the computer resources that you have available. At an intermediatelevel of efficiency of your effort and computer time are the programs available (in C,Fortran, and Pascal) as part of the Numerical Recipes books of Press et al.My view of the connections among materials in this book, the C language, theNumerical Recipes books, systems such as Mathematica, and their uses in scientificapplications is summarized in Figure 1.3.FIGURE 1.3 Connections among topics in this book, C language, the Numerical Recipesbooks, the Mathematica system, and scientific applications.In Figure 1.3 the lines are connectors, not arrows.

They indicate the strongesttwo-way connections between the topics and books (names written in italics). Somesignificant links have been omitted, mostly for topological reasons. For example,many of the scientific applications examples in this book do not require C programsor use of the Mathematica system. Also, much of the latter is programmed in C, andit can convert its symbolic results into C (or Fortran) source code, as described inWolfram’s book on Mathematica.Caveat emptor about the programsThe sample programs included in this book have been written as simply as practicalin order that they could readily be understood by the human reader and by the compiler.

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
5209
Авторов
на СтудИзбе
431
Средний доход
с одного платного файла
Обучение Подробнее