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

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

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

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

The program can be tested by coding below the formulas in y (x) andVs (x, y ) an integrand and an analytic integral, respectively, that can easily bechecked by hand, such as a low-order polynomial.(b) Run the program for the coded example of the uniform charge density and areasonable stepsize, say h = 0.1, to check your results against those displayedin Figure 4.10 at y = 0.5, 1.5, and 2.5 for x > 0.(c) If you have a program that displays contours, modify Electrostatic Potentia1s to compute a mesh of( x , y )points fine enough that smooth contours (equipotentials) are produced by the Simpson method.

Thus generate thecontours for the potential from a uniformly charged wire. Do the contours makephysical sense, in that electrostatic energy would be constant along a contour?REFERENCES ON NUMERICAL DERIVATIVES AND INTEGRALS151(d) Modify the program to allow positive integer powers, p, for the chargedensity (4.49). This requires only minor changes to the potential-integrandfunction y (x) , but substantial changes are needed to the potential integral function, Vs (x, y ) , to include the recurrence formula (4.56) and the summation(4.51). (You may have already done this in Exercise 4.26.) Then this functionhas to be used for both limits of integration.

The numerical integration functionsshould be scarcely modified, and thereby they serve to identify any errors inyour analytical results. As p is increased, the charges should pile up (positiveand negative) at the two ends of the wire, and the potential should resemble thatfrom two point charges of opposite sign at the two ends of the wire. Is this whatyou find?(e) As a final topic of exploration, turn off the analytical solution and try the numerical integrations with noninteger values of p, such as p = 0.5, 0.75, and acharge distributed as |y|p rather than yp, in order to avoid complex results. Yourresults should roughly interpolate between those for adjacent integer values of p,such as p = 0, 1.

To make such a comparison you will need to modify thesolutions to accommodate the change in the charge-distribution formula (4.49)from yp to |y|p. For example, just split the integral into contributions fromabove and below the origin. nWith the experience in numerical integration that you have gained from this applied-physics project and from the exercises in Sections 4.4 - 4.6, you should beconfident to compute many kinds of numerical derivatives and integrals.REFERENCES ON NUMERICAL DERIVATIVES AND INTEGRALSAbramowitz, M., and I. A. Stegun, Handbook of Mathematical Functions, Dover,New York, 1964.Davis, P.

J., and P. Rabinowitz, Methods of Numerical Integration, AcademicPress, Orlando, Florida, second edition, 1984.Maron, M. J., Numerical Analysis, Macmillan, New York, second edition, 1987.Nakamura, S., Applied Numerical Methods with Software, Prentice Hall, Englewood Cliffs, New Jersey, 1991.Pippard, A. B., Response and Stability, Cambridge University Press, Cambridge,England, 1985.Pippard, A. B., The Physics of Vibration, Cambridge University Press, Cambridge,England, 1989.Press, W. H., B.

P. Flannery, S. A. Teukolsky, and W. T. Vetterling, NumericalRecipes in C, Cambridge University Press, New York, 1988.Vandergraft, J. S., Introduction to Numerical Computations, Academic Press, NewYork, 1978.Wolfram, S., Mathematica: A System for Doing Mathematics by Computer, Addison-Wesley, Redwood City, California, second edition, 199 1.152Previous Home NextChapter 5FITTING CURVES THROUGH DATAIn this chapter we emphasize making essentially exact fits of curves through datavalues, as if the data were mathematically precise.

Therefore, you will notice as youskim the section headings that the applications (interpolation, derivatives, integrals)take the data as found and estimate other quantities from them. This emphasis is different from data-fitting methods developed in Chapter 6, where the best-fit curves donot usually pass through each data value, and where our attitude is that the data areimprecise and we make our best effort to find a more exact representation of them.Spline fitting and least-squares fitting are thus complementary.

For example, aspline fit may be used to preprocess data, for example to interpolate them so that datafrom different sources have their independent variables sampled at the same points,then a least-squares fit will be made on the interpolated data. (It is feasible, but complicated, to combine the two methods and to make a spline-least-squares fit.)For the exact fits to data considered in this chapter, one method would be to usea truncated Taylor series to approximate y(x) and to fit a single polynomial of ordern - 1 through the n points, then to estimate the desired properties from the polynomial. Although this method is hallowed by tradition (see, for example, Abramowitzand Stegun), it has the severe disadvantage that if n becomes large the polynomial fitwill generally have more and more wiggles in it, especially if the data are experimental or arise from an approximate numerical procedure.

