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

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

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

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

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

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

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

Thefactorials of k in the denominators in (3.18) help greatly in producing convergence,because it is they which distinguish the exponential series (which converges everywhere) from the geometric series (which converges only within the unit circle).Once we have analytical and numerical experience with power series for the exponential function, other often-used circular and hyperbolic functions can be handledquite directly.

They have nice convergence behavior similar to that of the exponential because, as we showed in Section 2.3, they are all functions belonging to thesame family.3.2 TAYLOR EXPANSIONS OF USEFUL FUNCTIONS65FIGURE 3.3 Convergence of the exponential-function power series. The solid line shows theexponential function, while the dashed lines show the series summed to 2 or 4 terms.Series for circular functionsThe circular functions, cosine and sine, are used frequently, especially when solvingproblems in oscillatory motion, vibrations, and waves. We discussed this in Section 2.4 in the context of complex-variable representations of these phenomena.The analysis and numerics of such problems can often be simplified if Taylor expansions of the circular functions can be used.The direct way of deriving the Taylor expansions using (3.6) would be to evaluate the indicated derivatives.

This method is tedious and error-prone because thesuccessive derivatives switch between the cosine and sine functions, and they alsochange signs. A more insightful method of deriving their series is to use the connection between complex exponentials and the circular functions as stated in Euler’stheorem, (2.39) in Section 2.3. For simplicity, let us assume that x is a real variable. We write (2.39) as(3.19)It is now straightforward to derive the expansions for the cosine and sine.Exercise 3.11In (3.19) equate real and imaginary parts of the left- and rightmost expressionsin order to derive the Maclaurin expansions for the cosine and sine functions,namely66POWER SERIES(3.20)(3.21)which are convergent series, since they arise from the convergent series for theexponential function.

nNote that in both these formulas the arguments of the circular functions, x, must bein radians, not in degrees. One can see this from the fact that the Euler theorem refers to angles in radians, or alternatively, that the derivatives of cosines and sines arefor arguments in radians.The conversion factors between the two angular measures are given by radians = degrees / 180, thus we have that radians = 0.0174533 degrees and degrees = 57.2950 radians. Roughly (in the approximation that = 3), we haveradians degrees / 60.The cosine series can often be put to very practical use by considering only thefirst two terms of its Maclaurin expansion (3.20).

This makes the approximation forthe cosine a quadratic expression in x, which is usually easy to handle. If we notethat cosine or sine need not be computed with x > /4 because of the trigonometricformulas for complementary angles, we can see that the error in the use of a quadratic approximation is surprisingly small, and is therefore adequate for many purposes.Exercise 3.12(a) Write out the Maclaurin series for the cosine explicitly to show that(3.22)(b) Show that if x = /4, then by neglecting the third term one makes an errorof about 2% in the value of the cosine, which is(c) In measuring lengths along nearly parallel lines you will have noticed that asmall error of nonparallelism does not produce significant error in a length measurement. For example, a good carpenter, surveyor, or drafter can gauge parallelism to within 2°.

Show for this angle that the fractional error in a length measurement is then about 1 part in 2000. nThe sine series given by (3.21) also converges rapidly. It is convenient to writeit in the form3.2 TAYLOR EXPANSIONS OF USEFUL FUNCTIONS 67(3.23)Strictly speaking, this form holds only for x 0. It is usual, however, to let theright-hand side of (3.23) be defined as the value of the left-hand-side quotient evenfor x = 0, so that the ratio (sin x)/x is defined to be unity at x = 0.

The angles,x, in (3.23) are in radians, just as for the cosine power series (3.20).By comparison with the cosine series (3.20) for given x, the sine expansion(3.21) converges more rapidly, as the following exercise will show you.Exercise 3.13(a) Show that if x = /4, then by neglecting the third and higher terms in(3.21) one makes an error of less than 0.4% in the value of (sin x )/x.(b) Verify that the theorem of Pythagoras, (2.43), is satisfied through the termsof order x4 in the cosine and sine as given in (3.20) and (3.21). This result provides another justification for the result in Exercise 3.12 (c). nRapid and accurate numerical approximations for the trigonometric functions areof great importance in scientific and engineering applications.

If one is allowed touse both the cosine and sine series for computing either, one can reduce the value ofx appearing in the power series (3.20) and (3.21) so that it does not exceed/8 = 0.392699. To do this one uses the identities(3.24)The power series (3.20) and (3.21) through terms in x6 may be written(3.25)and in Horner polynomial formFor x < /8 the neglected terms in the cosine are less than 10-9 and in the sinethey are less than 10-10.

