Log in

View Full Version : Complex Numbers (Using Units)?



fiveten
06-16-2012, 06:31 PM
I am new to Simba, SRL, Free Pascal, and this forum, so I hope this is the correct section for my post.

I was searching google and found a unit for Free Pascal called ucomplex which should work for what I need, but I am not sure how to include it into my script. I know I could just write my own class which holds both real and imaginary parts of the number and overload the operators. In fact, this site (http://www.freepascal.org/docs-html/ref/refse84.html)explains it very well, but my question concerns including these units into my script.

http://wiki.freepascal.org/Unit_categorization

I have tried this script but it fails to compile on the "uses UCOMPLEX" line:



program CmplxDemo;
uses UCOMPLEX;
var
z: Complex;
begin
z := Cmplx (13, 37) { z := x + iy }
end.

Sin
06-16-2012, 06:32 PM
It looks similar to a TPoint.

Brandon
06-16-2012, 07:27 PM
Copy all your unit stuff into a .Simba file. do {$I LocationOfSimbaFile.Simba}

edit anything that may need converting to compile.

How in the world does this look like TPoints.. -__-