|
|
1.1 ! root 1: ! 2: ! 3: j0() Mathematics Function j0() ! 4: ! 5: ! 6: ! 7: ! 8: Compute Bessel function ! 9: ! 10: #include <math.h> ! 11: ddoouubbllee jj00(_z) ddoouubbllee _z; ! 12: ! 13: jj00 computes the Bessel function of the first kind for order 0 for ! 14: its argument z. ! 15: ! 16: ***** Example ***** ! 17: ! 18: This example, called bessel.c, demonstrates the Bessel functions ! 19: j0, j1, and jn. Compile it with the following command line ! 20: ! 21: ! 22: cc -f bessel.c -lm ! 23: ! 24: ! 25: to include floating-point functions and the mathematics library. ! 26: ! 27: ! 28: #include <math.h> ! 29: #include <stdio.h> ! 30: #define display(x) dodisplay((double)(x), #x) ! 31: ! 32: ! 33: ! 34: dodisplay(value, name) ! 35: double value; char *name; ! 36: { ! 37: if (errno) ! 38: perror(name); ! 39: ! 40: ! 41: ! 42: else ! 43: printf("%10g %s\n", value, name); ! 44: errno = 0; ! 45: } ! 46: ! 47: ! 48: ! 49: main() ! 50: { ! 51: extern char *gets(); ! 52: double x; ! 53: char string[64]; ! 54: ! 55: ! 56: ! 57: for(;;) { ! 58: printf("Enter number: "); ! 59: if(gets(string) == NULL) ! 60: break; ! 61: x = atof(string); ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66: ! 67: ! 68: ! 69: j0() Mathematics Function j0() ! 70: ! 71: ! 72: ! 73: ! 74: ! 75: ! 76: display(x); ! 77: display(j0(x)); ! 78: display(j1(x)); ! 79: display(jn(0,x)); ! 80: ! 81: ! 82: ! 83: display(jn(1,x)); ! 84: display(jn(2,x)); ! 85: display(jn(3,x)); ! 86: } ! 87: putchar('\n'); ! 88: } ! 89: ! 90: ! 91: ***** See Also ***** ! 92: ! 93: j1(), jn(), mathematics library ! 94: ! 95: ! 96: ! 97: ! 98: ! 99: ! 100: ! 101: ! 102: ! 103: ! 104: ! 105: ! 106: ! 107: ! 108: ! 109: ! 110: ! 111: ! 112: ! 113: ! 114: ! 115: ! 116: ! 117: ! 118: ! 119: ! 120: ! 121: ! 122: ! 123: ! 124: ! 125: ! 126: ! 127: ! 128: ! 129: ! 130: COHERENT Lexicon Page 2 ! 131: ! 132:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.