You can test all these numerics by using Program 3.3.The program Cosine & Sine has a straightforward structure. The main program is controlled by a whi1e loop over the values of x that are used in the calculation of the cosine and sine polynomial approximations (3.25) and (3.26). Eachrun of the program allows a range of x values to be evaluated, with xmax input aszero to exit gracefully from the program.68POWER SERIESPROGRAM 3.3 Cosine and sine in the compact form of polynomials.#include#include<stdio.h><math.h>main(){/* Cosine & Sine in Compact Form */double xmin,dx,xmax,x,CosVal,CosErr,SinVal,SinErr;double CosPoly(),SinPoly();printf("Cosine & Sine in compact form\n");xmax = 2;while(xmax!=O){printf("\n\nInput xmin,dx,xmax (xmax=0 to end):\n");scanf("%lf%lf%lf",&xmin,&dx,&xmax);if (xmax == 0 ){printf("\nEnd Cosine & Sine in Compact Form");exit (0);}for ( x = xmin; x <= xmax; x = x+dx )CosVal = 2*pow(CosPoly(x/2),2)-1;CosErr = cos(x)-CosVal; /* compare with computer's cosine */SinVal = 2*SinPoly(x/2)*CosPoly(x/2);SinErr = sin(x)-SinVal; /* compare with computer's sine */printf("\n%g %g %g %g %g",x,CosVal,CosErr,SinVal,SinErr);}}}double CosPoly(x)/* Cosine Polynomial through x to 6-th power */double x;{double y,poly;y = x*x/2;poly = 1 - y*(l - (y/6)*(1 - y/15));return poly;}3.2TAYLOR EXPANSIONS OF USEFUL FUNCTIONS69double SinPoly(x)/* Sine Polynomial through x to 7-th power */double x;double y,poly;y = x*x/2;poly = x*(1 - (y/3)*(1 - (y/10)*(1 - y/21)));return poly;For each x value the program uses the identities (3.24) to halve the argumentused in the circular functions.

The quantities CosVal and Sinval are obtained interms of the polynomial-approximation C functions used with the half angles. Thesequantities are compared with the values produced by the computer mathematical library functions, which are presumed to be exact to within computer roundoff error.The C functions CosPoly and SinPoly are simple implementations of thepolynomial formulas (3.25) and (3.26). By precomputing x2/2 we gain some efficiency, as well as improving the clarity of the coding.

The nested form of the polynomial evaluation, the so-called Horner’s method that is further discussed in Section 4.1, also is efficient of computer time.Given the program it is educational to run it and explore numerically the cosineand sine polynomial approximations.Exercise 3.14Code and run the program Cosine & Sine for an interesting range of the arguments x. First check that the polynomials maintain the reflection (parity) symmetry of the exact functions, namely that the cosine is an even function of x andthat the sine is an odd function of x.

Then verify that for x < /8 (angles lessthan 22.5°) that the accuracy is as claimed below (3.26). Finally, expand therange of x values to find out when an unacceptably large error results, saygreater than 10-6. nAlthough the polynomial approximations suggested here are remarkably accurate, one can compute the circular functions more accurately in a comparable time byusing various other approximations, such as discussed extensively for the sine function in Chapter 3 of Miller’s book on the engineering of numerical software and inthe handbook by Cody and Waite. Project 3 in our Section 3.5 again examines theconvergence of power series for circular functions.Having studied Taylor expansions of the circular functions rather exhaustively(and maybe exhaustingly), we are well equipped to consider power series for relatedfunctions.70POWER SERIESInverse circular functionsThe inverse circular functions are of interest and importance in analysis, numerics,and applications because problem solutions often are given in terms of arccosine orarcsine functions.

These are the two inverse functions that we consider, althoughthe arctangent function often also occurs in scientific and engineering problems, butit is considerably more difficult both analytically and numerically.Because arccosine and arcsine functions with the same argument are related bybeing complementary angles (summing to /2), the value of one function impliesthe other. If we wish to have a Maclaurin series (an expansion with a = 0), thiswill be difficult for the arccosine, because we know that arccos (0) = /2. So wechoose to expand the arcsine function, since arcsin (0) = 0, which promises rapidconvergence of its Maclaurin series.The general prescription for a Taylor series is given by (3.6).

With a = 0 toproduce a Maclaurin series, we need the successive derivatives of the function arcsin x, then these derivatives are to be evaluated at x = a = 0. This will providegood mental exercise for you.Exercise 3.15(a) The first derivative needed is that of the arcsine function itself. Show that(3.27)(b) Evaluate the second and higher derivatives of the arcsine function, that is,the first and higher derivatives of the right-hand side of (3.27), then set x = 0in the derivatives for the Taylor expansion (3.6) in order to obtain the power series(3.28)which is consistent with the expansion for the sine function, (3.21), through thefirst two terms. nThe general pattern for the coefficients of the powers occurring in the series isnot so obvious; it is clarified when we develop the program for the arcsine functionin Section 3.5. For the moment we note the close similarity of the Maclaurin seriesfor the sine and arcsine functions.

We therefore expect similar rapid convergence ofthe series (3.28). Since for real angles only values of x with magnitude less thanunity are allowed in this expansion, the expansion of the arcsine function is particularly rapid. By continuity, one has arcsin (1) = /2 for angles restricted to thefirst quadrant.3.2 TAYLOR EXPANSIONS OF USEFUL FUNCTIONS71Hyperbolic function expansionsWe introduced the hyperbolic functions cosh and sinh in Section 2.3 in the contextof functions of complex variables.

On the basis of analysis methods that we havedeveloped, there are three ways to obtain the power series expansions of these hyperbolic functions: we may use Taylor’s theorem directly, we may use their definitions in terms of the exponential functions, or we may use the relations between hyperbolic and circular functions that were obtained in Exercise 2.14. The first way isby now rather boring, so consider the other two.Exercise 3.16(a) Consider the definitions of cosh x and sinh x in terms of the exponentials,as given by (2.48) and (2.49), then note the Maclaurin series for exp ( x) givenby (3.18).

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