c10-6 (Numerical Recipes in C)

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

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

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

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

Текст из PDF

420Chapter 10.Minimization or Maximization of FunctionsCITED REFERENCES AND FURTHER READING:Brent, R.P. 1973, Algorithms for Minimization without Derivatives (Englewood Cliffs, NJ: PrenticeHall), Chapter 7. [1]10.6 Conjugate Gradient Methods inMultidimensionsWe consider now the case where you are able to calculate, at a given N dimensional point P, not just the value of a function f(P) but also the gradient(vector of first partial derivatives) ∇f(P).A rough counting argument will show how advantageous it is to use the gradientinformation: Suppose that the function f is roughly approximated as a quadraticform, as above in equation (10.5.1),f(x) ≈ c − b · x +1x·A·x2(10.6.1)Then the number of unknown parameters in f is equal to the number of freeparameters in A and b, which is 12 N (N + 1), which we see to be of order N 2 .Changing any one of these parameters can move the location of the minimum.Therefore, we should not expect to be able to find the minimum until we havecollected an equivalent information content, of order N 2 numbers.In the direction set methods of §10.5, we collected the necessary information bymaking on the order of N 2 separate line minimizations, each requiring “a few” (butsometimes a big few!) function evaluations.

Now, each evaluation of the gradientwill bring us N new components of information. If we use them wisely, we shouldneed to make only of order N separate line minimizations. That is in fact the casefor the algorithms in this section and the next.A factor of N improvement in computational speed is not necessarily implied.As a rough estimate, we might imagine that the calculation of each component ofthe gradient takes about as long as evaluating the function itself.

In that case therewill be of order N 2 equivalent function evaluations both with and without gradientinformation. Even if the advantage is not of order N , however, it is neverthelessquite substantial: (i) Each calculated component of the gradient will typically savenot just one function evaluation, but a number of them, equivalent to, say, a wholeline minimization. (ii) There is often a high degree of redundancy in the formulasfor the various components of a function’s gradient; when this is so, especially whenthere is also redundancy with the calculation of the function, then the calculation ofthe gradient may cost significantly less than N function evaluations.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).Acton, F.S. 1970, Numerical Methods That Work; 1990, corrected edition (Washington: Mathematical Association of America), pp.

464–467. [2]Jacobs, D.A.H. (ed.) 1977, The State of the Art in Numerical Analysis (London: AcademicPress), pp. 259–262.10.6 Conjugate Gradient Methods in Multidimensions421(a)Figure 10.6.1. (a) Steepest descent method in a long, narrow “valley.” While more efficient than thestrategy of Figure 10.5.1, steepest descent is nonetheless an inefficient strategy, taking many steps toreach the valley floor. (b) Magnified view of one step: A step starts off in the local gradient direction,perpendicular to the contour lines, and traverses a straight line until a local minimum is reached, wherethe traverse is parallel to the local contour lines.A common beginner’s error is to assume that any reasonable way of incorporating gradient information should be about as good as any other.

This line of thoughtleads to the following not very good algorithm, the steepest descent method:Steepest Descent: Start at a point P0 . As many timesas needed, move from point Pi to the point Pi+1 byminimizing along the line from Pi in the direction ofthe local downhill gradient −∇f(Pi ).The problem with the steepest descent method (which, incidentally, goes backto Cauchy), is similar to the problem that was shown in Figure 10.5.1. The methodwill perform many small steps in going down a long, narrow valley, even if the valleyis a perfect quadratic form. You might have hoped that, say in two dimensions,your first step would take you to the valley floor, the second step directly downthe long axis; but remember that the new gradient at the minimum point of anyline minimization is perpendicular to the direction just traversed. Therefore, withthe steepest descent method, you must make a right angle turn, which does not, ingeneral, take you to the minimum.

(See Figure 10.6.1.)Just as in the discussion that led up to equation (10.5.5), we really want away of proceeding not down the new gradient, but rather in a direction that issomehow constructed to be conjugate to the old gradient, and, insofar as possible,to all previous directions traversed. Methods that accomplish this construction arecalled conjugate gradient methods.In §2.7 we discussed the conjugate gradient method as a technique for solvinglinear algebraic equations by minimizing a quadratic form. That formalism can alsobe applied to the problem of minimizing a function approximated by the quadraticSample 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).(b)422Chapter 10.Minimization or Maximization of Functionsform (10.6.1). Recall that, starting with an arbitrary initial vector g0 and lettingh0 = g0 , the conjugate gradient method constructs two sequences of vectors fromthe recurrencegi+1 = gi − λi A · hihi+1 = gi+1 + γi hii = 0, 1, 2, . .

.(10.6.2)gi · gj = 0hi · A · hj = 0gi · h j = 0j<i(10.6.3)The scalars λi and γi are given byλi =gi · gigi · h i=hi · A · hihi · A · hig·gγi = i+1 i+1gi · gi(10.6.4)(10.6.5)Equations (10.6.2)–(10.6.5) are simply equations (2.7.32)–(2.7.35) for a symmetricA in a new notation. (A self-contained derivation of these results in the context offunction minimization is given by Polak [1].)Now suppose that we knew the Hessian matrix A in equation (10.6.1).

Thenwe could use the construction (10.6.2) to find successively conjugate directions hialong which to line-minimize. After N such, we would efficiently have arrived atthe minimum of the quadratic form. But we don’t know A.Here is a remarkable theorem to save the day: Suppose we happen to havegi = −∇f(Pi ), for some point Pi , where f is of the form (10.6.1). Suppose that weproceed from Pi along the direction hi to the local minimum of f located at somepoint Pi+1 and then set gi+1 = −∇f(Pi+1 ). Then, this gi+1 is the same vectoras would have been constructed by equation (10.6.2).

(And we have constructedit without knowledge of A!)Proof: By equation (10.5.3), gi = −A · Pi + b, andgi+1 = −A · (Pi + λhi ) + b = gi − λA · hi(10.6.6)with λ chosen to take us to the line minimum. But at the line minimum hi · ∇f =−hi · gi+1 = 0. This latter condition is easily combined with (10.6.6) to solve forλ. The result is exactly the expression (10.6.4).

But with this value of λ, (10.6.6)is the same as (10.6.2), q.e.d.We have, then, the basis of an algorithm that requires neither knowledge of theHessian matrix A, nor even the storage necessary to store such a matrix. A sequenceof directions hi is constructed, using only line minimizations, evaluations of thegradient vector, and an auxiliary vector to store the latest in the sequence of g’s.The algorithm described so far is the original Fletcher-Reeves version of theconjugate gradient algorithm.

Later, Polak and Ribiere introduced one tiny, butsometimes significant, change. They proposed using the formγi =(gi+1 − gi ) · gi+1gi · gi(10.6.7)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).The vectors satisfy the orthogonality and conjugacy conditions10.6 Conjugate Gradient Methods in Multidimensions423#include <math.h>#include "nrutil.h"#define ITMAX 200#define EPS 1.0e-10Here ITMAX is the maximum allowed number of iterations, while EPS is a small number torectify the special case of converging to exactly zero function value.#define FREEALL free_vector(xi,1,n);free_vector(h,1,n);free_vector(g,1,n);void frprmn(float p[], int n, float ftol, int *iter, float *fret,float (*func)(float []), void (*dfunc)(float [], float []))Given a starting point p[1..n], Fletcher-Reeves-Polak-Ribiere minimization is performed on afunction func, using its gradient as calculated by a routine dfunc.

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