Function Dump/Mathematical Functions: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Mindraker
No edit summary
>Anaminus
cleaned up some examples
Line 15: Line 15:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = -10, 10, .1 do
for i = -10, 10, .1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+math.abs(i),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+math.abs(i),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 36: Line 33:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = -1, 1, .01 do
for i = -1, 1, .01 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i*10,50+math.acos(i)*10,0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i*10,50+math.acos(i)*10,0))
wait()
wait()
end
end
 
</pre>
</pre>
}}
}}
Line 58: Line 51:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = -1, 1, .01 do
for i = -1, 1, .01 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i*10,50+math.asin(i)*10,0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i*10,50+math.asin(i)*10,0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 79: Line 69:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = -5, 5, .1 do
for i = -5, 5, .1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i*10,50+math.atan(i)*10,0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i*10,50+math.atan(i)*10,0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 100: Line 87:
{{Example|
{{Example|
<pre>
<pre>
a=math.atan2 (1,2)
for i = -5, 5, .1 do
b=math.deg (a)
local p = Instance.new("Part")
print(b)
p.Parent = game.Workspace
 
p.Size = Vector3.new(1,1,1)
Will result in:
p.Anchored = true
26.565051177078 (degrees)
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i*10,50+math.atan2(1,i)*10,0))
wait()
end
</pre>
</pre>
}}
}}
Line 117: Line 106:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = 0, 50, .1 do
for i = 0, 50, .1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,math.ceil(i),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,math.ceil(i),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 139: Line 125:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = 0, 50, .1 do
for i = 0, 50, .1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(2*math.cos(i),i,0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(2*math.cos(i),i,0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 160: Line 143:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = 0, 5, .1 do
for i = 0, 50, .1 do
 
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,2*math.cosh(i),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,2*math.cosh(i),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 197: Line 177:
<pre>
<pre>
for i = -5, 5, .1 do
for i = -5, 5, .1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+math.exp(i),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+math.exp(i),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 216: Line 194:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = 0, 50, .1 do
for i = 0, 50, .1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,math.floor(i),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,math.floor(i),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 238: Line 213:
<pre>
<pre>
for i = -10, 10, 1 do
for i = -10, 10, 1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+math.fmod(i,2),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+math.fmod(i,2),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 292: Line 265:
<pre>
<pre>
for i = -10, 10, 1 do
for i = -10, 10, 1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+math.ldexp (i, 1),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+math.ldexp (i, 1),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 313: Line 284:
<pre>
<pre>
for i = 0, 30, 1 do
for i = 0, 30, 1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+5*math.log (i),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+5*math.log (i),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 333: Line 302:
<pre>
<pre>
for i = 0, 30, 1 do
for i = 0, 30, 1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+5*math.log10 (i),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+5*math.log10 (i),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 408: Line 375:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = 0, 10, .1 do
for i = 0, 50, .1 do
 
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i+50,math.pow(i,2),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i+50,math.pow(i,2),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 445: Line 409:
{{Example|
{{Example|
<pre>
<pre>
print(math.random (0, 10))
local str = ""
for i = 1,10 do
local num = math.random(33,126)
str = str .. string.char(num)
end


Might result in:
print(str)
7
</pre>
</pre>
}}
}}
Line 465: Line 432:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = 0, 20, .1 do
for i = 0, 50, .1 do
 
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(2*math.sin(i),i,0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(3*math.sin(i),3*i,3*math.cos(i)))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 486: Line 450:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = -2, 2, .1 do
for i = 0, 50, .1 do
 
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(2*math.sinh(i),i+50,0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(2*math.sinh(i),5*i+50,2*math.cosh(i)))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 508: Line 469:
<pre>
<pre>
for i = 0, 30, 1 do
for i = 0, 30, 1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+5*math.sqrt (i),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+5*math.sqrt (i),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 527: Line 486:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = 0, 50, .1 do
for i = 0, 50, .1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+2*math.tan(i),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+2*math.tan(i),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}
Line 548: Line 504:
{{Example|
{{Example|
<pre>
<pre>
local i = 0
for i = -5, 5, .1 do
for i = -5, 5, .1 do
local p = Instance.new("Part")
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Parent = game.Workspace
p.Name = "Brick"
p.Size = Vector3.new(1,1,1)
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Anchored = true
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+2*math.tanh(i),0))
p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+2*math.tanh(i),0))
wait()
wait()
end
end
</pre>
</pre>
}}
}}


----
----

Revision as of 02:04, 15 October 2008


Mathematical Functions

This library is an interface to the standard C math library. It provides all its functions inside the table math.


math.abs (x)


Returns the absolute value of x.

Example
for i = -10, 10, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+math.abs(i),0))
	wait()
end


math.acos (x)


Returns the arc cosine of x (in radians).

Example
for i = -1, 1, .01 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i*10,50+math.acos(i)*10,0))
	wait()
end


math.asin (x)


Returns the arc sine of x (in radians).

Example
for i = -1, 1, .01 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i*10,50+math.asin(i)*10,0))
	wait()
end


math.atan (x)


