linkedin facebook linkedin facebook nod32

PHP da matematik funksiyalar

Muallif: Mengliyev Shaydulla Abdusalomovich

Qo`shilgan sana: 2020-03-31

PHP da matematik funksiyalar

PHP ning matematik funksiyalar kutubxonasi trigonametrik hisoblashlar, sonli shakl almashtirishlar va sonli almashtirishlarni bajaradi. Trigonametrik funksiyalar argumentlari radianlarda beriladi, hamda gradiuslarni radianga va aksincha almashtiruvchi funksiyalar ham mavjud. Matematik operatorlar bilan bir qatorda PHP da ko‘p sonli matematik funksiyalar ham nazarda tutilgan.
Bular quyidagilar:

abs() - sonning absolyut qiymati.

<?php
$x=$_POST['x'];
$y=abs($x);
echo "abs= $y";
?>
<form action="abs.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

acos() – radianda ifodalangan arkkosinus.
acosh() - radianda ifodalangan giperbolik arkkosinus.
asin() - radianda ifodalangan arksinus.
asinh() - giperbolik arksinus.
atan() - radianda ifodalangan arktangisi.
atanh() - giperbolik arktangesi.

<?php
$x=$_POST['x'];
$y=acos($x);
$y1=acosh($x);
$y2=asin($x);
$y3=asinh($x);
$y4=atan($x);
$y5=atanh($x);
echo "acos= $y, <br> acosh= $y1, <br> asin= $y2, <br> asinh= $y3, <br> atan= $y4, <br> atanh= $y3";
?>
<form action="acos.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

atan2() - radianda ifodalangan x va y ning arktanggensi atan(y/x) dan farqli ikkala parametr ishorasi natija kvadratini ko‘rinishini aniqlashda foydalaniladi.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$atan2=atan2($x,$y);
echo "atan2= $atan2 ";
?>
<form action="atan2.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

base_convert() - satr ko‘rinida berilgan sonlarni bir sanoq sistemadan boshqa bir sanoq sistemaga o‘tkazadi. Argument o‘rniga quyidagilar quyiladi o‘giriluvchi son, berilgan sanoq sistema, o‘tkaziladigan sanoq sistema.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$n=$_POST['n'];
$base_convert=base_convert($x,$y,$n);
echo "base_convert= $base_convert ";
?>
<form action="base_convert.php" method="post" >
<b>o‘giriluvchi son=</b><input name="x" type="text"><br>
<b>sanoq sistema=</b><input name="y" type="text"><br>
<b>sanoq sistema=</b><input name="n" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

bindec() - ikkilik sonni ifadalovchi satrni o‘nlik qiymatga o‘tkazadi.

<?php
$x=$_POST['x'];
$bindec=bindec($x);
echo "bindec= $bindec";
?>
<form action="bindec.php" method="post" >
<b>Ikkilik sonni kiriting=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

ceil() - sonni o‘zidan katta butun songa yaxlitlash.

<?php
$x=$_POST['x'];
$ceil=ceil($x);
echo "ceil= $ceil";
?>
<form action="ceil.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

cos() - radianda ifodalangan kosinus.
cosh() - giperbolik kosinus.

<?php
$x=$_POST['x'];
$y=cos($x);
$y1=cosh($x);
echo "cos= $y, <br> cosh= $y1";
?>
<form action="cos.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

decbin() - o‘nlik sonni ifadalovchi satrni ikkilik qiymatga o‘girish.
dechex() - o‘nlik sonni ifadalovchi satrni o‘n oltilik qiymatga o‘girish.
decoct() - o‘nlik sonni ifadalovchi satrni sakkizlik qiymatga o‘girish.

<?php
$x=$_POST['x'];
$y=decbin($x);
$y1=dechex($x);
$y2=decoct($x);
echo "Ikkilik= $y <br> o‘n oltilik= $y1 <br> sakkizlik= $y2";
?>
<form action="sanoq.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

deg2rad() – gradius o‘lchovidan radian o‘lchoviga o‘tish.

<?php
$x=$_POST['x'];
$y=deg2rad($x);
echo "Radius o‘lchov= $y";
?>
<form action="deg2rad.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

exp() - berilgan sonning eksponentasini hisoblash.

<?php
$x=$_POST['x'];
$y=exp($x);
echo "exp= $y";
?>
<form action="exp.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

floor() - sonni o‘zidan kichik butun songa yaxlitlash.

<?php
$x=$_POST['x'];
$y=floor($x);
echo "floor= $y";
?>
<form action="floor.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

fmod() -ikki son x ni y ga bo‘lgandagi qoldiq.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$natija=fmod($x,$y);
echo "fmod= $natija";
?>
<form action="fmod.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

getrandmax() – rand() funksiya vositasida olish mumkin bo‘lgan maksimal qiymat.

<?php
$y=getrandmax();
echo "getrandmax= $y";
?>

hexdec() - o‘n oltilik sonni ifadalovchi satrni o‘nlik qiymatga o‘girish.

<?php
$x=$_POST['x'];
$hexdec=hexdec($x);
echo "hexdec= $hexdec";
?>
<form action="hexdec.php" method="post" >
<b>O‘n oltilik sonni kiriting=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

hypot() - to‘g‘ri burchakli uchburchakda ikki katet bo‘yicha gipotenuzani hisoblash.

<?php
$a=$_POST['a'];
$b=$_POST['b'];
$natija=hypot($a,$b);
echo "Gipotenuzasi= $natija";
?>
<form action="hypot.php" method="post" >
<b>a=</b><input name="a" type="text"><br>
<b>b=</b><input name="b" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

is_finite() – berilgan x qiymatning platforma uchun maksimal ekanligini tekshirish.

<?php
$x=$_POST['x'];
$y=is_finite($x);
echo "is_finite= $y";
?>
<form action="is_finite.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

is_infinite() – berilgan x qiymatning platforma uchun cheksiz ekanligini tekshirish.

<?php
$x=$_POST['x'];
$y=is_infinite($x);
echo "is_infinite= $y";
?>
<form action="is_infinite.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

is_nan() – berilgan x qiymatning platforma uchun nan ekanligini tekshirish.

<?php
$x=$_POST['x'];
$y=is_nan($x);
echo "is_nan= $y";
?>
<form action="is_nan.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

lcg_value() – 0 va 1 psevdo tasodifiy sonlar generatori.

<?php
$x=$_POST['x'];
$y=lcg_value($x);
echo "lcg_value= $y";
?>
<form action="lcg_value.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

log10() - o‘nlik logarifm.
log() - natural logarifm.
log1p() – log(1+x), bunda x ning qiymati nolga yaqin bo‘lganda ham natija aniq chiqadi. log() ning aniqligi etarli bo‘lmaganligi sababli, bu holda shunchaki log(1) ga qaytiladi.

<?php
$x=$_POST['x'];
$y=log($x);
$y1=log10($x);
$y2=log1p($x);
echo "log= $y<br>log10= $y1<br> log1p= $y2";
?>
<form action="log.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

max() - berilgan x va y sonlarning maksimumi.
min() - berilgan x va y sonlarning minumimi.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$max=max($x,$y);
$min=min($x,$y);
echo "maksim= $max <br> minumi=$min";
?>
<form action="max_min.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

mt_getrandmax() - mt_rand() funksiyasi bilan olinishi mumkin bo‘lgan maksimal qiymat.

<?php
$y=mt_getrandmax();
echo "mt_getrandmax= $y";
?>

mt_rand() – tasodifiy son bo‘lib, u son Tvister metodi bo‘yicha generatsiya qilinadi. Funksiyani qo‘llashdan oldin mt_srand() funksiyasi yordamida boshlang‘ich sonni belgilash lozim.
mt_srand() – berilgan parametrga mos ravishda tasadifiy sonlar generatori uchun boshlang‘ich qiymatni belgilash. Bunda mt_rand() funksiyasiga murojaat jarayonida turli natijalar olish imkonini beradi.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$mt_srand=mt_srand($y);
for ($i=$x; $i<=$y; $i++)
echo mt_rand($x,$y). "<br> ";
?>
<form action="mt_srand.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

number_format() – sonni formatlaydi. Uning argumenti: formatlanuvchi son, verguldan keying raqamlar soni, o‘nlik nuqta o‘rnida foydalaniladi (uni yozish shart emas), mingliklarni chegaralobchi simvol (uni yozish shart emas).

<?php
$x=$_POST['x'];
$y=number_format(12548*log($x));
echo number_format($y,5,',',' " ');
?>
<form action="number_format.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

octdec() –sakkizlik sanoq sistemadagi sonni ifadalovchi satrni o‘nlik qiymatga o‘girish.

<?php
$x=$_POST['x'];
$y=octdec($x);
echo "O‘nlik sanoq sistema= $y";
?>
<form action="octdec.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

pi() - π sonining qiymati aniqlaydi.

<?php
$y=pi();
echo "Pi ning qiymati= $y";
?>

pow() – x sonini y darajaga ko‘tarish.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$natija=pow($x,$y);
echo "x ni y darajaga ko`tarish= $natija";
?>
<form action="pow.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

