PHP atan() ও atan2() ফাংশন

সংজ্ঞা ও ব্যবহার

atan() ফাংশন একটি সংখ্যার বিপরীক্ষা ত্রিকোণমিতি ফিরিয়ে দেয়, যার মান -PI/2 এবং PI/2 এর মধ্যে (অন্তর্ভুক্ত -PI/2 এবং PI/2)।

atan2() ফাংশন দুই পারামিটারের বিপরীক্ষা ত্রিকোণমিতি ফিরিয়ে দেয়, যার মান একক আংশ (রেডিয়ান) হয়, যার মান -PI এবং PI এর মধ্যে (অন্তর্ভুক্ত -PI এবং PI)।

Syntax

atan(x)
atan2(x,y)
Parameter Description
x Required. A number.
y Required. A number.

Description

The atan() function returns x arctangent value, in radians. atan() is the inverse function of tan(), which means that each value within the range of atan() is a==tan(atan(a)).

The atan2() function calculates the arctangent value of two variables x and y arctangent value. Similar to calculating the arctangent of y / x, the difference is that the signs of the two parameters are used to determine the quadrant of the result.

Instance

Example 1

This example calculates the arctangent of different values:

<?php
echo(atan(0.50));
echo(atan(-0.50));
echo(atan(5));
echo(atan(10));
echo(atan(-5));
echo(atan(-10))
?>

Output:

0.463647609001
-0.463647609001
1.37340076695
1.4711276743
-1.37340076695
-1.4711276743

Example 2

This example calculates the arctangent of different variables x and y:

<?php
echo(atan2(0.50,0.50));
echo(atan2(-0.50,-0.50));
echo(atan2(5,5));
echo(atan2(10,20));
echo(atan2(-5,-5));
echo(atan2(-10,10))
?>

Output:

0.785398163397
-2.35619449019
0.785398163397
0.463647609001
-2.35619449019
-0.785398163397