PHP Tutorial #17 Mathematical Methods (Abs, Acos , Acosh and Asin )

Image Source

Repository

https://github.com/php/php-src  

What Will I Learn?

I will learn the mathematical methods , we will take the " Abs, Acos , Acosh and Asin " methods.     

  • How to get the absolute value using Abs method.
  • What's the Acos method and how to use it.
  • The concept of the Acosh method and its uses.
  • How to get the arc sin of a value using Asin method.

Requirements

  • Server support PHP , Xampp or Wamp for example
  • An IDE like Sublime text.
  • Browser (Chrome for example) 

Difficulty

  • Basic

Description

1- Abs method  

This function returns the absolute value of a natural, integer or real number. Thus, it will remove the sign from the specified number so that when it is a negative number, it eliminates the minus sign "-" before the number.  

It is therefore impossible to get a negative number with this function, they will always be positive, it is therefore a very useful function to keep the "natural"  part of a number. 

It has the expression as parameter ,this parameter is used to specify an expression representing a number to process. 

It return a number greater than 0 these values are the only ones that can be returned. The absolute value of a number is always positive.  

To use the abs method you need to pass the number as parameter

abs($number)

I have a negative number and I want to get the positive of this number using the abs method

$number = -25;

echo abs($number);

The abs method will return the positive number , it will eliminate the minus sign (-) , and this is the result

2- Acos method  

This function returns the cosine arc of number . The acos is the inverse function of cos (), which means that a == cos (acos (a)) for any value in the validity range of acos (). 

It has The argument to be treated and it returns the arc cosine of the argument, in radians.  

To use the acos method you need to pass the argument as parameter

acos($argument)

The validity range is [-1,1], I will pass the number 0 to this method and this is the result

echo acos(0);

3- Acosh Method

This function returns the hyperbolic cosine arc of an argument.  It has the expression as parameter , This parameter is used to specify the expression containing the number to be processed.

To use the acosh method you must pass the argument as parameter

acosh(argument)

The validity range is [-1,+inf[, I will pass the number 3 to this method and this is the result

echo acosh(3);

4- Asin Method

This trigonometric function makes it possible to return the sine arc. It has the expression as parameter this parameter is used to indicate the expression containing the number to be processed. 

The value of the parameter must be in a range between -1 and 1, otherwise the function will consider that domain error has occurred. 

It returns -π / 2 to π / 2 these values are used to indicate the radians of the sine arc.  

To use the asin method you need to pass a number between -1 and 1

asin($number)

I will pass the number 0 to the asin method and this is the result

Video Tutorial 

Curriculum

Proof of Work Done

https://github.com/alexendre-maxim/PHP-Tutorial/blob/master/string7.php

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center