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

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

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

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

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

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

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

As is well known, the sum can be expressed in closedform as(3.2)As one way of deriving this very useful result, try the following exercise.Exercise 3.1Use the method of proof by induction to derive (3.2). That is, show that if theformula is assumed to be true for Gn, then it must be true for Gn+1. In order toget the recurrence started show that the result is evidently true for n = 1. nNote that the geometric series is sometimes written in forms other than (3.2).

Forexample, there may be a common multiplier for each term of the series, which justmultiplies the sum by this multiplier. For clarity and effect, in Figure 3.1 we haveassumed a common multiplier of r. Therefore, the series in this figure starts with rrather than with unity.The convergence properties of the geometric series (3.1) are quite straightforward.

If |r| < 1 the series converges as n, otherwise the series diverges.Note that if r = -1 the value of Gn alternates between 0 and +l, so there is no definite limit for large n.3.1 MOTIVATION FOR USING SERIES: TAYLOR’S THEOREM53FIGURE 3.1 Terms (shown by bars) and partial sums (crosses, omitting the leading term ofunity) for the geometric series. Only for multiplier r = 0.6 is the series convergent.Thus we have the geometric series convergence property(3.3)The convergence conditions are quite evident in Figure 3.1.

The series is thereforedeclared to be divergent, even though its value is always finite. A way around thisanomaly is discussed in Exercise 3.3 below.Programming geometric seriesIf you want practice in writing C programs involving series, you should code up andrun the program Geometric Series. This simple program has a function to sumthe geometric series directly, using (3.1), and it also computes the closed form(3.2).

The program does both of these calculations for a range of r values specifiedas input with a fixed value of n.54POWER SERIESPROGRAM 3.1 Geometric series by direct summing and by the closed form.#include#include<stdio.h><math.h>main (){/* Geometric Series */doublermin,dr,rmax,r,Sum,ClosedForm,error;int nterms,kmax;double GeoSum();printf("Gecmetric Series by Summing & Closed. Form\n");nterms; = 2;while ( nterms > 1 ){printf("\n\nInput rmin,dr,rmax,ntermS (nterms<2 to end):\n");scanf("%lf%lf%lf%i",&rmin,&dr,&rmax,&nterms);if ( nterms < 2 ){printf("\nEnd Geometric Series"); exit(O);}kmax = nterms-1;for ( r = rmin; r <= rmax; r = r+dr ){if ( fabs(r) >= 1 ){printf("\n!! Warning: Divergent series |r|=%g >= l",fabs(r));}Sum = GeoSum(r,kmax); /* direct sum of series *//* Formula for sum to nterms terms;uses r to the nterms power */ClosedForm = (l-pow(r,nterms))/(l-r);error = ClosedForm-Sum;printf("\n%g %g %g %g",r,ClosedForm,Sum,error);}double GeoSum(r,kmax)/* Direct sum of geometric series */double r;int kmax;{double term,sum;int k; term = 1; sum = 1; /* initialize terms & sum */3.1 MOTIVATION FOR USING SERIES: TAYLOR’S THEOREM55for ( k = 1; k <= kmax; k++ ){term = r*term;sum= sum+term;return sum;For the benefit of novice C programmers, we now summarize how the programGeometric Series is organized.

Program execution is controlled by the value ofn, which is denoted by nterms in the program. If there are fewer than two termsin the geometic series (3.1), then one has only the leading term of unity, which isscarcely an interesting series. Therefore, if the input value of nterms is less than 2this is used to signal program termination by a graceful exit (parameter zero).

If theseries is to be summed, then there are kmax = n - 1 terms to be added to the starting value of unity.For each value of the multiplier r in the input range, starting at rmin and going up to rmax by steps of dr, the program first checks whether r is beyond therange that leads to convergent series.

Although the series has a definite value forany finite n , it is instructive to see how a warning about nonconvergence can be output. Next, the function GeoSum (about which more is told in the next paragraph) isused to sum the series directly.The formula (3.2) is then coded in-line to produce the value ClosedForm,which requires the C library function pow to compute the power rn . Finally, anydifference between the direct summation and closed-form values is indicated by theirdifference, called error, which is printed following the r value and the two seriesvalues.The function GeoSum, coded after the main program of Geometric Series,involves a simple for loop over the powers of r. The succesive terms are obtained by the recurrence relation indicated, then they are added to the partial sum. Therewill be at least one iteration of the loop, since kmax is at least 1 because nmax is atleast 2.

The value of sum is retumed to the function GeoSum for assignment in themain program.Given this program description, and some nimble fingers, you should be readyto code, test, and use Geometric Series.Exercise 3.2(a) Code the program Geometric Series, listed as Program 3.1, modifyingthe input and output functions for your computing environment. Then test theprogram termination control (nterms < 2) and warning message for |r |1.56POWER SERIES(b) Run the program for a range of values of the multiplier r and the number ofterms nterms, to convince yourself that for a reasonable range of these parameters of the geometric series the direct-summation and closed-form methods giveclose numerical agreement.(c) Examine the convergence of the series for values of r that are close to (butless than) unity in magnitude.

