11.07.2014 Views

Flute acoustics: measurement, modelling and design - School of ...

Flute acoustics: measurement, modelling and design - School of ...

Flute acoustics: measurement, modelling and design - School of ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

APPENDIX B. PROGRAM LISTINGS 229<br />

/*<br />

Complex.h<br />

By Andrew Botros, 2000-2004<br />

Listing B.8: Complex.h<br />

Hyperbolic trig fns <strong>and</strong> expz added by Paul Dickens, 2005<br />

Complex arithmetic library.<br />

*/<br />

#ifndef COMPLEX_H_PROTECTOR<br />

#define COMPLEX_H_PROTECTOR<br />

/* complex: { Re(z), Im(z) } */<br />

typedef struct complex_str {<br />

double Re;<br />

double Im;<br />

} complex;<br />

/* externally defined complex numbers zero, one, j <strong>and</strong> inf for<br />

convenience */<br />

extern complex zero;<br />

extern complex one;<br />

extern complex j;<br />

extern complex inf;<br />

double modz(complex z);<br />

/*<br />

Parameters:<br />

z: given complex number.<br />

Returns:<br />

|z| ... Modulus <strong>of</strong> z<br />

*/<br />

double argz(complex z);<br />

/*<br />

Parameters:<br />

z: given complex number.<br />

Returns:<br />

arg z ... Principal arg <strong>of</strong> z<br />

*/<br />

int equalz(complex z1, complex z2);<br />

/*<br />

Parameters:<br />

z1: given complex number.<br />

z2: given complex number.<br />

Returns:<br />

1 if z1 equals z2, 0 otherwise.<br />

*/<br />

complex real(double x);<br />

/*<br />

Parameters:<br />

x: given double.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!