c6-6 (779506)

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

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

236Chapter 6.Special FunctionsCITED REFERENCES AND FURTHER READING:Abramowitz, M., and Stegun, I.A. 1964, Handbook of Mathematical Functions, Applied Mathematics Series, Volume 55 (Washington: National Bureau of Standards; reprinted 1968 byDover Publications, New York), Chapter 9.Hart, J.F., et al. 1968, Computer Approximations (New York: Wiley), §6.8, p. 141.

[1]The modified Bessel functions In (x) and Kn (x) are equivalent to the usualBessel functions Jn and Yn evaluated for purely imaginary arguments. In detail,the relationship isIn (x) = (−i)n Jn (ix)Kn (x) =π n+1i[Jn (ix) + iYn (ix)]2(6.6.1)The particular choice of prefactor and of the linear combination of Jn and Yn to formKn are simply choices that make the functions real-valued for real arguments x.For small arguments x n, both In (x) and Kn (x) become, asymptotically,simple powers of their argumentIn (x) ≈1 x nn! 2n≥0K0 (x) ≈ − ln(x)Kn (x) ≈(n − 1)! x −n22(6.6.2)n>0These expressions are virtually identical to those for Jn (x) and Yn (x) in this region,except for the factor of −2/π difference between Yn (x) and Kn (x). In the regionx n, however, the modified functions have quite different behavior than theBessel functions,1exp(x)In (x) ≈ √2πxπKn (x) ≈ √exp(−x)2πx(6.6.3)The modified functions evidently have exponential rather than sinusoidalbehavior for large arguments (see Figure 6.6.1).

The smoothness of the modifiedBessel functions, once the exponential factor is removed, makes a simple polynomialapproximation of a few terms quite suitable for the functions I0 , I1 , K0 , and K1 .The following routines, based on polynomial coefficients given by Abramowitz andStegun [1], evaluate these four functions, and will provide the basis for upwardrecursion for n > 1 when x > n.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).6.6 Modified Bessel Functions of Integer Order2376.6 Modified Bessel Functions of Integer Order4I02K0K1K2I1I21I30012x3Figure 6.6.1. Modified Bessel functions I0 (x) through I3 (x), K0 (x) through K2 (x).#include <math.h>float bessi0(float x)Returns the modified Bessel function I0 (x) for any real x.{float ax,ans;double y;Accumulate polynomials in double precision.if ((ax=fabs(x)) < 3.75) {Polynomial fit.y=x/3.75;y*=y;ans=1.0+y*(3.5156229+y*(3.0899424+y*(1.2067492+y*(0.2659732+y*(0.360768e-1+y*0.45813e-2)))));} else {y=3.75/ax;ans=(exp(ax)/sqrt(ax))*(0.39894228+y*(0.1328592e-1+y*(0.225319e-2+y*(-0.157565e-2+y*(0.916281e-2+y*(-0.2057706e-1+y*(0.2635537e-1+y*(-0.1647633e-1+y*0.392377e-2))))))));}return ans;}#include <math.h>float bessk0(float x)Returns the modified Bessel function K0 (x) for positive real x.{float bessi0(float x);double y,ans;Accumulate polynomials in double precision.4Sample 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).modified Bessel functions3238Chapter 6.Special Functions}#include <math.h>float bessi1(float x)Returns the modified Bessel function I1 (x) for any real x.{float ax,ans;double y;Accumulate polynomials in double precision.if ((ax=fabs(x)) < 3.75) {Polynomial fit.y=x/3.75;y*=y;ans=ax*(0.5+y*(0.87890594+y*(0.51498869+y*(0.15084934+y*(0.2658733e-1+y*(0.301532e-2+y*0.32411e-3))))));} else {y=3.75/ax;ans=0.2282967e-1+y*(-0.2895312e-1+y*(0.1787654e-1-y*0.420059e-2));ans=0.39894228+y*(-0.3988024e-1+y*(-0.362018e-2+y*(0.163801e-2+y*(-0.1031555e-1+y*ans))));ans *= (exp(ax)/sqrt(ax));}return x < 0.0 ? -ans : ans;}#include <math.h>float bessk1(float x)Returns the modified Bessel function K1 (x) for positive real x.{float bessi1(float x);double y,ans;Accumulate polynomials in double precision.if (x <= 2.0) {Polynomial fit.y=x*x/4.0;ans=(log(x/2.0)*bessi1(x))+(1.0/x)*(1.0+y*(0.15443144+y*(-0.67278579+y*(-0.18156897+y*(-0.1919402e-1+y*(-0.110404e-2+y*(-0.4686e-4)))))));} else {y=2.0/x;ans=(exp(-x)/sqrt(x))*(1.25331414+y*(0.23498619+y*(-0.3655620e-1+y*(0.1504268e-1+y*(-0.780353e-2+y*(0.325614e-2+y*(-0.68245e-3)))))));}return ans;}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).if (x <= 2.0) {Polynomial fit.y=x*x/4.0;ans=(-log(x/2.0)*bessi0(x))+(-0.57721566+y*(0.42278420+y*(0.23069756+y*(0.3488590e-1+y*(0.262698e-2+y*(0.10750e-3+y*0.74e-5))))));} else {y=2.0/x;ans=(exp(-x)/sqrt(x))*(1.25331414+y*(-0.7832358e-1+y*(0.2189568e-1+y*(-0.1062446e-1+y*(0.587872e-2+y*(-0.251540e-2+y*0.53208e-3))))));}return ans;6.6 Modified Bessel Functions of Integer Order239The recurrence relation for In (x) and Kn (x) is the same as that for Jn (x)and Yn (x) provided that ix is substituted for x. This has the effect of changinga sign in the relation,2nIn (x) + In−1 (x)x 2nKn (x) + Kn−1 (x)Kn+1 (x) = +xIn+1 (x) = −These relations are always unstable for upward recurrence.

