c3-2 (779472)

Файл №779472 c3-2 (Numerical Recipes in C)c3-2 (779472)2017-12-27СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла

3.2 Rational Function Interpolation and Extrapolation1113.2 Rational Function Interpolation andExtrapolationRi(i+1)...(i+m) =p 0 + p1 x + · · · + pµ x µPµ (x)=Qν (x)q 0 + q 1 x + · · · + q ν xν(3.2.1)Since there are µ + ν + 1 unknown p’s and q’s (q0 being arbitrary), we must havem+1 = µ+ν +1(3.2.2)In specifying a rational function interpolating function, you must give the desiredorder of both the numerator and the denominator.Rational functions are sometimes superior to polynomials, roughly speaking,because of their ability to model functions with poles, that is, zeros of the denominatorof equation (3.2.1). These poles might occur for real values of x, if the functionto be interpolated itself has poles.

More often, the function f(x) is finite for allfinite real x, but has an analytic continuation with poles in the complex x-plane.Such poles can themselves ruin a polynomial approximation, even one restricted toreal values of x, just as they can ruin the convergence of an infinite power seriesin x. If you draw a circle in the complex plane around your m tabulated points,then you should not expect polynomial interpolation to be good unless the nearestpole is rather far outside the circle. A rational function approximation, by contrast,will stay “good” as long as it has enough powers of x in its denominator to accountfor (cancel) any nearby poles.For the interpolation problem, a rational function is constructed so as to gothrough a chosen set of tabulated functional values.

However, we should alsomention in passing that rational function approximations can be used in analyticwork. One sometimes constructs a rational function approximation by the criterionthat the rational function of equation (3.2.1) itself have a power series expansionthat agrees with the first m + 1 terms of the power series expansion of the desiredfunction f(x).

This is called P adé approximation, and is discussed in §5.12.Bulirsch and Stoer found an algorithm of the Neville type which performsrational function extrapolation on tabulated data. A tableau like that of equation(3.1.2) is constructed column by column, leading to a result and an error estimate.The Bulirsch-Stoer algorithm produces the so-called diagonal rational function, withthe degrees of numerator and denominator equal (if m is even) or with the degreeof the denominator larger by one (if m is odd, cf. equation 3.2.2 above).

For thederivation of the algorithm, refer to [1]. The algorithm is summarized by a recurrenceSample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).Some functions are not well approximated by polynomials, but are wellapproximated by rational functions, that is quotients of polynomials.

We denote by Ri(i+1)...(i+m) a rational function passing through the m + 1 points(xi , yi ) . . . (xi+m , yi+m ). More explicitly, suppose112Chapter 3.Interpolation and Extrapolationrelation exactly analogous to equation (3.1.3) for polynomial approximation:Ri(i+1)...(i+m) = R(i+1)...(i+m)+R(i+1)...(i+m) − Ri...(i+m−1)R−Ri...(i+m−1)1 − R (i+1)...(i+m)−1−R(i+1)...(i+m)(i+1)...(i+m−1)(3.2.3)This recurrence generates the rational functions through m + 1 points from the onesthrough m and (the term R(i+1)...(i+m−1) in equation 3.2.3) m−1 points. It is startedwith(3.2.4)Ri = yiand with(3.2.5)R ≡ [Ri(i+1)...(i+m) with m = −1] = 0Now, exactly as in equations (3.1.4) and (3.1.5) above, we can convert therecurrence (3.2.3) to one involving only the small differencesCm,i ≡ Ri...(i+m) − Ri...(i+m−1)Dm,i ≡ Ri...(i+m) − R(i+1)...(i+m)(3.2.6)Note that these satisfy the relationCm+1,i − Dm+1,i = Cm,i+1 − Dm,i(3.2.7)which is useful in proving the recurrencesDm+1,i = Cm+1,i =Cm,i+1 (Cm,i+1 − Dm,i )x−xix−xi+m+1 Dm,i − Cm,i+1Dm,i (Cm,i+1 − Dm,i )x−xix−xi+m+1 Dm,i − Cm,i+1x−xix−xi+m+1(3.2.8)This recurrence is implemented in the following function, whose use is analogousin every way to polint in §3.1.

Note again that unit-offset input arrays areassumed (§1.2).#include <math.h>#include "nrutil.h"#define TINY 1.0e-25A small number.#define FREERETURN {free_vector(d,1,n);free_vector(c,1,n);return;}void ratint(float xa[], float ya[], int n, float x, float *y, float *dy)Given arrays xa[1..n] and ya[1..n], and given a value of x, this routine returns a value ofy and an accuracy estimate dy. The value returned is that of the diagonal rational function,evaluated at x, which passes through the n points (xai , yai ), i = 1...n.{int m,i,ns=1;float w,t,hh,h,dd,*c,*d;Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited.

To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).x−xix−xi+m3.3 Cubic Spline Interpolation113}CITED REFERENCES AND FURTHER READING:Stoer, J., and Bulirsch, R. 1980, Introduction to Numerical Analysis (New York: Springer-Verlag),§2.2. [1]Gear, C.W.

1971, Numerical Initial Value Problems in Ordinary Differential Equations (EnglewoodCliffs, NJ: Prentice-Hall), §6.2.Cuyt, A., and Wuytack, L. 1987, Nonlinear Methods in Numerical Analysis (Amsterdam: NorthHolland), Chapter 3.3.3 Cubic Spline InterpolationGiven a tabulated function yi = y(xi ), i = 1...N , focus attention on oneparticular interval, between xj and xj+1 . Linear interpolation in that interval givesthe interpolation formulay = Ayj + Byj+1(3.3.1)Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.

Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).c=vector(1,n);d=vector(1,n);hh=fabs(x-xa[1]);for (i=1;i<=n;i++) {h=fabs(x-xa[i]);if (h == 0.0) {*y=ya[i];*dy=0.0;FREERETURN} else if (h < hh) {ns=i;hh=h;}c[i]=ya[i];d[i]=ya[i]+TINY;The TINY part is needed to prevent a rare zero-over-zero}condition.*y=ya[ns--];for (m=1;m<n;m++) {for (i=1;i<=n-m;i++) {w=c[i+1]-d[i];h=xa[i+m]-x;h will never be zero, since this was tested in the initialt=(xa[i]-x)*d[i]/h;izing loop.dd=t-c[i+1];if (dd == 0.0) nrerror("Error in routine ratint");This error condition indicates that the interpolating function has a pole at therequested value of x.dd=w/dd;d[i]=c[i+1]*dd;c[i]=t*dd;}*y += (*dy=(2*ns < (n-m) ? c[ns+1] : d[ns--]));}FREERETURN.

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

Тип файла
PDF-файл
Размер
123,86 Kb
Материал
Тип материала
Высшее учебное заведение

Тип файла PDF

PDF-формат наиболее широко используется для просмотра любого типа файлов на любом устройстве. В него можно сохранить документ, таблицы, презентацию, текст, чертежи, вычисления, графики и всё остальное, что можно показать на экране любого устройства. Именно его лучше всего использовать для печати.

Например, если Вам нужно распечатать чертёж из автокада, Вы сохраните чертёж на флешку, но будет ли автокад в пункте печати? А если будет, то нужная версия с нужными библиотеками? Именно для этого и нужен формат PDF - в нём точно будет показано верно вне зависимости от того, в какой программе создали PDF-файл и есть ли нужная программа для его просмотра.

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

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