c21-1 (779629), страница 7
Текст из файла (страница 7)
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).void free_f3tensor(float ***t, long nrl, long nrh, long ncl, long nch,long ndl, long ndh)/* free a float f3tensor allocated by f3tensor() */{free((FREE_ARG) (t[nrl][ncl]+ndl-NR_END));free((FREE_ARG) (t[nrl]+ncl-NR_END));free((FREE_ARG) (t+nrl-NR_END));}947Utility Routines (nrutil.c)void free_submatrix(float **b, long nrl, long nrh, long ncl, long nch)/* free a submatrix allocated by submatrix() */{free((FREE_ARG) (b+nrl-NR_END));}Complex ArithmeticThe functions listed below are used by the Recipes cisi, frenel, hypdrv,hypgeo, hypser, laguer, zroots, and fixrts for complex arithmetic.
A complexnumber is defined to be a structure containing two float values, the real (.r) andimaginary (.i) parts. Complex arguments are passed and returned by value. Seeadditional discussion in §1.2.On the diskette, this Appendix is in the file complex.c.#include <math.h>typedef struct FCOMPLEX {float r,i;} fcomplex;fcomplex Cadd(fcomplex a, fcomplex b){fcomplex c;c.r=a.r+b.r;c.i=a.i+b.i;return c;}fcomplex Csub(fcomplex a, fcomplex b){fcomplex c;c.r=a.r-b.r;c.i=a.i-b.i;return c;}fcomplex Cmul(fcomplex a, fcomplex b){fcomplex c;c.r=a.r*b.r-a.i*b.i;c.i=a.i*b.r+a.r*b.i;return c;}fcomplex Complex(float re, float im){fcomplex c;c.r=re;c.i=im;return c;}fcomplex Conjg(fcomplex z){fcomplex c;c.r=z.r;948Sample 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).Appendix C:Complex Arithmetic (complex.c)949c.i = -z.i;return c;}float Cabs(fcomplex z){float x,y,ans,temp;x=fabs(z.r);y=fabs(z.i);if (x == 0.0)ans=y;else if (y == 0.0)ans=x;else if (x > y) {temp=y/x;ans=x*sqrt(1.0+temp*temp);} else {temp=x/y;ans=y*sqrt(1.0+temp*temp);}return ans;}fcomplex Csqrt(fcomplex z){fcomplex c;float x,y,w,r;if ((z.r == 0.0) && (z.i == 0.0)) {c.r=0.0;c.i=0.0;return c;} else {x=fabs(z.r);y=fabs(z.i);if (x >= y) {r=y/x;w=sqrt(x)*sqrt(0.5*(1.0+sqrt(1.0+r*r)));} else {r=x/y;w=sqrt(y)*sqrt(0.5*(r+sqrt(1.0+r*r)));}if (z.r >= 0.0) {c.r=w;c.i=z.i/(2.0*w);} else {c.i=(z.i >= 0) ? w : -w;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).fcomplex Cdiv(fcomplex a, fcomplex b){fcomplex c;float r,den;if (fabs(b.r) >= fabs(b.i)) {r=b.i/b.r;den=b.r+r*b.i;c.r=(a.r+r*a.i)/den;c.i=(a.i-r*a.r)/den;} else {r=b.r/b.i;den=b.i+r*b.r;c.r=(a.r*r+a.i)/den;c.i=(a.i*r-a.r)/den;}return c;}Appendix C950c.r=z.i/(2.0*c.i);}return c;}}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).fcomplex RCmul(float x, fcomplex a){fcomplex c;c.r=x*a.r;c.i=x*a.i;return c;}Index of Programs and Dependenciesaddintairyamebsainterpbessikbessjyran1 .amotsa.. .. .beschb.
. .[funk]. . .. . .chebev. . . ...........§19.6 (p. 880)§6.7 (p. 250).....§10.9 (p. 452).........§10.4 (p. 411)..ran1amoebaamotryamotsaannealanorm2arcmakarcodearcsumavevarbadlukbalanc[funk]amotry[funk][funk][funk]ran1ran3 .irbit1trncstmetroptrnsptrevcstreverse. . .. . .arcsum. . .. . .juldayflmoon.
. .[funk]........................§10.4 (p. 412)§10.9 (p. 454)............§10.9 (p. 448)ran3........................................................................§19.6§20.5§20.5§20.5§14.2§1.1............§11.5 (p. 483)951(p. 887)(p. 912)(p. 913)(p. 914)(p. 617)(p. 13)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).The following table lists, in alphabetical order, all the routines in NumericalRecipes. When a routine requires subsidiary routines, either from this book or elseuser-supplied, the full dependency tree is shown: A routine calls directly all routinesto which it is connected by a solid line in the column immediately to its right; itcalls indirectly the connected routines in all columns to its right. Typographicalconventions: Routines from this book are in typewriter font (e.g., eulsum, gammln).The smaller, slanted font is used for the second and subsequent occurences of aroutine in a single dependency tree.
(When you are getting routines from theNumerical Recipes diskettes, or their archive files, you need only specify names inthe larger, upright font.) User-supplied routines are indicated by the use of textfont and square brackets, e.g., [funcv]. Consult the text for individual specificationsof these routines. The right-hand side of the table lists section and page numbersfor each program.952Index of Programs and Dependencies............................§2.4 (p. 54)§2.4 (p. 53)banmulbcucofbcuint.
. .. . .bcucof....................................§2.4 (p. 52)§3.6 (p. 126)§3.6 (p. 127)beschbbessichebevbessi0........................§6.7 (p. 245)§6.6 (p. 239)........................§6.6 (p. 237)§6.6 (p. 238)chebev. . .................§6.7 (p. 248)§6.5 (p. 235).........§6.5 (p. 232). . .chebev................§6.5 (p. 233)§6.7 (p. 243)bessi0 .bessi1........§6.6 (p. 239)..................§6.6 (p. 237)§6.6 (p.
238)bessj1 .bessj0. . . .. . . .........§6.5 (p. 234)................§6.5 (p. 232)§6.5 (p. 233)bessi0bessi1........bessj0beschbbessj0bessj1. . .bessj1bessjy. . .beschbbessikbessjbessk...bessk0bessk1........bessk0bessk1bessi0bessi1bessybessy0bessy1bessy1bessy0bessj0bessj1betabetacfgammln .. . .........................§6.1 (p. 216)§6.4 (p. 227)gammlnbetacffactlnbicobksub . . . .............§6.4 (p.
227)gammln. . ...................§6.1 (p. 215)§17.3 (p. 770)............§7.3 (p. 295).. .. .[funcv]..................§10.2 (p. 404)§9.7 (p. 390)[derivs][funcv]. . .......§16.4 (p. 728)........§1.1 (p. 14)betaibnldevbrentbroydnbsstepcaldatran1 .gammln[func] .fminfdjacqrdcmpqrupdtrsolvlnsrchmmidpzextr. . .rotatefmin....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).banbksbandec953Index of Programs and Dependencies§5.9 (p. 195)§5.8 (p. 193)§5.8 (p. 192). . .. . .[func]....................................chebpcchint .chixy .choldc........................................................§5.10§5.9§15.3§2.9cholslchsone.















