Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!tut.cis.ohio-state.edu!ucbvax!husc6!cmcl2!dasys1!ejablow From: ejablow@dasys1.UUCP (Eric Robert Jablow) Newsgroups: comp.lang.pascal Subject: Re: complex numbers Message-ID: <10369@dasys1.UUCP> Date: 26 Jul 89 07:38:36 GMT References: <1301@draken.nada.kth.se> Reply-To: ejablow@dasys1.UUCP (Eric Robert Jablow) Organization: Big Electric Cat//SUNY at Stony Brook Math Dept. Lines: 39 I have recently written a TP5.5 unit for using compolex numbers as objects. I wanted to do it this way because I intend to extend the complex numbers to the "Riemann sphere" and to the quaternions; also, I wanted to learn TP5.5. I can't post it here; it's extremely long, as I added everything but the kitchen sink; also, my error handling routine uses two units from TurboPower's Turbo Professional 5.0, and if you wanted to recompile my unit, you would need that product or you would have to change the routine. Here's a typical example of how it might be used. Program Example; {Print the 3 third roots of 5.0 + 3.0i} uses Complex; var z : ComplexNumber; root : ComplexNumber; j : Integer; begin z.Init(5.0, 3.0); {z = 5 + 3i} w.Copy(CZero); {root = 0.0 + 0.0i} For j := 0 To 2 Do root := z; {root = 5 + 3i} root.BrComplexPower((1.0/3.0), 2.0*Pi*j); {replace root by its third root, where} {the argument of the original root has its} {argument assumed to be between 2*pi*j} { and 2*pi*(j+1).} root.Display; {write it on the standard output.} WriteLn; End {of For} End; -- Eric Jablow {allegra,philabs,cmcl2}!hombre\ Big Electric Cat Public Unix {bellcore,cmcl2}!cucard!dasys1!ejablow New York, NY, USA New address: eric%sbmath@sbee.sunysb.edu.