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: Mathematical Functions

Previous Thread :: Next Thread 
Ryuzoji is not online. Ryuzoji
Joined: 21 Dec 2015
Total Posts: 937
07 Jan 2016 09:22 PM
http://wiki.roblox.com/index.php?title=Function_dump/Mathematical_functions

What's the uses for them?

I see scripts with math.sqrt, math.atan, etc.

I know a few of them, like math.ceil, math.floor, math.abs, etc.
Report Abuse
checkplate is not online. checkplate
Joined: 05 Jan 2016
Total Posts: 1379
07 Jan 2016 09:27 PM
ceil rounds up if it has a decimal, floor rounds down, abs gets the absolute distance a number is form zero.
Report Abuse
Ryuzoji is not online. Ryuzoji
Joined: 21 Dec 2015
Total Posts: 937
08 Jan 2016 07:33 AM
Thanks, but I said I know those, lol.

What is math.sqrt, math.atan, etc. used for?
Report Abuse
TickerOfTime is not online. TickerOfTime
Joined: 02 Sep 2012
Total Posts: 2030
08 Jan 2016 08:36 AM
`math.sqrt` is the radicand function, basically. Returns the square root.
`math.atan` is arc tangent. Idk what you'd use it for, but I've seen it in geometry uses.
Report Abuse
nox7 is not online. nox7
Joined: 29 Aug 2008
Total Posts: 27467
08 Jan 2016 08:51 AM
It really just depends on what you need it for :|

atan, tanh, sinh, asin, sin, etc...

Those are functions for calculating trigonometric ratios. Solving right triangles or applying similar laws of triangles (law of cosines/sines). You'll need an issue with such to solve.
Report Abuse
lupine is not online. lupine
Joined: 24 Jun 2008
Total Posts: 3561
08 Jan 2016 10:28 AM
I mean, sin and cos are pretty important as they solve for the X and Y (respectively) vectors of a vector that doesn't lie on one axis. If you have a diagonal line and you know the angle it creates with the X axis, you can solve for both X and Y.

atan, acos, asin are all inverse functions of the base functions tan, cos, and sin respectively. Instead of taking an angle and spitting out a number, you put in a number (more often than not a fraction, such as 4/7) and it spits out an angle.

math.log is useful because then you can solve for x if x is an exponent, like
2^x = 8

max and min are my two favorite math functions. Super useful to find the max and min of a set of numbers (gasp, that's what they're used for?)

math.modf is neat. If I do
local n,d = math.modf(3.1415)
n = 3
d = 0.1415

math.noise is used in a lot of terrain generation algorithms. It uses Perlin noise (you may have also heard of Simplex noise). It's complex-ish, I wouldn't get into that if you don't need ot.

Report Abuse
lokkut is not online. lokkut
Joined: 18 Mar 2009
Total Posts: 1794
08 Jan 2016 11:02 AM
math.atan2 is more commonly used for geometry

because:
"It also handles correctly the case of x being zero."
Report Abuse
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
08 Jan 2016 11:08 AM
Like lokkut stated, math.atan2 is more commonly used. For example, if you want to make a turret face towards a point, you would probably use math.atan2. But that doesn't mean that math.atan is useless. Probably, math.atan2 makes one or more calls to math.atan to do it's black magic.

I have personally used math.acos and math.asin to get angles from dot products of vectors, which is sometimes useful.
Report Abuse
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
08 Jan 2016 11:10 AM
Oh, and math.atan2 is not handy 'because it correctly handles the case of x being zero'. It's awesome because it deals with x AND y values, in all quadrants.
Report Abuse
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
08 Jan 2016 11:12 AM
Also also also, math.noise, math.random and math.randomseed are awesome for prodedural generation of all sorts of content.
Report Abuse
Kamov is not online. Kamov
Joined: 07 Aug 2008
Total Posts: 29015
08 Jan 2016 11:39 AM
For trigonometry obviously
Report Abuse
Ryuzoji is not online. Ryuzoji
Joined: 21 Dec 2015
Total Posts: 937
08 Jan 2016 06:18 PM
Thanks
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