Главная » Просмотр файлов » Thompson - Computing for Scientists and Engineers

Thompson - Computing for Scientists and Engineers (523188), страница 24

Файл №523188 Thompson - Computing for Scientists and Engineers (Thompson - Computing for Scientists and Engineers) 24 страницаThompson - Computing for Scientists and Engineers (523188) страница 242013-09-15СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 24)

nNow that we have explored subtractive cancellation with the practical examplesof variance calculations and of solving quadratic equations, we should be preparedto recognize the possibilities for subtractive-cancellation effects as a source of noisein many numerical computations. These effects can be especially troublesome in thenumerical approximation of derivatives (Sections 4.4, 4.5) and in the related topicof numerical solution of differential equations (Sections 7.4, 7.5, and 8.3 - 8.6).4.4HOW TO APPROXIMATE DERIVATIVESFor computing derivatives numerically it is important to find stable methods that areinsensitive to errors from subtractive cancellation.

The possibilities of such errorsare implicit in the definition of derivatives. For the first derivative of y at the pointx, y(l), one has the definition(4.23)From this definition we see that numerical evaluation of derivatives is inherently anunstable problem, as defined in Section 4.3. Our challenge is to find a method thatis insensitive to such instability.We introduce an abbreviated notation in which the ith derivative evaluated nsteps (each of equal size h) away from the point x is written as(4.24)If i = 0, then we are dealing with y itself, so the superscript is usually omitted. Inthe notation in (4.24) it is understood that both x and h are fixed during a given calculation.

The stepsize h is assumed to be positive, whereas the integer n may be ofeither sign. The function y is assumed to be well-behaved, in the sense that forwhatever order of derivative we wish to estimate numerically there exists a corresponding analytical derivative at that x value.The general formulas we derive are polynomial approximations, and they areoften derived from the viewpoint of fitting a polynomial through a given number ofpoints (N + 1, say), then finding an analytical expression for the polynomial derivatives. There is no direct way of estimating the error incurred in the various derivatives in such a viewpoint. On the other hand, if we consider that we are making aTaylor expansion of a function in the neighborhood of some point and that we are4.4HOW TO APPROXIMATE DERIVATIVES123truncating the expansion after N + 1 terms, then we have an N th-order polynomialapproximation.

Additionally, an estimate of the remainder term (3.7) serves to estimate the error incurred. Here we use the first neglected Taylor term as an estimateof the remainder, and therefore as an approximation to the error.For our working function, yw (x), discussed in Section 4.1, the analytical derivatives are obtained from the expansion coefficients in Table 4.1. If these derivativesare evaluated at x = 0, they are just the coefficients in the k = 0 column.

It is alsouseful to record the derivatives divided by the factorial of the same order, since weneed these for our improved polynomial approximation below. These modifiedderivatives are just the expansion coefficients wk with k = i from the first row ofTable 4.1, but we repeat them for convenience. Table 4.3 shows the coefficientsthat are needed.TABLE 4.3 Expansion coefficients for derivatives of the working function, evaluated at x = 0.Now that we have notation established, and a working function with its checkvalues well understood, we investigate two simple schemes for approximating derivatives numerically. We also discuss some programming aspects of the derivativefunctions (those starting with Der) in Program 4.1.Forward-differencederivativesThe most obvious estimate of the first derivative of y is just to consider the quantityin the brackets on the right-hand side of (4.23), with h small but finite.

Graphically,we use the slope of the line segment FF in Figure 4.4. The function shown is actually our working function (4.1) and we have chosen x = 0 and h = 0.1. Thuswe have the forward-difference derivative estimate, given by(4.25)Note that the estimate clearly depends upon the value of h, but we hope that this dependence is not too strong. We can check this out for the working function.124NUMERICAL DERIVATIVES AND INTEGRALSFIGURE 4.4 Schemes for estimating first derivatives are shown for the working function, (4.1)and Figures 4.1 and 4.2, near x = 0. The forward-difference derivative is taken along FF.

