summaryrefslogtreecommitdiff
path: root/libm/double/coil.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-11-22 14:04:29 +0000
committerEric Andersen <andersen@codepoet.org>2001-11-22 14:04:29 +0000
commit7ce331c01ce6eb7b3f5c715a38a24359da9c6ee2 (patch)
tree3a7e8476e868ae15f4da1b7ce26b2db6f434468c /libm/double/coil.c
parentc117dd5fb183afb1a4790a6f6110d88704be6bf8 (diff)
Totally rework the math library, this time based on the MacOs X
math library (which is itself based on the math lib from FreeBSD). -Erik
Diffstat (limited to 'libm/double/coil.c')
-rw-r--r--libm/double/coil.c63
1 files changed, 0 insertions, 63 deletions
diff --git a/libm/double/coil.c b/libm/double/coil.c
deleted file mode 100644
index f7156497c..000000000
--- a/libm/double/coil.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Program to calculate the inductance of a coil
- *
- * Reference: E. Jahnke and F. Emde, _Tables of Functions_,
- * 4th edition, Dover, 1945, pp 86-89.
- */
-
-double sin(), cos(), atan(), ellpe(), ellpk();
-
-double d;
-double l;
-double N;
-
-/* double PI = 3.14159265358979323846; */
-extern double PI;
-
-main()
-{
-double a, f, tana, sina, K, E, m, L, t;
-
-printf( "Self inductance of circular solenoidal coil\n" );
-
-loop:
-getnum( "diameter in centimeters", &d );
-if( d < 0.0 )
- exit(0); /* escape gracefully */
-getnum( "length in centimeters", &l );
-if( d < 0.0 )
- exit(0);
-getnum( "total number of turns", &N );
-if( d < 0.0 )
- exit(0);
-tana = d/l; /* form factor */
-a = atan( tana );
-sina = sin(a); /* modulus of the elliptic functions (k) */
-m = cos(a); /* subroutine argument = 1 - k^2 */
-m = m * m;
-K = ellpk(m);
-E = ellpe(m);
-tana = tana * tana; /* square of tan(a) */
-
-f = ((K + (tana - 1.0) * E)/sina - tana)/3.0;
-L = 4.e-9 * PI * N * N * d * f;
-printf( "L = %.4e Henries\n", L );
-goto loop;
-}
-
-
-/* Get value entered on keyboard
- */
-getnum( str, pd )
-char *str;
-double *pd;
-{
-char s[40];
-
-printf( "%s (%.10e) ? ", str, *pd );
-gets(s);
-if( s[0] != '\0' )
- {
- sscanf( s, "%lf", pd );
- printf( "%.10e\n", *pd );
- }
-}