Returns the arc tangent of x (in radians).

Example
for i = -5, 5, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i*10,50+math.atan(i)*10,0))
	wait()
end


math.atan2 (y, x)


Returns the arc tangent of y/x (in radians), but uses the signs of both parameters to find the quadrant of the result. (It also handles correctly the case of x being zero.)

Example
for i = -5, 5, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i*10,50+math.atan2(1,i)*10,0))
	wait()
end


math.ceil (x)


Returns the smallest integer larger than or equal to x.

Example
for i = 0, 50, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,math.ceil(i),0))
	wait()
end


math.cos (x)


Returns the cosine of x (assumed to be in radians).

Example
for i = 0, 50, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(2*math.cos(i),i,0))
	wait()
end


math.cosh (x)


Returns the hyperbolic cosine of x.

Example
for i = 0, 5, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,2*math.cosh(i),0))
	wait()
end


'math.deg (x)


Returns the angle x (given in radians) in degrees.

Example
a=math.deg (1.5707963267948966192313216916398)
print(a)

Will result in:
90


math.exp (x)


Returns the the value e^x.

Example
for i = -5, 5, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+math.exp(i),0))
	wait()
end


math.floor (x)


Returns the largest integer smaller than or equal to x.

Example
for i = 0, 50, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,math.floor(i),0))
	wait()
end


math.fmod (x, y)


Returns the remainder of the division of x by y that rounds the quotient towards zero.

Example
for i = -10, 10, 1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+math.fmod(i,2),0))
	wait()
end


math.frexp (x)


Returns m and e such that x = m*2^e, e is an integer and the absolute value of m is in the range [0.5, 1) (or zero when x is zero).

Example
print(math.frexp (0))

Will result in:
0 0
print(math.frexp (4))

Will result in:
0.5 3 -- (2^3/2=4)


math.huge


The value HUGE_VAL, a value larger than or equal to any other numerical value.

Example
print(math.huge)

Will result in:
1.#INF


math.ldexp (m, e)


Returns m*2^e (e should be an integer).

Example
for i = -10, 10, 1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+math.ldexp (i, 1),0))
	wait()
end


math.log (x)


Returns the natural logarithm of x.

Example
for i = 0, 30, 1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+5*math.log (i),0))
	wait()
end


math.log10 (x)


Returns the base-10 logarithm of x.

Example
for i = 0, 30, 1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+5*math.log10 (i),0))
	wait()
end


math.max (x, ···)


Returns the maximum value among its arguments.

Example
print(math.max (1, 2, 3, 4, 5, 6, 7))
Will result in:
7


math.min (x, ···)


Returns the minimum value among its arguments.

Example
print(math.min (1, 2, 3, 4, 5, 6, 7))

Will result in:
1


math.modf (x)


Returns two numbers, the integral part of x and the fractional part of x.

Example
print(math.modf (2.5))

Will result in:
2 0.5


math.pi


The value of pi.

Example
a=(math.pi^2)
print(math.sqrt(a))

Will result in:
3.1415926535898


math.pow (x, y)


Returns x^y. (You can also use the expression x^y to compute this value.)

Example
for i = 0, 10, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i+50,math.pow(i,2),0))
	wait()
end


math.rad (x)


Returns the angle x (given in degrees) in radians.

Example
print(math.rad (90))

Will result in:
1.5707963267949 (Which is pi/2)


math.random ([m [, n]])


This function is an interface to the simple pseudo-random generator function rand provided by ANSI C. (No guarantees can be given for its statistical properties.)

When called without arguments, returns a pseudo-random real number in the range [0,1). When called with a number m, math.random returns a pseudo-random integer in the range [1, m]. When called with two numbers m and n, math.random returns a pseudo-random integer in the range [m, n].

Example
local str = ""
for i = 1,10 do
	local num = math.random(33,126)
	str = str .. string.char(num)
end

print(str)


math.randomseed (x)


Sets x as the "seed" for the pseudo-random generator: equal seeds produce equal sequences of numbers.


math.sin (x)


Returns the sine of x (assumed to be in radians).

Example
for i = 0, 20, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(3*math.sin(i),3*i,3*math.cos(i)))
	wait()
end


math.sinh (x)


Returns the hyperbolic sine of x.

Example
for i = -2, 2, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(2*math.sinh(i),5*i+50,2*math.cosh(i)))
	wait()
end


math.sqrt (x)


Returns the square root of x. (You can also use the expression x^0.5 to compute this value.)

Example
for i = 0, 30, 1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+5*math.sqrt (i),0))
	wait()
end


math.tan (x)


Returns the tangent of x (assumed to be in radians).

Example
for i = 0, 50, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+2*math.tan(i),0))
	wait()
end


math.tanh (x)


Returns the hyperbolic tangent of x.

Example
for i = -5, 5, .1 do
	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Size = Vector3.new(1,1,1)
	p.Anchored = true
	p.CFrame=(CFrame.fromEulerAnglesXYZ(0,0,0)+Vector3.new(i,50+2*math.tanh(i),0))
	wait()
end