rad2deg() -radian o‘lchovdan gradus o‘lchovga o‘tish.

<?php
$x=$_POST['x'];
$y=rad2deg(pi()/$x);
echo "rad2deg= $y";
?>
<form action="rad2deg.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

round() – x sonini yaxlitlash.

<?php
$x=$_POST['x'];
$y=round($x);
echo "yaxlitlash= $y";
?>
<form action="round.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

sin() - radianda ifodalangan sinus.
sinh() - radianda ifodalangan geperbolik sinus.

<?php
$x=$_POST['x'];
$y=sin(pi()/$x);
$y1=sinh(pi()/$x);
echo "sin= $y, <br> sinh= $y1";
?>
<form action="sin.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

sqrt() – x sonining kvadrat ildizi.

<?php
$x=$_POST['x'];
$y=sqrt($x);
echo "sqrt= $y";
?>
<form action="sqrt.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

rand() - psevdotasodifiy son. Majburiy bo‘lmagan arhumentlar ruxsat berilgan qiymatlar diapazon generatorini aniqlaydi. Ular berilgan tasodifiy son 0 dan rand_max gacha bo‘lgan oraliqdan olinadi. Ushbu funksiyadan foydalanishdan oldin srand() funksiyasi yordamida boshlang‘ich son aniqlanish lozim.
srand() - psevdotasodifiy sonlar generatorini inisializatsiyalsh.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$srand=srand($y);
for ($i=$x; $i<=$y; $i++)
echo rand($x,$y). "<br> ";
?>
<form action="mt_srand.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

