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

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

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

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

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

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

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

Indeed, we explore this possibility in discussing the Lorentzian resonances inSection 10.2.2.6 PROJECT 2: PROGRAM TO CONVERT BETWEEN COORDINATES2.645PROJECT 2: PROGRAM TO CONVERTBETWEEN COORDINATESThe program Cartesian & Polar Coordinate Interconversiondeveloped inthis project serves both to develop your understanding of the relations between thesetwo coordinate systems and to give you practice with writing programs in C.The conversion from plane-polar to Cartesian coordinates is straightforward andunambiguous.

Given r and one has immediately (as discussed in Section 2.2)(2.78)which can be programmed directly.Stepping into the correct quadrantThe transformation from Cartesian coordinates to polar coordinates is less direct thanthe inverse transformation just considered. The required formulas are(2.79)which is straightforward to compute, and, in terms of the atan or tan-l function,(2.80)which is ambiguous. This formula does not uniquely determine the quadrant inwhich lies because only the sign of the quotient in (2.80) is available after the division has been made. The relative signs of the circular functions in the four quadrants indicated in Figure 2.7 may be used to determine the angle uniquely from thesigns of x and y.In some programming languages, including C, two functions are available forthe inverse tangent.

In one, such as the atan (t) in C language (with t the argument of the function), the angle is usually returned in the range /2 to /2, and theuser of this function has to determine the appropriate quadrant by other means.In the second function for the inverse tangent, such as atan2 (y, x) in the Clanguage, the angle is located in the correct quadrant by the function itself.

If wewere to use at atan2 in the program, the conversion from Cartesian to polar representation would be very direct. For practice in C and to reinforce your understanding ofplane-polar coordinates we use the simpler function atan.46COMPLEX VARIABLESFIGURE 2.7 Signs of the circular functions in each quadrant of the Cartesian plane.If we begin with an angle calculated into the first quadrant by using the absolutevalue of y/x, then multiples of /2 have to be added or subtracted to get the angleinto the correct quadrant. Computationally, the best way to get at the accuracy ofyour computer system is to use the identity(2.8 1)This relation is used in this program and in many others throughout this book.Coding, testing, and using the programThe structure of program Cartesian & Polar Coordinate Interconversionis typical of the interactive programs listed in the index to computer programs at theend of the book.

The program is controlled by a whi1e loop that terminates whenboth x and y (going from Cartesian to polar) and also r (going from polar to Cartesian) have been input with values of zero. Within each execution of the loop there isa choice of input of either Cartesian coordinates (chosen by c or C ) or polar ( por P ) coordinates.The Cartesian-input option uses the function MakePolar to locate an angle inthe first quadrant and to use the signs of x and y to adjust the quadrant, as discussedabove. Some care is required for angles that coincide with the axes.

The polar-inputoption uses (2.78) directly in the function MakeCartesian and returns the valuesof the x and y variables. The program listing is as follows.2.6 PROJECT 2: PROGRAM TO CONVERT BETWEEN COORDINATESPROGRAM 2.3 Interconversion between Cartesian and polar coordinates.#include#include<stdio.h><math.h>main ()/* Cartesian & Polar Coordinate Interconversion */double pi,x,y,r,theta;char isCP;voidMakePolar(),MakeCartesian();pi = 4*atan(l); /* pi to machine accuracy */printf("Cartesian & Polar Coordinates\n");x = 1; y = 1; r = 1;while ( (( x != 0 ) && ( y != 0 )) || ( r != 0 ) ){printf("\nCartesian (C) or Polar (P) input?\n");scanf("%s",&isCP) ;if ( isCP == 'c' || isCP == 'C' ){printf("Input Cartesian values as x y\n");scanf( "%le %le" , &x,&y) ;if((x!=O)||(y!=O)){MakePolar(pi,x,y,&r,&theta);printf("Polar values: r=%le, theta=%le (rad)\n",r,theta);}}else{if ( isCP == 'p' || isCP == 'P' ){printf("Input Polar values as r theta (rad) \n");scanf("%le %le",&r,&theta);if ( r != 0 ){MakeCartesian(r,theta,&x,&y);printf(Cartesian values: x=%le, y=%le\n",x,y);}}}}printf("\nEnd Cartesian & Polar Coordinates"); &t(O);}4748COMPLEX VARIABLESvoidMakePolar(pi,x,y,r,theta)/* Make polar coordinates from Cartesian coordinates */double pi,x,y; /* are input variables */double *r,*theta; /* are calculated variables */double angle;*r = sqrt(x*x+y*y);if ( x == 0 )angle = pi/2;else angle = atan(fabs(y/x)if (x>=O && y>=O) *theta =if (x<=0 && y>=O) *theta =if (x<=0 && y<=O) *theta =if (x>=O && y<=O) *theta =void);angle; /* first quadrant */pi-angle; /* second quadrant */pi+angle; /*third quadrant */-angle; /* fourth quadrant */MakeCartesian(r,theta,x,y)/* Make Cartesian coordinates from polar coordinates */double r,theta; /* are input variables */double *x,y; /* are calculated variables */*x = r*cos(theta);*y = r*sin(theta);}Now that we have a source program for converting between coordinates, it isappropriate to test and use it.Exercise 2.23Testprogram Cartesian & Polar Coordinate Interconversion for thetwo options by using as input values combinations of x and y or of r andthat correspond to points in each of the four quadrants and along the boundariesbetween quadrants, a total of 16 combinations.