For Kn , itself growing,this presents no problem. For In , however, the strategy of downward recursion istherefore required once again, and the starting point for the recursion may be chosenin the same manner as for the routine bessj. The only fundamental difference isthat the normalization formula for In (x) has an alternating minus sign in successiveterms, which again arises from the substitution of ix for x in the formula usedpreviously for Jn1 = I0 (x) − 2I2 (x) + 2I4 (x) − 2I6 (x) + · · ·(6.6.5)In fact, we prefer simply to normalize with a call to bessi0.With this simple modification, the recursion routines bessj and bessy becomethe new routines bessi and bessk:float bessk(int n, float x)Returns the modified Bessel function Kn (x) for positive x and n ≥ 2.{float bessk0(float x);float bessk1(float x);void nrerror(char error_text[]);int j;float bk,bkm,bkp,tox;if (n < 2) nrerror("Index n less than 2 in bessk");tox=2.0/x;bkm=bessk0(x);Upward recurrence for all x...bk=bessk1(x);for (j=1;j<n;j++) {...and here it is.bkp=bkm+j*tox*bk;bkm=bk;bk=bkp;}return bk;}#include <math.h>#define ACC 40.0#define BIGNO 1.0e10#define BIGNI 1.0e-10Make larger to increase accuracy.float bessi(int n, float x)Returns the modified Bessel function In (x) for any real x and n ≥ 2.{float bessi0(float x);void nrerror(char error_text[]);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).(6.6.4)240Chapter 6.Special Functionsint j;float bi,bim,bip,tox,ans;}CITED REFERENCES AND FURTHER READING:Abramowitz, M., and Stegun, I.A. 1964, Handbook of Mathematical Functions, Applied Mathematics Series, Volume 55 (Washington: National Bureau of Standards; reprinted 1968 byDover Publications, New York), §9.8.

[1]Carrier, G.F., Krook, M. and Pearson, C.E. 1966, Functions of a Complex Variable (New York:McGraw-Hill), pp. 220ff.6.7 Bessel Functions of Fractional Order, AiryFunctions, Spherical Bessel FunctionsMany algorithms have been proposed for computing Bessel functions of fractional ordernumerically. Most of them are, in fact, not very good in practice.

The routines given here arerather complicated, but they can be recommended wholeheartedly.Ordinary Bessel FunctionsThe basic idea is Steed’s method, which was originally developed [1] for Coulomb wavefunctions. The method calculates Jν , Jν0 , Yν , and Yν0 simultaneously, and so involves fourrelations among these functions. Three of the relations come from two continued fractions,one of which is complex. The fourth is provided by the Wronskian relation2W ≡ Jν Yν0 − Yν Jν0 =(6.7.1)πxThe first continued fraction, CF1, is defined byfν ≡Jν0νJν+1= −JνxJν1ν1= −···x2(ν + 1)/x − 2(ν + 2)/x −(6.7.2)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).if (n < 2) nrerror("Index n less than 2 in bessi");if (x == 0.0)return 0.0;else {tox=2.0/fabs(x);bip=ans=0.0;bi=1.0;for (j=2*(n+(int) sqrt(ACC*n));j>0;j--) {Downward recurrence from evenbim=bip+j*tox*bi;m.bip=bi;bi=bim;if (fabs(bi) > BIGNO) {Renormalize to prevent overflows.ans *= BIGNI;bi *= BIGNI;bip *= BIGNI;}if (j == n) ans=bip;}ans *= bessi0(x)/bi;Normalize with bessi0.return x < 0.0 && (n & 1) ? -ans : ans;}.

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

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

Тип файла PDF

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

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

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

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