tan() - radianda ifodalangan tangens.
tanh() - radianda ifodalangan giperbolik tangens.

<?php
$x=$_POST['x'];
$y=tan(pi()/$x);
$y1=tanh(pi()/$x);
echo "tan= $y <br> tanh= $y1";
?>
<form action="tan.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

PHP tilida matematik hisoblashlarni ixtiyoriy aniqlikda olib borishga mo‘ljallangan fuksiyalar mavjud. Ushbu funksiyalarning o‘ziga xosligi razryadli parametrga ega ekanligidir. Razryadlilik – bu operandlar va natijalardagi o‘nlik nuqtalardan keyin joylashgan belgilar miqdori.

bcadd() – birinchi va ikkinchi argumentlar yig‘indisi. Uchinchi argument – razryadlilik parametr.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$n=$_POST['n'];
$bcadd=bcadd($x,$y,$n);
echo "bcadd= $bcadd ";
?>
<form action="bcadd.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<b>n=</b><input name="n" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

bccomp() – sonli taqqoslash. Agar birinchi argument ikkinchisidan katta bo‘lsa, u holda +1 ga qaytiladi. Agar birinchi argument ikkinchisidan kichik bo‘lsa, -1 qaytiladi. Agar argument teng bo‘lsa, 0 ga qaytiladi.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$n=$_POST['n'];
$bccomp=bccomp($x,$y,$n);
echo "bccomp= $bccomp ";
?>
<form action="bccomp.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<b>n=</b><input name="n" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

bcdiv() – birinchi argumentni ikkinchi argumentga bo‘lgandagi bo‘linma.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$n=$_POST['n'];
$bcdiv=bcdiv($x,$y,$n);
echo "bcdiv= $bcdiv ";
?>
<form action="bcdiv.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<b>n=</b><input name="n" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

bcmod() - birinchi argumentni ikkinchi argumentga bo‘lgandagi qoldiq.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$bcmod=bcmod($x,$y);
echo "bcmod= $bcmod ";
?>
<form action="bcmod.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

bcmul() - birinchi va ikkinchi argumentlarning ko‘paytmasi.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$n=$_POST['n'];
$bcmul=bcmul($x,$y,$n);
echo "bcmul= $bcmul ";
?>
<form action="bcmul.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<b>n=</b><input name="n" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

bcpow() – drajaga ko‘tarish. Argumentlar: asos, daraja ko‘rsatkichi, razryad parametri. Bunda x soni y darajaga ko‘tarib, verguldan keyin ikki xonagacha olinadi.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$n=$_POST['n'];
$bcpow=bcpow($x,$y,$n);
echo "bcpow= $bcpow ";
?>
<form action="bcpow.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<b>n=</b><input name="n" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

bcscale() – standart holda foydalanuvchi razryadli parametrlarning qiymati.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$k1=bcpow($x,$y);
$bcscale=bcscale(2);
$k2=bcpow($x,$y);
echo "k1= $k1<br> k2=$k2";
?>
<form action="bcscale.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

bcsqrt() – sonning kvadrat ildizi.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$bcsqrt=bcsqrt($x,$y);
echo "bcsqrt= $bcsqrt";
?>
<form action="bcsqrt.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

bcsub() – birinchi argumentdan ikkinchisini ayirish.

<?php
$x=$_POST['x'];
$y=$_POST['y'];
$n=$_POST['n'];
$bcsub=bcsub($x,$y,$n);
echo "bcsub= $bcsub ";
?>
<form action="bcsub.php" method="post" >
<b>x=</b><input name="x" type="text"><br>
<b>y=</b><input name="y" type="text"><br>
<b>n=</b><input name="n" type="text"><br>
<input type="Submit" value="Hisoblash">
</form>

589 marta o`qildi.

Parol:
Eslab qolish.


Ro`yhatdan o`tish

testing

+998915878681

Siz o`z maxsulotingizni 3D reklama ko`rinishda bo`lishini xohlaysizmi? Unda xamkorlik qilamiz.

3D Reklama


Рейтинг@Mail.ru
Рейтинг@Mail.ru

Besucherzahler
счетчик посещений