ﺪﯿﻫﺩ ﻡﺎﺠﻧﺍ ﻥﺁ ﯼﻭﺭ ﺍﺭ ﯽﺿﺎﯾﺭ ﯼﺎﻫﺭﺎﮐ ﺎﺗ ﺪﻫﺩ ﯽﻣ ﻩﺯﺎﺟﺍ ﺎﻤﺷ ﻪﺑ ﯽﺿﺎﯾﺭ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯽﺷ
Math.PI;
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.PI</h2>
<p>Math.PI returns the ratio of a circle's circumference to its diameter:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.PI;
</script>
</body>
</html>
.ﺩﺭﺍﺪﻧ ﻩﺪﻧﺯﺎﺳ Math ﯽﺷ ،ءﺎﯿﺷﺍ ﺮﯾﺎﺳ ﻑﻼﺧ ﺮﺑ
.ﺖﺳﺍ ﺖﺑﺎﺛ ﯽﺿﺎﯾﺭ ﯽﺷ
.ﺩﺮﮐ ﻩﺩﺎﻔﺘﺳﺍ ﻝﻭﺍ ﯽﺿﺎﯾﺭ ﯽﺷ ﮏﯾ ﺩﺎﺠﯾﺍ ﻥﻭﺪﺑ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ ﺕﺎﯿﺻﻮﺼﺧ ﻭ ﺎﻫﺪﺘﻣ ﻪﻤﻫ
.ﯽﮔﮋﯾﻭ.ﯽﺿﺎﯾﺭ<"code class="w3-codespan> :ﺖﺳﺍ ﻦﯾﺍ ﯽﺿﺎﯾﺭ ﯽﮔﮋﯾﻭ ﺮﻫ ﯼﺍﺮﺑ ﻮﺤﻧ
:ﺖﺷﺍﺩ ﯽﺳﺮﺘﺳﺩ ﺎﻬﻧﺁ ﻪﺑ ﯽﺿﺎﯾﺭ ﺕﺎﯿﺻﻮﺼﺧ ﻥﺍﻮﻨﻋ ﻪﺑ ﻥﺍﻮﺗ ﯽﻣ ﻪﮐ ﺪﻫﺩ ﯽﻣ ﻪﺋﺍﺭﺍ ﺍﺭ ﯽﺿﺎﯾﺭ ﺖﺑﺎﺛ 8 ﺖ
Math.E // returns Euler's number
Math.PI // returns PI
Math.SQRT2 // returns the square root of 2
Math.SQRT1_2 // returns the square root of 1/2
Math.LN2 // returns the natural logarithm of 2
Math.LN10 // returns the natural logarithm of 10
Math.LOG2E // returns base 2 logarithm of E
Math.LOG10E // returns base 10 logarithm of E
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math Constants</h2>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"<p><b>Math.E:</b> " + Math.E + "</p>" +
"<p><b>Math.PI:</b> " + Math.PI + "</p>" +
"<p><b>Math.SQRT2:</b> " + Math.SQRT2 + "</p>" +
"<p><b>Math.SQRT1_2:</b> " + Math.SQRT1_2 + "</p>" +
"<p><b>Math.LN2:</b> " + Math.LN2 + "</p>" +
"<p><b>Math.LN10:</b> " + Math.LN10 + "</p>" +
"<p><b>Math.LOG2E:</b> " + Math.LOG2E + "</p>" +
"<p><b>Math.Log10E:</b> " + Math.LOG10E + "</p>";
</script>
</body>
</html>
(ﻩﺭﺎﻤﺷ)ﺵﻭﺭ.ﯽﺿﺎﯾﺭ<"code class="w3-codespan> :ﺖﺳﺍ ﻦﯾﺍ ﯽﺿﺎﯾﺭ ﺵﻭﺭ ﺮﻫ
:ﺩﺭﺍﺩ ﺩﻮﺟﻭ ﺢﯿﺤﺻ ﺩﺪﻋ ﮏﯾ ﻪﺑ ﺩﺪﻋ ﮏﯾ ﻥﺩﺮﮐ ﺩﺮﮔ ﯼﺍﺮﺑ ﻝﻮﻤﻌﻣ ﺵﻭﺭ 4
x ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﻩﺪﺷ ﺩﺮﮔ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺘﮑﯾﺩﺰﻧ ﻪﺑ ﺍﺭ
x ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﻥﺁ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺘﮑﯾﺩﺰﻧ ﻪﺑ ﺍﺭ ﻩﺪﺷ ﺩﺮﮔ
x ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﻥﺁ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺘﮑﯾﺩﺰﻧ ﻪﺑ ﺍﺭ ﻩﺪﺷ ﺩﺮﮔ
(ES6 ﺭﺩ ﺪﯾﺪﺟ) ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﺢﯿﺤﺻ ﺖﻤﺴﻗ
Math.round()
Math.round(x)
ﮏﯾﺩﺰﻧﯽﻣﺮﺑ ﺍﺭ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺗﺪﻧ
Math.round(4.6);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.round()</h2>
<p>Math.round(x) returns the value of x rounded to its nearest integer:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.round(4.6);
</script>
</body>
</html>
Math.round(4.5);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.round()</h2>
<p>Math.round(x) returns the value of x rounded to its nearest integer:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.round(4.5);
</script>
</body>
</html>
Math.round(4.4);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.round()</h2>
<p>Math.round(x) returns the value of x rounded to its nearest integer:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.round(4.4);
</script>
</body>
</html>
Math.ceil()
Math.ceil(x)
ﺭﺍﺪﻘﻣ x ﻩﺪﺷ ﺩﺮﮔ ﻻﺎﺑ ﺪﻧ
Math.ceil(4.9);
Math.ceil(4.7);
Math.ceil(4.4);
Math.ceil(4.2);
Math.ceil(-4.2);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.ceil()</h2>
<p>Math.ceil() rounds a number <strong>up</strong> to its nearest integer:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.ceil(4.4);
</script>
</body>
</html>
Math.floor()
Math.floor(x)
ﺭﺍﺪﻘﻣ x ﻩﺪﺷ ﺩﺮﮔ ﻦﯿﯾﺎﭘ
Math.floor(4.9);
Math.floor(4.7);
Math.floor(4.4);
Math.floor(4.2);
Math.floor(-4.2);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.floor()</h2>
<p>Math.floor(x) returns the value of x rounded <strong>down</strong> to its nearest integer:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.floor(4.7);
</script>
</body>
</html>
Math.trunc()
Math.trunc(x)
ﺢﯿﺤﺻ ﺖﻤﺴﻗ x ﯽﻣﺮﺑ ﺍﺭﺪﻧﺍﺩﺮﮔ:
Math.trunc(4.9);
Math.trunc(4.7);
Math.trunc(4.4);
Math.trunc(4.2);
Math.trunc(-4.2);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.trunc()</h2>
<p>Math.trunc(x) returns the integer part of x:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.trunc(4.7);
</script>
</body>
</html>
Math.sign()
:ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ Math.sign(x)
،ﺪﺷﺎﺑ ﺖﺒﺜﻣ ﺎﯾ ﯽﻬﺗ ،ﯽﻔﻨ
Math.sign(-4);
Math.sign(0);
Math.sign(4);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.sign()</h2>
<p>Math.sign(x) returns if x is negative, null or positive:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.sign(4);
</script>
</body>
</html>
Math.trunc() ﻭ Math.sign() 2015 ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﺑ - ES6 ﺪﻧﺪﺷ ﻪﻓﺎﺿﺍ.
Math.pow()
Math.pow(x, y)
ﺭﺍﺪﻘﻣ x ﻥﺍﻮﺗ ﻪﺑ ﺍﺭ y ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ:
Math.pow(8, 2);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.pow()</h2>
<p>Math.pow(x,y) returns the value of x to the power of y:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.pow(8,2);
</script>
</body>
</html>
Math.sqrt()
Math.sqrt(x)
ﺭﺬﺟ x ﯽﻣﺮﺑ ﺍﺭﺪﻧﺍﺩﺮﮔ:
Math.sqrt(64);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.sqrt()</h2>
<p>Math.sqrt(x) returns the square root of x:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.sqrt(64);
</script>
</body>
</html>
Math.abs()
Math.abs(x)
(ﺖﺒﺜﻣ) ﻖﻠﻄﻣ ﺭﺍﺪﻘﻣ x ﯽﻣﺮﺑ ﺍﺭﺪﻧﺍﺩﺮﮔ:
Math.abs(-4.7);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.abs()</h2>
<p>Math.abs(x) returns the absolute (positive) value of x:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.abs(-4.7);
</script>
</body>
</html>
Math.sin()
Math.sin(x)
ﻪﯾﻭﺍﺯ (1 ﻭ -1 ﻦﯿﺑ ﺭﺍﺪﻘﻣ) ﺱﻮﻨﯿﺳ x (ﻥﺎﯾﺩﺍﺭ
:ﺪﯿﻨﮐ ﻞﯾﺪﺒﺗ ﻥﺎﯾﺩﺍﺭ ﻪﺑ ﺍﺭ ﻪﺟﺭﺩ ﺪﯾﺎﺑ ،ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ ﻪﺟﺭﺩ ﺯﺍ ﻥﺎﯾﺩﺍﺭ ﯼﺎﺟ ﻪﺑ ﺪﯿﻫﺍﻮﺧ ﯽﻣ ﺮﮔﺍ
.x PI/180 ﻪﺟﺭﺩ ﺐﺴﺣ ﺮﺑ ﻪﯾﻭﺍﺯ=ﻥﺎﯾﺩﺍﺭ ﺐﺴﺣ ﺮﺑ ﻪﯾﻭﺍﺯ
Math.sin(90 * Math.PI / 180); // returns 1 (the sine of 90 degrees)
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.sin()</h2>
<p>Math.sin(x) returns the sin of x (given in radians):</p>
<p>Angle in radians = (angle in degrees) * PI / 180.</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"The sine value of 90 degrees is " + Math.sin(90 * Math.PI / 180);
</script>
</body>
</html>
Math.cos()
Math.cos(x)
ﻪﯾﻭﺍﺯ (1 ﻭ -1 ﻦﯿﺑ ﺭﺍﺪﻘﻣ) ﺱﻮﻨﯿﺴﮐ x (ﻥﺎﯾﺩﺍ
:ﺪﯿﻨﮐ ﻞﯾﺪﺒﺗ ﻥﺎﯾﺩﺍﺭ ﻪﺑ ﺍﺭ ﻪﺟﺭﺩ ﺪﯾﺎﺑ ،ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ ﻪﺟﺭﺩ ﺯﺍ ﻥﺎﯾﺩﺍﺭ ﯼﺎﺟ ﻪﺑ ﺪﯿﻫﺍﻮﺧ ﯽﻣ ﺮﮔﺍ
.x PI/180 ﻪﺟﺭﺩ ﺐﺴﺣ ﺮﺑ ﻪﯾﻭﺍﺯ=ﻥﺎﯾﺩﺍﺭ ﺐﺴﺣ ﺮﺑ ﻪﯾﻭﺍﺯ
Math.cos(0 * Math.PI / 180); // returns 1 (the cos of 0 degrees)
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.cos()</h2>
<p>Math.cos(x) returns the cosine of x (given in radians):</p>
<p>Angle in radians = (angle in degrees) * PI / 180.</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"The cosine value of 0 degrees is " + Math.cos(0 * Math.PI / 180);
</script>
</body>
</html>
Math.min() / Math.max()
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ → ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ → ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ .ﺖﺧﻮﻣﺁ ﺪﯿﻫﺍﻮﺧ ﺮﺘﺸﯿﺑ :ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ ﺪﺷﺭ ﺯﺍ ﯽﻨﯿﻌﻣ ﺢﻄﺳ ﻪﺑ ﻥﺪﯿﺳﺭ ﯼﺍﺮﺑ ﻡﺯﻻ ﻥﺎﻣﺯ ﯽﻌﯿﺒﻃ ﻢﺘﯾﺭﺎﮕﻟ → ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ → ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ → ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ Math.E ﻭ Math.log() ﺪﻨﺘﺴﻫ ﻮﻠﻗﻭﺩ. ؟ﻢﯿﺳﺮﺑ 10 ﺩﺪﻋ ﻪﺑ ﺎﺗ ﻢﯿﻨﮐ ﺏﺮﺿ ﺍﺭ Math.E ﺪﯾﺎﺑ ﺮﺑﺍﺮﺑ ﺪﻨﭼ → ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ ؟ﻢﯿﺳﺮﺑ 8 ﺩﺪﻋ ﻪﺑ ﺎﺗ ﻢﯿﻨﮐ ﺏﺮﺿ ﺍﺭ 2 ﺪﯾﺎﺑ ﺭﺎﺑ ﺪﻨﭼ → ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ ؟ﻢﯿﺳﺮﺑ 1000 ﻪﺑ ﺎﺗ ﻢﯿﻨﮐ ﺏﺮﺿ ﺍﺭ 10 ﺪﯾﺎﺑ ﺭﺎﺑ ﺪﻨﭼ → ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﻖﻠﻄﻣ ﺭﺍﺪﻘﻣ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﻥﺎﯾﺩﺍﺭ ﺐﺴﺣ ﺮﺑ ﺍﺭ x ﻦﯾﺯﻮﮐﺭﺁ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﮏﯿﻟﻮﺑﺮﭙﯿﻫ ﻦﯾﺯﻮﮐﺭﺁ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﻥﺎﯾﺩﺍﺭ ﺐﺴﺣ ﺮﺑ ﺍﺭ x ﻦﯿﺴﮐﺭﺁ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﯽﻟﻮﻟﺬﻫ ﻥﺎﻤﮐ .ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﻥﺎﯾﺩﺍﺭ PI/2 ﻭ PI/2- ﻦﯿﺑ ﯼﺩﺪﻋ ﺭﺍﺪﻘﻣ ﮏﯾ ﻥﺍﻮﻨﻋ ﻪﺑ ﺍﺭ x ﺖﻧﺍﮋﻧﺎﺗ ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ ﺩﻮﺧ ﯼﺎﻫ ﻥﺎﻣﻮﮔﺭﺁ ﺐﯾﺮﺿ ﻊﻃﺎﻘﺘﻣ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﯽﻟﻮﻟﺬﻫ ﺱﺎﻤﻣ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﺐﻌﮑﻣ ﻪﺸﯾﺭ x ﺖﺳﺍ ﻩﺪﺷ ﺩﺮﮔ ﻻﺎﺑ ﺖﻤﺳ ﻪﺑ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺘﮑﯾﺩﺰﻧ ﻪﺑ ﻪﮐ ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ (ﺖﺳﺍ ﻥﺎﯾﺩﺍﺭ ﺐﺴﺣ ﺮﺑ x) ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﺱﻮﻨﯿﺴﮐ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﯽﻟﻮﻟﺬﻫ ﺱﻮﻨﯿﺴﮐ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﺖﺳﺍ ﻩﺪﺷ ﺩﺮﮔ ﻦﯿﯾﺎﭘ ﺖﻤﺳ ﻪﺑ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺘﮑﯾﺩﺰﻧ ﻪﺑ ﻪﮐ ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x (E ﻪﯾﺎﭘ) ﯽﻌﯿﺒﻃ ﻢﺘﯾﺭﺎﮕﻟ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ ﺭﺍﺪﻘﻣ ﻦﯾﺮﺗﻻﺎﺑ ﺎﺑ ﺩﺪﻋ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺭﺍﺪﻘﻣ ﻦﯾﺮﺘﻤﮐ ﺎﺑ ﺍﺭ ﯼﺩﺪﻋ ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ y ﻥﺍﻮﺗ ﻪﺑ ﺍﺭ x ﺭﺍﺪﻘﻣ ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ 1 ﻭ 0 ﻦﯿﺑ ﯽﻓﺩﺎﺼﺗ ﺩﺪﻋ ﮏﯾ x ﺪﻨﮐ ﯽﻣ ﺩﺮﮔ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺘﮑﯾﺩﺰﻧ ﻪﺑ ﺍﺭ .ﺩﺩﺮﮔ ﯽﻣﺮﺑ (1 ،0 ،1-) ﺪﺷﺎﺑ ﺖﺒﺜﻣ ﺎﯾ ﯽﻬﺗ ،ﯽﻔﻨﻣ x ﺮﮔﺍ (ﺖﺳﺍ ﻥﺎﯾﺩﺍﺭ ﺐﺴﺣ ﺮﺑ x) ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﺱﻮﻨﯿﺳ ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ x ﯽﻟﻮﻟﺬﻫ ﺱﻮﻨﯿﺳ ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ x ﺭﺬﺟ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ ﻪﯾﻭﺍﺯ ﮏﯾ ﺱﺎﻤﻣ ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ ﺩﺪﻋ ﮏﯾ ﯽﻟﻮﻟﺬﻫ ﺱﺎﻤﻣ .ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ (x) ﺩﺪﻋ ﮏﯾ ﺢﯿﺤﺻ ﺖﻤﺴﻗ .ﺪﯾﻭﺮﺑ ﺎﻣ ﯽﺿﺎﯾﺭ ءﯽﺷ ﻞﻣﺎﮐ ﻊﺟﺮﻣ ﻪﺑ ،ﻞﻣﺎﮐ ﻊﺟﺮﻣ ﮏﯾ ﯼﺍﺮﺑ .ﺖﺳﺍ ﯽﺿﺎﯾﺭ ﯼﺎﻫ ﺵﻭﺭ ﻭ ﺎﻫ ﯽﮔﮋﯾﻭ ﻡﺎﻤﺗ ﺯﺍ ﯽﯾﺎﻫ ﻪﻧﻮﻤﻧ ﻭ ﺕﺎﺤﯿﺿﻮﺗ ﯼﻭﺎﺣ ﻊﺟﺮﻣMath.min()
ﻭ Math.max()
ﻝﺎﺜﻣ
Math.min(0, 150, 30, 20, -8, -200);
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.min()</h2>
<p>Math.min() returns the lowest value in a list of arguments:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
Math.min(0, 150, 30, 20, -8, -200);
</script>
</body>
</html>
ﻝﺎﺜﻣ
Math.max(0, 150, 30, 20, -8, -200);
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.max()</h2>
<p>Math.max() returns the highest value in a list of arguments.</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
Math.max(0, 150, 30, 20, -8, -200);
</script>
</body>
</html>
Math.random()
Math.random()
ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ 1 ﻭ (ﻞﻣﺎﺷ) 0 ﻦﯿﺑ ﯽﻓﺩﺎﺼﺗ ﺩﺪ ﻝﺎﺜﻣ
Math.random();
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.random()</h2>
<p>Math.random() returns a random number between 0 and 1:</p>
<p id="demo"></p>
<p>Tip: Click on "Run" several times.</p>
<script>
document.getElementById("demo").innerHTML = Math.random();
</script>
</body>
</html>
Math.random()
ﺩﺭﻮﻣ ﺭﺩ ﺵﺯﻮﻣﺁ ﻦﯾﺍ .()Math.log ﺪﺘﻣ
Math.log(x)
ﯽﻌﯿﺒﻃ ﻢﺘﯾﺭﺎﮕﻟ x ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ. ﺎﻫ ﻝﺎﺜﻣ
Math.log(1);
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.log()</h2>
<p>Math.log() returns the natural logarithm of a number:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.log(1);
</script>
</body>
</html>
Math.log(2);
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.log()</h2>
<p>Math.log() returns the natural logarithm of a number:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.log(2);
</script>
</body>
</html>
Math.log(3);
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.log()</h2>
<p>Math.log() returns the natural logarithm of a number:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.log(3);
</script>
</body>
</html>
Math.log(10);
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.log()</h2>
<p>How many times must we multiply Math.E to get 10?</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.log(10);
</script>
</body>
</html>
.()Math.log2 ﺪﺘﻣ
Math.log2(x)
2 ﻪﯾﺎﭘ ﻢﺘﯾﺭﺎﮕﻟ x ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ.Math.log2(8);
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.log2()</h2>
<p>Math.log2() returns the base 2 logarithm of a number.</p>
<p>How many times must we multiply 2 to get 8?</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.log2(8);
</script>
</body>
</html>
.()Math.log10 ﺵﻭﺭ
Math.log10(x)
10 ﻪﯾﺎﭘ ﻢﺘﯾﺭﺎﮕﻟ x ﯽﻣﺮﺑ ﺍﺭﺪﻧﺍﺩﺮﮔ.Math.log10(1000);
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.log10()</h2>
<p>Math.log10() returns the base 10 logarithm of a number.</p>
<p>How many times must we multiply 10 to get 1000?</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Math.log10(1000);
</script>
</body>
</html>
ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯽﺿﺎﯾﺭ ﯼﺎﻫ ﺵﻭﺭ
ﯽﺿﺎﯾﺭ ﻞﻣﺎﮐ ﻊﺟﺮﻣ