We encountered this problemwith polynomials in Sections 4.1 and 4.4 - 4.6.Exercise 5.1Explain why, both from analytical and graphical considerations, a polynomial oforder n may have as many as n - 1 changes of direction over its whole range ofvariation. nFor example, the working function (4.1), a sixth-order polynomial all of whoseroots are real and lie in the interval [-0.5, 1], has four changes of direction in the interval [-0.5,0.5), as seen in Figure 4.1.

Such wiggly behavior, sometimes called153154FITTIING CURVES THROUGH DATAthe “polynomial wiggle problem,” is usually inconsistent with the problem at hand.Can we develop a curve-fitting method that guarantees a smooth fit through a sequence of points, and whose behavior does not change much as we add data?In this chapter we develop the method of curve fitting by splines.

For simplicity, while still being practicable, we consider the cubic spline, in which the behaviorof the fitting polynomial is a cubic in the interval between consecutive points, butthere is a different cubic polynomial in successive intervals. The major reason whythe local fitting polynomial is of order three (a cubic) is that this order guaranteescontinuity of the slopes of the spline tangents at the knots.Exercise 5.2Show that a necessary and sufficient condition for a piecewise polynomial tohave a continuous second derivative (slope of its tangent) at the matching knotsis that it be at least of third order. nIf we used a polynomial of order higher than third the spline equations would bemore complex to solve and to use, usually without much gain in accuracy of the approximation except for the higher-order derivatives.This chapter is organized as follows.

We derive the fitting algorithm in Section5.1, and we investigate in Section 5.2 how the results depend on the spline behaviornear the endpoints. In Project 5 (Section 5.3) you are shown how to program thealgorithm derived in Sections 5.1 and 5.2, and there are exercises so that you cancheck the program correctness. We show in Section 5.4 how to interpolate withcubic splines and how to use them to estimate derivatives, then in Section 5.5 weshow their usefulness for integration and provide several examples.As a diversion, we discuss in Section 5.6 the close relation between the development of computers and the extensive growth in the use of spline methods in applications from data analysis through the design of type fonts for printing and the description of surfaces in computer graphics.

References on spline fitting round out thechapter.5.1HOW TO FIT CURVES USING SPLINESIn this section we derive the properties that a spline fit is required to satisfy, then wederive and solve the spline equations and develop an algorithm for spline fitting thatcan readily be coded in the C language. The code itself is presented and first used inSection 5.3.What is a spline?The various methods of spline fitting are the numerical analogs of using a thin, uniform, flexible strip (a drafting spline) to draw smooth curves through and betweenpoints on a graph.

The cubic spline method that we develop is locally smooth and is5.1HOW TO FIT CURVES USING SPLINES155insensitive to adding data. We begin by introducing some terminology used inspline fitting. When needed, we will be mathematically more precise in the formuladerivations.A spline of N th order is one in which N + 1 adjacent points define a polynomial of order N to pass through the middle point. For example, one most oftenuses a cubic spline (N = 3), in which the spline behaves locally as a cubic polynomial. However, there will be different cubics going through successivepoints. Therefore, the spline is a composite curve, as shown in Figure 5.1.The knots of the spline are the points through which the spline curve is requiredto pass.

A sample of n data therefore has n knots. Thus, spline algorithms assume exact fitting at the knots, rather than the compromise made in least-squaresmethods.Spline endpoint conditions are the constraints imposed on the behavior of thespline near the first and last data points. You can see that some special constraints are needed, because if you try to use a drafting spline you can bend it atthe ends without changing the fit near its middle very much. Usually, a draftingspline just sticks out straight at the ends, so it has second derivatives zero. Thisis called the natural-spline endpoint condition.Examples of spline fits with two different endpoint conditions are shown in Figures 5.1 and 5.2.

We investigate spline boundary conditions in detail in Section 5.2.FIGURE 5.1 The pathological working function (4.1) and its fit by a cubic spline through fiveknots (indicated by the circles) using natural endpoint conditions. The solid curve is the workingfunction and the dashed curves are the cubics used between each pair of knots. Each cubic is shownbeyond the region in which it is used in order to show the continuity of the spline curvature.156FITTING CURVES THROUGH DATAIf the curvature of the spline fit (which is indicated by the second derivative) is tobe smooth, but we are willing to compromise on higher derivatives implied by they(x), then local approximation by a cubic spline, s(x), is appropriate. Our development assumes that the spline is of third order and (for simplicity of explanation andease of use) that the knots are equally spaced.With the definitions taken care of, we are ready to analyze the spline properties,then to set up and solve the spline equations.Properties for spline fitsWe require for a cubic-spline fit that the fitting function, s(x), satisfy the followingproperties:1.

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

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

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

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