For example, use r = -1 + 10-3, then find outhow large nterms must be in order to get agreement with the infinite seriesvalue of l/(1 - r) to about one part per million. It would be most convenientto modify the program to calculate this value and compare it with the directsummation value. nAlternating seriesAs you will have discovered by working part (c) of Exercise 3.2, series in whichsuccessive terms are of similar magnitude but opposite sign, so-called “alternatingseries,” are particularly troublesome numerically.

The geometric series is particularly convenient for investigating and understanding the problems that can arise withalternating series.For example, suppose that you had to sum the geometric series term by term forr = -1 + , where10-6 and is positive. By looking at the leftmost panel ofFigure 3.1 you would know that the series is convergent but it would clearly takemany terms before the remaining terms could be ignored. Numerically, by thatnumber of terms the roundoff error of your computer may have already overwhelmed the significant digits in your partial sum.Exercise 3.3(a) Suppose that, for a multiplier an amount larger than -1, we wanted to estimate how many terms, k, it takes before a geometric-series term has become 1/2of the first term.

By using (natural) logarithms and the approximation thatIn (1 - )for smallshow that kln(2)/0.7/ . Thus if one had= 10-6, more than one million terms would be needed for even reasonableconvergence.(b) Show that for r = -1 + as the multiplier in the geometric series the algebraic sum of the series is l/(2- ).

Thus show that as0 the sumtends to 1/2, which is just the mean value of the successive partial sums shownon the left side of Figure 3.1, namely 1 and 0.(c) Write down the geometric series for negative r term by term, but expressedin terms of |r|, so that the alternating signs are explicit in the sum. Next factorout the (1 - |r|), sum the remaining series in the geometric form, then divideaway the first factor. Show that the alternating series sums to l/( 1 + |r| ) ,which is l/2 at r = -1, just as in (b). Explain why the two methods agree, andexplain whether a limit process similar to that in (b) is necessary in the secondmethod.

n3.1 MOTIVATION FOR USING SERIES: TAYLOR’S THEOREM57Notice in part (b) of Exercise 3.3 that if r were allowed to approach the limit of-1 before the summation were attempted, then the result would be undefined, asFigure 3.1 shows. Part (b) shows that if the limit is taken after an expression forthe sum has been obtained, then the result is well defined. This peculiarity of thestrong dependence of the series values on the order of taking limits appears again inour investigation in Section 9.6 of the Wilbraham-Gibbs overshoot phenomenon forFourier series.From the example in Exercise 3.3 we see particularly troublesome aspects of alternating series.

Specialized techniques have been developed for alleviating some oftheir troubles, as described in the text by Taylor and Mann. An interesting result oncombining geometric series with multipliers of opposite sign is obtained in the following exercise.Exercise 3.4(a) Show analytically that for a convergent geometric series(3.4)(b) Make a sketch, similar to Figure 3.1, of the terms on the left and right sidesof this equation, Thereby explain the result (3.4). nAnother property of the geometric series that leads to a very interesting result isthe integral of the infinite series (3.1).

In order to produce the result in standardform, and assuming that |r|<1, replace r by -r in (3.1) and (3.2), then integrateboth l/( 1 + r ) and each term of the convergent series in order to produce the seriesexpansion(3.5)If we now identify the indefinite integral on the left-hand side as 1n(1 + r), onehas produced a power series expansion for the natural logarithm. This result agreeswith the Taylor-expansion method of deriving logarithms in series expansion that ispresented in Section 3.2.Exercise 3.5Show the steps leading to the result (3.5) for the power-series expansion of theintegral.

nNow that we have some experience with the well-behaved geometric series, it istime to expand our horizons to power series that are more general. With this as ourgoal, we should review Taylor’s theorem on power-series expansions and functionderivatives.58POWER SERIESTaylor’s theorem and its proofIn later chapters, especially in Chapters 4, 5, 7, and 8, we often require polynomialapproximations to functions. If the function is smooth enough that as many derivatives as needed can be calculated analytically, then Taylor’s theorem gives a uniqueprescription for the polynomial coefficients.

We now review the conditions for applicability of the theorem and we review a convenient proof of it.Suppose that a function y(x) and its first n derivatives y(k)(a) for k = 1,2,..,nare continuous on an interval containing the points a and x. Then Taylor’s theoremstates that(3.6)in which the remainder after n terms, Rn, is given by(3.7)In practice, one tries to choose n and a so that it is a fair approximation that Rn canbe ignored for the range of x of current interest, typically x values near a. If Rn maybe ignored, then y (x) is aproximated by an n th-order polynomial in the variable(x - a). In order to make the statement of Taylor’s theorem plausible, consider thefollowing examples.Exercise 3.6(a) Suppose that y (x) is a polynomial of order n in the variable (x - a), sothat(3.8)Show that Taylor’s theorem, (3.6), is exactly satisfied and that the remainder isidentically zero because the derivative therein is zero.(b) Suppose now that y (x) is a polynomial of order (n + 1) in the variable(x - a).

Show that the remainder after n terms is given by(3.9)which is just the (n + 1) th term of the polynomial. nTherefore, we have two examples in which the theorem is true, but (just as twoswallows do not a summer make) this is not sufficient for a mathematical proof, especially because the result should not depend on the use of a polynomial which has a3.1 MOTIVATION FOR USING SERIES: TAYLOR’S THEOREM59particularly simple dependence on the variable a.

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