c1-0 (Numerical Recipes in C)

PDF-файл c1-0 (Numerical Recipes in C) Цифровая обработка сигналов (ЦОС) (15309): Книга - 8 семестрc1-0 (Numerical Recipes in C) - PDF (15309) - СтудИзба2017-12-27СтудИзба

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

Файл "c1-0" внутри архива находится в папке "Numerical Recipes in C". PDF-файл из архива "Numerical Recipes in C", который расположен в категории "". Всё это находится в предмете "цифровая обработка сигналов (цос)" из 8 семестр, которые можно найти в файловом архиве МГТУ им. Н.Э.Баумана. Не смотря на прямую связь этого архива с МГТУ им. Н.Э.Баумана, его также можно найти и в других разделах. Архив можно найти в разделе "книги и методические указания", в предмете "цифровая обработка сигналов" в общих файлах.

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

Текст из PDF

Preliminaries1.0 IntroductionThis book, like its predecessor edition, is supposed to teach you methods ofnumerical computing that are practical, efficient, and (insofar as possible) elegant.We presume throughout this book that you, the reader, have particular tasks that youwant to get done.

We view our job as educating you on how to proceed. Occasionallywe may try to reroute you briefly onto a particularly beautiful side road; but by andlarge, we will guide you along main highways that lead to practical destinations.Throughout this book, you will find us fearlessly editorializing, telling youwhat you should and shouldn’t do. This prescriptive tone results from a consciousdecision on our part, and we hope that you will not find it irritating. We do notclaim that our advice is infallible! Rather, we are reacting against a tendency, inthe textbook literature of computation, to discuss every possible method that hasever been invented, without ever offering a practical judgment on relative merit.

Wedo, therefore, offer you our practical judgments whenever we can. As you gainexperience, you will form your own opinion of how reliable our advice is.We presume that you are able to read computer programs in C, that beingthe language of this version of Numerical Recipes (Second Edition). The bookNumerical Recipes in FORTRAN (Second Edition) is separately available, if youprefer to program in that language.

Earlier editions of Numerical Recipes in Pascaland Numerical Recipes Routines and Examples in BASIC are also available; whilenot containing the additional material of the Second Edition versions in C andFORTRAN, these versions are perfectly serviceable if Pascal or BASIC is yourlanguage of choice.When we include programs in the text, they look like this:#include <math.h>#define RAD (3.14159265/180.0)void flmoon(int n, int nph, long *jd, float *frac)Our programs begin with an introductory comment summarizing their purpose and explainingtheir calling sequence.

This routine calculates the phases of the moon. Given an integer n anda code nph for the phase desired (nph = 0 for new moon, 1 for first quarter, 2 for full, 3 for lastquarter), the routine returns the Julian Day Number jd, and the fractional part of a day fracto be added to it, of the nth such phase since January, 1900. Greenwich Mean Time is assumed.{void nrerror(char error_text[]);int i;float am,as,c,t,t2,xtra;This is how we comment an individualline.c=n+nph/4.0;1Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited.

To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).Chapter 1.2Chapter 1.Preliminaries}If the syntax of the function definition above looks strange to you, then you areprobably used to the older Kernighan and Ritchie (“K&R”) syntax, rather than that ofthe newer ANSI C. In this edition, we adopt ANSI C as our standard. You might wantto look ahead to §1.2 where ANSI C function prototypes are discussed in more detail.Note our convention of handling all errors and exceptional cases with a statementlike nrerror("some error message");. The function nrerror() is part of asmall file of utility programs, nrutil.c, listed in Appendix B at the back of thebook.

This Appendix includes a number of other utilities that we will describe later inthis chapter. Function nrerror() prints the indicated error message to your stderrdevice (usually your terminal screen), and then invokes the function exit(), whichterminates execution. The function exit() is in every C library we know of; but ifyou find it missing, you can modify nrerror() so that it does anything else that willhalt execution. For example, you can have it pause for input from the keyboard, andthen manually interrupt execution.