Also verify that the program terminates if all of x, y, and r are input as zero. nYou now have two functions that are useful in converting coordinates. Extensionsof these programs may be used to interconvert spherical-polar and three-dimensionalCartesian coordinates.REFERENCES ON COMPLEX NUMBERS49REFERENCES ON COMPLEX NUMBERSBaldock, G. R., and T. Bridgeman, Mathematical Theory of Wave Motion, EllisHorwood, Chichester, England, 198 1.Ingard, K. U., Fundamentals of Waves and Oscillations, Cambridge UniversityPress, Cambridge, England, 1988.Pippard, A. B., The Physics of Vibration, Cambridge University Press, Cambridge,England, 1988.Wolfram, S., Mathenmtica: A System for Doing Mathematics by Computer, Addison-Wesley, Redwood City, California, second edition, 1991.50Previous Home NextChapter 3POWER SERIES AND THEIR APPLICATIONSThe goal of this chapter is to understand the analysis, numerics, and applications ofpower series, which form the basis for many of the powerful methods used in computing.

The chapter begins with a discussion of the motivation for using series,summarizing some properties and applications of the geometric series, then enunciating and proving Taylor’s theorem on power series. This general theorem is thenused in Section 3.2 to develop expansions of useful functions-the exponential,cosine, sine, arcsine, logarithm, and the hyperbolic cosine and sine. In this sectionthere are preliminary numerical and computing studies in preparation for the projectat the end of the chapter.The binomial approximation and various of its applications are described in Section 3.3, followed by a diversion (Section 3.4) in which we discuss iteration, recurrence, and recursion in mathematics and computing.

The computing project forthis chapter is testing the numerical convergence of the series for the functions considered in Section 3.2. References on power series then complete the chapter.3.1MOTIVATION FOR USING SERIES: TAYLOR’S THEOREMIn this section we review the properties of power series and we explore their numerical properties, especially their convergence. Since the geometric series is easy tohandle algebraically but also exhibits many of the problems that power series mayexhibit, we consider it first. Then we consider the very powerful Taylor’s theorem,which allows differentiable functions to be characterized by power series. A discussion of the interpretation of Taylor series then prepares us for the several examplesin Section 3.2 of expansions of interesting and useful functions.We emphasize the numerical convergence of series, resting assured by suchmathematics texts as those by Taylor and Mann (Chapters 19 - 21) and by Protterand Morrey (Chapter 3) that all the series that we consider are analytically conver5152POWER SERIESgent for the range of variables that we consider.

After you have understood the materials in this chapter you will be ready to use powerful algebraic and numericalcomputing systems, such as the Mathematica system described in Chapter 3.6 ofWolfram’s book, to perform accurately and efficiently much of the work involved inmaking expansions in power series.The geometric seriesThe geometric series provides a good example of a power series that can be readilyinvestigated and that illustrates many properties of series. We quickly review its formal properties, then discuss its numerical convergence properties and its relation toother functions.The usual definition of the geometric series to n terms is the function(3.1)in which the parameter r determines the convergence of the series. Although the results that we derive generally hold for complex values of r, we will discuss examples only for r a real variable.

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