Thecentral-difference derivative is taken along CC.Exercise 4.11(a) Use the working function (4.2), a more convenient form than (4.1) for thispurpose, to calculate its forward-difference derivative defined in (4.25) at x = 0for the values of h in Table 4.4. If you have coded up and tested Program 4.2,Working Function, you can get the forward-difference derivative estimate asvariable yF from the function Der_1F.(b) Write down the first few terms of the Taylor expansion of any functiony (X + nh) in terms of the function y (x) and its derivatives at x in order to showthat the first additional term beyond the first derivative itself in the forward-difference derivative estimate (4.25) is y( 2 ) (x) h /2.(c) Show that this neglected term is a fair estimate of the error in the numericalderivatives in Table 4.4, especially for the smallest h value.

From Table 4.3 orthe program Working Function, the analytical derivative at x = 0 has thevalue -1. nTABLE 4.4 Forward-difference first derivatives for the working function, evaluated at x = 0.The exact first derivative has value -1.From Exercise 4.11 and from Figure 4.4 we can see why the forward-difference derivative estimate is inaccurate for the h values that we used. The second derivative is of the opposite sign to the first derivative, so its inclusion in the forward-4.4HOW TO APPROXIMATE DERIVATIVES125difference estimate makes the magnitude of the slope too small.

It is therefore appropriate to make an estimate for the first derivative that is less sensitive to the presence of second derivatives.Derivatives by central differencesIn choosing a numerical estimator of the first derivative in the preceding subsection,we could as well have used a backward difference. We would have run into similarproblems as for the forward difference.

So why not make a more balanced approach, using central differences, as follows:(4.26)This scheme is shown graphically in Figure 4.4 by the line segment CC. It isstraightforward to extend the method of analysis made for the forward-derivative estimate.Exercise 4.12(a) Use the working function (4.2) to calculate its central-difference derivativeestimate defined by (4.26) at x = 0 for the values of h in Table 4.5. If youhave Program 4.2 (Working Function) running, you can get the central-difference derivative estimate as variable yC from the function Der_1C.(b) Write down the first few terms of the Taylor expansion of a functiony (x + nh) in terms of the function y (x) and its derivatives at x. Thus showthat the first term beyond the first derivative itself in the central-difference derivative estimate (4.26) is y(3) (x) h2/6.(c) Show that this neglected term is a very good estimate of the error in the numerical derivatives in Table 4.5, especially for the smallest h value.(d) Use the program Working Function to show that if one wants accuracyof about 6 significant figures for the first derivative at x = 0, then the stepsizefor the forward-difference derivative must be about h = 10-6, whereas the sameaccuracy in the central-difference derivative requires a stepsize of only abouth = 10-4.

nTABLE 4.5 Central-difference first derivatives for the working function, evaluated at x = 0.The exact first derivative is -1.126NUMERICAL DERIVATIVES AND INTEGRALSFrom these examples, especially from a comparison of Tables 4.4 and 4.5, wesee that the central-difference derivative estimate should be used whenever feasible.It is less likely to run into problems from subtractive cancellation effects than is theforward-difference method because its stepsize can be significantly larger for thesame accuracy. Occasionally, only the forward-difference (or backward-difference)method can be used, as when the function is not defined for x values less than (orgreater than) the value at which the derivative is required.

This may occur in startingthe numerical solution of differential equations or at the endpoints of runs of datawhose slopes we are trying to estimate.In the remainder of this treatment of numerical derivatives we use only centraldifference estimates because of their superior accuracy.Numerical second derivativesThe numerical estimation of second derivatives can be based on the analytical definition(4.27)Immediately we see, from the preceding discussion of first derivatives, that the numerical estimation problems may be much more severe for second derivatives thanfor first derivatives, especially if we take differences of numerical first derivativesrather than doing as much of the calculation as possible by analytical methods.One possibility is suggested by looking at Figure 4.5.

Характеристики

Тип файла
PDF-файл
Размер
4,66 Mb
Тип материала
Учебное заведение
Неизвестно

Список файлов книги

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