generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Implementing complex numbers in Lua

Previous Thread :: Next Thread 
YellowBrick1 is not online. YellowBrick1
Joined: 06 May 2009
Total Posts: 865
27 Feb 2013 05:18 PM
We all know that numbers in Lua can not be complex, they can be real. Here is an example of how to make complex numbers, and actually use them in functions, using Vector2 values.

local c = Vector2.new(1,1) -- Complex number; the X coordinate is the real value, the Y coordinate is the imaginary coordinate.

function printNum(x)
print(x.X.." + "..x.Y.."i")
end

function ln(x) -- Natural Logarithm
local real = math.log(x.X^2 + x.Y^2) / 2
local imaginary = math.acos(x.X/(x.X^2 + x.Y^2)^0.5)
return Vector2.new(real,imaginary)
end

printNum(ln(c))

-- Output:
-- 0.3465735912323 + 0.78539818525314i
Report Abuse
NVI is not online. NVI
Joined: 11 Jan 2009
Total Posts: 4744
27 Feb 2013 05:51 PM
cool story bro
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
27 Feb 2013 05:59 PM
script it again
Report Abuse
YellowBrick1 is not online. YellowBrick1
Joined: 06 May 2009
Total Posts: 865
27 Feb 2013 06:32 PM
@Prehistoricman,

What exactly are you implying?
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
27 Feb 2013 06:34 PM
Normally the saying goes "cool story bro, tell it again"
The rest is self-explanatory. I wasn't really implying anything.
Report Abuse
awsumpwner27 is not online. awsumpwner27
Joined: 03 Sep 2011
Total Posts: 4389
27 Feb 2013 06:34 PM
He was adding onto NVI's post to make one message:
"cool story bro
script it again"
Report Abuse
Garnished is not online. Garnished
Joined: 09 Apr 2012
Total Posts: 12695
27 Feb 2013 08:40 PM
You never followed Prehistoric's command.
Report Abuse
Vrakner is not online. Vrakner
Joined: 19 Feb 2013
Total Posts: 323
28 Feb 2013 11:23 AM
And that's what makes him that [Content Deleted] good.
Report Abuse
mew903 is not online. mew903
Joined: 03 Aug 2008
Total Posts: 22071
28 Feb 2013 05:57 PM
Can't be sure if these will help, but they look promising.

http://www.roblox.com/Complex-Numbers-item?id=54477193
http://www.roblox.com/Complex-Number-class-item?id=13926909
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image