home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Amiga / Applications / Mathematiques / Newton.lha / Newton / ds.c < prev    next >
C/C++ Source or Header  |  1988-11-22  |  775b  |  48 lines

  1. /* ds.c:    Data structure routines.
  2.  *
  3.  * Written by Daniel Barrett.  100% PUBLIC DOMAIN. */
  4.  
  5. #include "decl.h"
  6.  
  7.  
  8. InitPoly(poly, n)
  9. /* Initialize the polynomial to all zeroes. */
  10. complex poly[];
  11. int n;
  12. {
  13.     int i;
  14.     for (i=0; i<n; i++)
  15.         AssignComplex(&poly[i], 0.0, 0.0);
  16. }
  17.  
  18.  
  19. AssignComplex(comp, realPart, imagPart)
  20. /* Assign the real & imaginary parts to a complex number. */
  21. complex *comp;
  22. double realPart, imagPart;
  23. {
  24.     comp->n[REAL] = realPart;
  25.     comp->n[IMAG] = imagPart;
  26. }
  27.  
  28.  
  29. CopyPoly(poly1, poly2, degree)
  30. /* Copy poly1 into poly2. */
  31. complex poly1[], poly2[];
  32. int degree;
  33. {
  34.     int i;
  35.     for (i=0; i<=degree; i++)
  36.         CopyComplex(poly1[i], &poly2[i]);
  37.  
  38. }
  39.  
  40.  
  41. CopyComplex(c1, c2)
  42. /* Copy complex number c1 into c2. */
  43. complex c1, *c2;
  44. {
  45.     AssignComplex(c2, c1.n[REAL], c1.n[IMAG]);
  46. }
  47.  
  48.