In some applications, you will want to modifynrerror() to do more sophisticated error handling, for example to transfer controlsomewhere else, with an error flag or error code set.We will have more to say about the C programming language, its conventionsand style, in §1.1 and §1.2.Computational Environment and Program ValidationOur goal is that the programs in this book be as portable as possible, acrossdifferent platforms (models of computer), across different operating systems, andacross different C compilers. C was designed with this type of portability inmind.

Nevertheless, we have found that there is no substitute for actually checkingall programs on a variety of compilers, in the process uncovering differences inlibrary structure or contents, and even occasional differences in allowed syntax. Assurrogates for the large number of possible combinations, we have tested all theprograms in this book on the combinations of machines, operating systems, andcompilers shown on the accompanying table. More generally, the programs shouldrun without modification on any compiler that implements the ANSI C standard,as described for example in Harbison and Steele’s excellent book [1].

With smallmodifications, our programs should run on any compiler that implements the older,de facto K&R standard [2]. An example of the kind of trivial incompatibility towatch out for is that ANSI C requires the memory allocation functions malloc()Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.

Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).t=c/1236.85;t2=t*t;as=359.2242+29.105356*c;You aren’t really intended to understandam=306.0253+385.816918*c+0.010730*t2;this algorithm, but it does work!*jd=2415020+28L*n+7L*nph;xtra=0.75933+1.53058868*c+((1.178e-4)-(1.55e-7)*t)*t2;if (nph == 0 || nph == 2)xtra += (0.1734-3.93e-4*t)*sin(RAD*as)-0.4068*sin(RAD*am);else if (nph == 1 || nph == 3)xtra += (0.1721-4.0e-4*t)*sin(RAD*as)-0.6280*sin(RAD*am);else nrerror("nph is unknown in flmoon");This is how we will indicate errori=(int)(xtra >= 0.0 ? floor(xtra) : ceil(xtra-1.0));conditions.*jd += i;*frac=xtra-i;31.0 IntroductionTested Machines and CompilersHardwareO/S VersionCompiler VersionMS-DOS 5.0/Windows 3.1Microsoft C/C++ 7.0IBM PC compatible 486/33MS-DOS 5.0Borland C/C++ 2.0IBM RS/6000AIX 3.2IBM xlc 1.02DECstation 5000/25ULTRIX 4.2ACodeCenter (Saber) C 3.1.1DECsystem 5400ULTRIX 4.1GNU C Compiler 2.1Sun SPARCstation 2SunOS 4.1GNU C Compiler 1.40DECstation 5000/200ULTRIX 4.2DEC RISC C 2.1*Sun SPARCstation 2SunOS 4.1Sun cc 1.1**compiler version does not fully implement ANSI C; only K&R validatedand free() to be declared via the header stdlib.h; some older compilers requirethem to be declared with the header file malloc.h, while others regard them asinherent in the language and require no header file at all.In validating the programs, we have taken the program source code directlyfrom the machine-readable form of the book’s manuscript, to decrease the chanceof propagating typographical errors.

“Driver” or demonstration programs that weused as part of our validations are available separately as the Numerical RecipesExample Book (C), as well as in machine-readable form. If you plan to use morethan a few of the programs in this book, or if you plan to use programs in this bookon more than one different computer, then you may find it useful to obtain a copyof these demonstration programs.Of course we would be foolish to claim that there are no bugs in our programs,and we do not make such a claim. We have been very careful, and have benefittedfrom the experience of the many readers who have written to us.

If you find a newbug, please document it and tell us!Compatibility with the First EditionIf you are accustomed to the Numerical Recipes routines of the First Edition, restassured: almost all of them are still here, with the same names and functionalities,often with major improvements in the code itself. In addition, we hope that youwill soon become equally familiar with the added capabilities of the more than 100routines that are new to this edition.We have retired a small number of First Edition routines, those that we believeto be clearly dominated by better methods implemented in this edition.

A table,following, lists the retired routines and suggests replacements.First Edition users should also be aware that some routines common toboth editions have alterations in their calling interfaces, so are not directly “plugcompatible.” A fairly complete list is: chsone, chstwo, covsrt, dfpmin, laguer,lfit, memcof, mrqcof, mrqmin, pzextr, ran4, realft, rzextr, shoot, shootf.There may be others (depending in part on which printing of the First Edition is takenfor the comparison).

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